Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 1 | //===-- SPUSubtarget.h - Define Subtarget for the Cell SPU ------*- C++ -*-===// |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 10 | // This file declares the Cell SPU-specific subclass of TargetSubtargetInfo. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 14 | #ifndef CELLSUBTARGET_H |
| 15 | #define CELLSUBTARGET_H |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 16 | |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 17 | #include "llvm/Target/TargetSubtargetInfo.h" |
Evan Cheng | ab8be96 | 2011-06-29 01:14:12 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCInstrItineraries.h" |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 19 | #include <string> |
| 20 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 21 | #define GET_SUBTARGETINFO_HEADER |
Evan Cheng | 385e930 | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 22 | #include "SPUGenSubtargetInfo.inc" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 23 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 24 | namespace llvm { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 25 | class GlobalValue; |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame^] | 26 | class StringRef; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 27 | |
| 28 | namespace SPU { |
| 29 | enum { |
Dale Johannesen | db01c8b | 2008-02-14 23:35:16 +0000 | [diff] [blame] | 30 | PROC_NONE, |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 31 | DEFAULT_PROC |
| 32 | }; |
| 33 | } |
| 34 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 35 | class SPUSubtarget : public SPUGenSubtargetInfo { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 36 | protected: |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 37 | /// stackAlignment - The minimum alignment known to hold of the stack frame |
| 38 | /// on entry to the function and which must be maintained by every function. |
| 39 | unsigned StackAlignment; |
| 40 | |
| 41 | /// Selected instruction itineraries (one entry per itinerary class.) |
| 42 | InstrItineraryData InstrItins; |
| 43 | |
| 44 | /// Which SPU processor (this isn't really used, but it's there to keep |
| 45 | /// the C compiler happy) |
| 46 | unsigned ProcDirective; |
| 47 | |
| 48 | /// Use (assume) large memory -- effectively disables the LQA/STQA |
| 49 | /// instructions that assume 259K local store. |
| 50 | bool UseLargeMem; |
| 51 | |
| 52 | public: |
| 53 | /// This constructor initializes the data members to match that |
Daniel Dunbar | 3be0340 | 2009-08-02 22:11:08 +0000 | [diff] [blame] | 54 | /// of the specified triple. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 55 | /// |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 56 | SPUSubtarget(const std::string &TT, const std::string &CPU, |
| 57 | const std::string &FS); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 58 | |
| 59 | /// ParseSubtargetFeatures - Parses features string setting specified |
| 60 | /// subtarget options. Definition of function is auto generated by tblgen. |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame^] | 61 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
Anton Korobeynikov | 41a0243 | 2009-05-23 19:50:50 +0000 | [diff] [blame] | 62 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 63 | /// SetJITMode - This is called to inform the subtarget info that we are |
| 64 | /// producing code for the JIT. |
| 65 | void SetJITMode(); |
| 66 | |
| 67 | /// getStackAlignment - Returns the minimum alignment known to hold of the |
| 68 | /// stack frame on entry to the function and which must be maintained by |
| 69 | /// every function for this subtarget. |
| 70 | unsigned getStackAlignment() const { return StackAlignment; } |
| 71 | |
| 72 | /// getInstrItins - Return the instruction itineraies based on subtarget |
| 73 | /// selection. |
| 74 | const InstrItineraryData &getInstrItineraryData() const { |
| 75 | return InstrItins; |
| 76 | } |
| 77 | |
| 78 | /// Use large memory addressing predicate |
| 79 | bool usingLargeMem() const { |
| 80 | return UseLargeMem; |
| 81 | } |
| 82 | |
| 83 | /// getTargetDataString - Return the pointer size and type alignment |
| 84 | /// properties of this subtarget. |
| 85 | const char *getTargetDataString() const { |
| 86 | return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128" |
Kalle Raiskila | 505faa6 | 2010-10-26 10:45:47 +0000 | [diff] [blame] | 87 | "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:64:128-v128:128:128" |
Chris Lattner | 59a9178 | 2009-11-07 19:07:32 +0000 | [diff] [blame] | 88 | "-s:128:128-n32:64"; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 89 | } |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 90 | |
| 91 | bool enablePostRAScheduler(CodeGenOpt::Level OptLevel, |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 92 | TargetSubtargetInfo::AntiDepBreakMode& Mode, |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 93 | RegClassVector& CriticalPathRCs) const; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 94 | }; |
| 95 | } // End llvm namespace |
| 96 | |
| 97 | #endif |