blob: 19b97d3a0c79adc4b8d20b1ad59826bfa3228a61 [file] [log] [blame]
Chris Lattner4ee451d2007-12-29 20:36:04 +00001//===-- SPUSubtarget.h - Define Subtarget for the Cell SPU ------*- C++ -*-===//
Scott Michel564427e2007-12-05 01:24:05 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel564427e2007-12-05 01:24:05 +00007//
8//===----------------------------------------------------------------------===//
9//
Evan Cheng5b1b44892011-07-01 21:01:15 +000010// This file declares the Cell SPU-specific subclass of TargetSubtargetInfo.
Scott Michel564427e2007-12-05 01:24:05 +000011//
12//===----------------------------------------------------------------------===//
13
Chris Lattner4ee451d2007-12-29 20:36:04 +000014#ifndef CELLSUBTARGET_H
15#define CELLSUBTARGET_H
Scott Michel564427e2007-12-05 01:24:05 +000016
Evan Cheng5b1b44892011-07-01 21:01:15 +000017#include "llvm/Target/TargetSubtargetInfo.h"
Evan Chengab8be962011-06-29 01:14:12 +000018#include "llvm/MC/MCInstrItineraries.h"
Scott Michel564427e2007-12-05 01:24:05 +000019#include <string>
20
Evan Cheng94214702011-07-01 20:45:01 +000021#define GET_SUBTARGETINFO_HEADER
Evan Cheng385e9302011-07-01 22:36:09 +000022#include "SPUGenSubtargetInfo.inc"
Evan Cheng94214702011-07-01 20:45:01 +000023
Scott Michel564427e2007-12-05 01:24:05 +000024namespace llvm {
Scott Michel564427e2007-12-05 01:24:05 +000025 class GlobalValue;
Scott Michel564427e2007-12-05 01:24:05 +000026
27 namespace SPU {
28 enum {
Dale Johannesendb01c8b2008-02-14 23:35:16 +000029 PROC_NONE,
Scott Michel564427e2007-12-05 01:24:05 +000030 DEFAULT_PROC
31 };
32 }
33
Evan Cheng94214702011-07-01 20:45:01 +000034 class SPUSubtarget : public SPUGenSubtargetInfo {
Scott Michel564427e2007-12-05 01:24:05 +000035 protected:
Scott Michel564427e2007-12-05 01:24:05 +000036 /// stackAlignment - The minimum alignment known to hold of the stack frame
37 /// on entry to the function and which must be maintained by every function.
38 unsigned StackAlignment;
39
40 /// Selected instruction itineraries (one entry per itinerary class.)
41 InstrItineraryData InstrItins;
42
43 /// Which SPU processor (this isn't really used, but it's there to keep
44 /// the C compiler happy)
45 unsigned ProcDirective;
46
47 /// Use (assume) large memory -- effectively disables the LQA/STQA
48 /// instructions that assume 259K local store.
49 bool UseLargeMem;
50
51 public:
52 /// This constructor initializes the data members to match that
Daniel Dunbar3be03402009-08-02 22:11:08 +000053 /// of the specified triple.
Scott Michel564427e2007-12-05 01:24:05 +000054 ///
Evan Cheng276365d2011-06-30 01:53:36 +000055 SPUSubtarget(const std::string &TT, const std::string &CPU,
56 const std::string &FS);
Scott Michel564427e2007-12-05 01:24:05 +000057
58 /// ParseSubtargetFeatures - Parses features string setting specified
59 /// subtarget options. Definition of function is auto generated by tblgen.
Evan Cheng276365d2011-06-30 01:53:36 +000060 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Anton Korobeynikov41a02432009-05-23 19:50:50 +000061
Scott Michel564427e2007-12-05 01:24:05 +000062 /// SetJITMode - This is called to inform the subtarget info that we are
63 /// producing code for the JIT.
64 void SetJITMode();
65
66 /// getStackAlignment - Returns the minimum alignment known to hold of the
67 /// stack frame on entry to the function and which must be maintained by
68 /// every function for this subtarget.
69 unsigned getStackAlignment() const { return StackAlignment; }
70
71 /// getInstrItins - Return the instruction itineraies based on subtarget
72 /// selection.
73 const InstrItineraryData &getInstrItineraryData() const {
74 return InstrItins;
75 }
76
77 /// Use large memory addressing predicate
78 bool usingLargeMem() const {
79 return UseLargeMem;
80 }
81
82 /// getTargetDataString - Return the pointer size and type alignment
83 /// properties of this subtarget.
84 const char *getTargetDataString() const {
85 return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128"
Kalle Raiskila505faa62010-10-26 10:45:47 +000086 "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:64:128-v128:128:128"
Chris Lattner59a91782009-11-07 19:07:32 +000087 "-s:128:128-n32:64";
Scott Michel564427e2007-12-05 01:24:05 +000088 }
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000089
90 bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
Evan Cheng5b1b44892011-07-01 21:01:15 +000091 TargetSubtargetInfo::AntiDepBreakMode& Mode,
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000092 RegClassVector& CriticalPathRCs) const;
Scott Michel564427e2007-12-05 01:24:05 +000093 };
94} // End llvm namespace
95
96#endif