Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1 | // $Id$ -*- C++ -*-- |
| 2 | //*************************************************************************** |
| 3 | // File: |
| 4 | // SparcInternals.h |
| 5 | // |
| 6 | // Purpose: |
| 7 | // This file defines stuff that is to be private to the Sparc |
| 8 | // backend, but is shared among different portions of the backend. |
| 9 | //**************************************************************************/ |
| 10 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 11 | |
| 12 | #ifndef SPARC_INTERNALS_H |
| 13 | #define SPARC_INTERNALS_H |
| 14 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 15 | |
| 16 | #include "SparcRegClassInfo.h" |
| 17 | #include "llvm/Target/TargetMachine.h" |
| 18 | #include "llvm/Target/MachineInstrInfo.h" |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 19 | #include "llvm/Target/MachineSchedInfo.h" |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 20 | #include "llvm/Target/MachineFrameInfo.h" |
| 21 | #include "llvm/Target/MachineCacheInfo.h" |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/RegClass.h" |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 23 | #include "llvm/Type.h" |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 46cbff6 | 2001-09-14 16:56:32 +0000 | [diff] [blame] | 25 | #include <sys/types.h> |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 26 | |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 27 | class UltraSparc; |
| 28 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 29 | // OpCodeMask definitions for the Sparc V9 |
| 30 | // |
| 31 | const OpCodeMask Immed = 0x00002000; // immed or reg operand? |
| 32 | const OpCodeMask Annul = 0x20000000; // annul delay instr? |
| 33 | const OpCodeMask PredictTaken = 0x00080000; // predict branch taken? |
| 34 | |
| 35 | |
| 36 | enum SparcInstrSchedClass { |
| 37 | SPARC_NONE, /* Instructions with no scheduling restrictions */ |
| 38 | SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */ |
| 39 | SPARC_IEU0, /* Integer class IEU0 */ |
| 40 | SPARC_IEU1, /* Integer class IEU1 */ |
| 41 | SPARC_FPM, /* FP Multiply or Divide instructions */ |
| 42 | SPARC_FPA, /* All other FP instructions */ |
| 43 | SPARC_CTI, /* Control-transfer instructions */ |
| 44 | SPARC_LD, /* Load instructions */ |
| 45 | SPARC_ST, /* Store instructions */ |
| 46 | SPARC_SINGLE, /* Instructions that must issue by themselves */ |
| 47 | |
| 48 | SPARC_INV, /* This should stay at the end for the next value */ |
| 49 | SPARC_NUM_SCHED_CLASSES = SPARC_INV |
| 50 | }; |
| 51 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 52 | |
| 53 | //--------------------------------------------------------------------------- |
| 54 | // enum SparcMachineOpCode. |
| 55 | // const MachineInstrDescriptor SparcMachineInstrDesc[] |
| 56 | // |
| 57 | // Purpose: |
| 58 | // Description of UltraSparc machine instructions. |
| 59 | // |
| 60 | //--------------------------------------------------------------------------- |
| 61 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 62 | enum SparcMachineOpCode { |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 63 | #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ |
| 64 | NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \ |
| 65 | ENUM, |
| 66 | #include "SparcInstr.def" |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 67 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 68 | // End-of-array marker |
| 69 | INVALID_OPCODE, |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 70 | NUM_REAL_OPCODES = PHI, // number of valid opcodes |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 71 | NUM_TOTAL_OPCODES = INVALID_OPCODE |
| 72 | }; |
| 73 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 74 | |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 75 | // Array of machine instruction descriptions... |
| 76 | extern const MachineInstrDescriptor SparcMachineInstrDesc[]; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 77 | |
| 78 | |
| 79 | //--------------------------------------------------------------------------- |
| 80 | // class UltraSparcInstrInfo |
| 81 | // |
| 82 | // Purpose: |
| 83 | // Information about individual instructions. |
| 84 | // Most information is stored in the SparcMachineInstrDesc array above. |
| 85 | // Other information is computed on demand, and most such functions |
| 86 | // default to member functions in base class MachineInstrInfo. |
| 87 | //--------------------------------------------------------------------------- |
| 88 | |
| 89 | class UltraSparcInstrInfo : public MachineInstrInfo { |
| 90 | public: |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 91 | /*ctor*/ UltraSparcInstrInfo(const TargetMachine& tgt); |
Vikram S. Adve | 4c5fe2d | 2001-11-14 18:48:36 +0000 | [diff] [blame] | 92 | |
| 93 | // |
| 94 | // All immediate constants are in position 0 except the |
| 95 | // store instructions. |
| 96 | // |
| 97 | virtual int getImmmedConstantPos(MachineOpCode opCode) const { |
| 98 | bool ignore; |
| 99 | if (this->maxImmedConstant(opCode, ignore) != 0) |
| 100 | { |
| 101 | assert(! this->isStore((MachineOpCode) STB - 1)); // first store is STB |
| 102 | assert(! this->isStore((MachineOpCode) STD + 1)); // last store is STD |
| 103 | return (opCode >= STB || opCode <= STD)? 2 : 1; |
| 104 | } |
| 105 | else |
| 106 | return -1; |
| 107 | } |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 108 | |
Vikram S. Adve | 5684c4e | 2001-10-18 00:02:06 +0000 | [diff] [blame] | 109 | virtual bool hasResultInterlock (MachineOpCode opCode) const |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 110 | { |
| 111 | // All UltraSPARC instructions have interlocks (note that delay slots |
| 112 | // are not considered here). |
| 113 | // However, instructions that use the result of an FCMP produce a |
| 114 | // 9-cycle stall if they are issued less than 3 cycles after the FCMP. |
| 115 | // Force the compiler to insert a software interlock (i.e., gap of |
| 116 | // 2 other groups, including NOPs if necessary). |
| 117 | return (opCode == FCMPS || opCode == FCMPD || opCode == FCMPQ); |
| 118 | } |
| 119 | |
Vikram S. Adve | 5684c4e | 2001-10-18 00:02:06 +0000 | [diff] [blame] | 120 | //------------------------------------------------------------------------- |
| 121 | // Code generation support for creating individual machine instructions |
| 122 | //------------------------------------------------------------------------- |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 123 | |
Vikram S. Adve | 5684c4e | 2001-10-18 00:02:06 +0000 | [diff] [blame] | 124 | // Create an instruction sequence to put the constant `val' into |
| 125 | // the virtual register `dest'. The generated instructions are |
| 126 | // returned in `minstrVec'. Any temporary registers (TmpInstruction) |
| 127 | // created are returned in `tempVec'. |
| 128 | // |
| 129 | virtual void CreateCodeToLoadConst(Value* val, |
| 130 | Instruction* dest, |
| 131 | vector<MachineInstr*>& minstrVec, |
| 132 | vector<TmpInstruction*>& tempVec) const; |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 133 | |
| 134 | |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 135 | // Create an instruction sequence to copy an integer value `val' |
| 136 | // to a floating point value `dest' by copying to memory and back. |
| 137 | // val must be an integral type. dest must be a Float or Double. |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 138 | // The generated instructions are returned in `minstrVec'. |
| 139 | // Any temp. registers (TmpInstruction) created are returned in `tempVec'. |
| 140 | // |
| 141 | virtual void CreateCodeToCopyIntToFloat(Method* method, |
| 142 | Value* val, |
| 143 | Instruction* dest, |
| 144 | vector<MachineInstr*>& minstrVec, |
| 145 | vector<TmpInstruction*>& tempVec, |
| 146 | TargetMachine& target) const; |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 147 | |
| 148 | // Similarly, create an instruction sequence to copy an FP value |
| 149 | // `val' to an integer value `dest' by copying to memory and back. |
| 150 | // See the previous function for information about return values. |
| 151 | // |
| 152 | virtual void CreateCodeToCopyFloatToInt(Method* method, |
| 153 | Value* val, |
| 154 | Instruction* dest, |
| 155 | vector<MachineInstr*>& minstrVec, |
| 156 | vector<TmpInstruction*>& tempVec, |
| 157 | TargetMachine& target) const; |
Ruchira Sasanka | 67a463a | 2001-11-12 14:45:33 +0000 | [diff] [blame] | 158 | |
| 159 | // create copy instruction(s) |
| 160 | virtual void |
| 161 | CreateCopyInstructionsByType(const TargetMachine& target, |
| 162 | Value* src, |
| 163 | Instruction* dest, |
| 164 | vector<MachineInstr*>& minstrVec) const; |
| 165 | |
| 166 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 167 | }; |
| 168 | |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 169 | |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 170 | //---------------------------------------------------------------------------- |
| 171 | // class UltraSparcRegInfo |
| 172 | // |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 173 | // This class implements the virtual class MachineRegInfo for Sparc. |
| 174 | // |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 175 | //---------------------------------------------------------------------------- |
| 176 | |
| 177 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 178 | class LiveRange; |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 179 | class UltraSparc; |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 180 | class PhyRegAlloc; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 181 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 182 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 183 | class UltraSparcRegInfo : public MachineRegInfo |
| 184 | { |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 185 | private: |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 186 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 187 | // The actual register classes in the Sparc |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 188 | // |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 189 | enum RegClassIDs { |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 190 | IntRegClassID, // Integer |
| 191 | FloatRegClassID, // Float (both single/double) |
| 192 | IntCCRegClassID, // Int Condition Code |
| 193 | FloatCCRegClassID // Float Condition code |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 194 | }; |
| 195 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 196 | |
| 197 | // Type of registers available in Sparc. There can be several reg types |
| 198 | // in the same class. For instace, the float reg class has Single/Double |
| 199 | // types |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 200 | // |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 201 | enum RegTypes { |
| 202 | IntRegType, |
| 203 | FPSingleRegType, |
| 204 | FPDoubleRegType, |
| 205 | IntCCRegType, |
| 206 | FloatCCRegType |
| 207 | }; |
| 208 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 209 | // **** WARNING: If the above enum order is changed, also modify |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 210 | // getRegisterClassOfValue method below since it assumes this particular |
| 211 | // order for efficiency. |
| 212 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 213 | |
| 214 | // reverse pointer to get info about the ultra sparc machine |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 215 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 216 | const UltraSparc *const UltraSparcInfo; |
| 217 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 218 | // Number of registers used for passing int args (usually 6: %o0 - %o5) |
| 219 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 220 | unsigned const NumOfIntArgRegs; |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 221 | |
| 222 | // Number of registers used for passing float args (usually 32: %f0 - %f31) |
| 223 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 224 | unsigned const NumOfFloatArgRegs; |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 225 | |
| 226 | // An out of bound register number that can be used to initialize register |
| 227 | // numbers. Useful for error detection. |
| 228 | // |
Ruchira Sasanka | c4d4b76 | 2001-10-16 01:23:19 +0000 | [diff] [blame] | 229 | int const InvalidRegNum; |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 230 | |
| 231 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 232 | // ======================== Private Methods ============================= |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 233 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 234 | // The following methods are used to color special live ranges (e.g. |
| 235 | // method args and return values etc.) with specific hardware registers |
| 236 | // as required. See SparcRegInfo.cpp for the implementation. |
| 237 | // |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 238 | void setCallOrRetArgCol(LiveRange *const LR, const unsigned RegNo, |
| 239 | const MachineInstr *MI,AddedInstrMapType &AIMap)const; |
| 240 | |
| 241 | MachineInstr * getCopy2RegMI(const Value *SrcVal, const unsigned Reg, |
| 242 | unsigned RegClassID) const ; |
| 243 | |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 244 | void suggestReg4RetAddr(const MachineInstr * RetMI, |
| 245 | LiveRangeInfo& LRI) const; |
| 246 | |
Ruchira Sasanka | b3b6f53 | 2001-10-21 16:43:41 +0000 | [diff] [blame] | 247 | void suggestReg4CallAddr(const MachineInstr * CallMI, LiveRangeInfo& LRI, |
| 248 | vector<RegClass *> RCList) const; |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 249 | |
| 250 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 251 | |
| 252 | // The following methods are used to find the addresses etc. contained |
| 253 | // in specail machine instructions like CALL/RET |
| 254 | // |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 255 | Value *getValue4ReturnAddr( const MachineInstr * MInst ) const ; |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 256 | const Value *getCallInstRetAddr(const MachineInstr *CallMI) const; |
| 257 | const unsigned getCallInstNumArgs(const MachineInstr *CallMI) const; |
| 258 | |
| 259 | |
| 260 | // The following 3 methods are used to find the RegType (see enum above) |
| 261 | // of a LiveRange, Value and using the unified RegClassID |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 262 | |
| 263 | int getRegType(const LiveRange *const LR) const { |
| 264 | |
| 265 | unsigned Typ; |
| 266 | |
| 267 | switch( (LR->getRegClass())->getID() ) { |
| 268 | |
| 269 | case IntRegClassID: return IntRegType; |
| 270 | |
| 271 | case FloatRegClassID: |
| 272 | Typ = LR->getTypeID(); |
| 273 | if( Typ == Type::FloatTyID ) |
| 274 | return FPSingleRegType; |
| 275 | else if( Typ == Type::DoubleTyID ) |
| 276 | return FPDoubleRegType; |
| 277 | else assert(0 && "Unknown type in FloatRegClass"); |
| 278 | |
| 279 | case IntCCRegClassID: return IntCCRegType; |
| 280 | |
| 281 | case FloatCCRegClassID: return FloatCCRegType ; |
| 282 | |
| 283 | default: assert( 0 && "Unknown reg class ID"); |
Chris Lattner | 6dad506 | 2001-11-07 13:49:12 +0000 | [diff] [blame] | 284 | return 0; |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 285 | } |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 286 | } |
| 287 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 288 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 289 | int getRegType(const Value *const Val) const { |
| 290 | |
| 291 | unsigned Typ; |
| 292 | |
| 293 | switch( getRegClassIDOfValue(Val) ) { |
| 294 | |
| 295 | case IntRegClassID: return IntRegType; |
| 296 | |
| 297 | case FloatRegClassID: |
| 298 | Typ = (Val->getType())->getPrimitiveID(); |
| 299 | if( Typ == Type::FloatTyID ) |
| 300 | return FPSingleRegType; |
| 301 | else if( Typ == Type::DoubleTyID ) |
| 302 | return FPDoubleRegType; |
| 303 | else assert(0 && "Unknown type in FloatRegClass"); |
| 304 | |
| 305 | case IntCCRegClassID: return IntCCRegType; |
| 306 | |
| 307 | case FloatCCRegClassID: return FloatCCRegType ; |
| 308 | |
| 309 | default: assert( 0 && "Unknown reg class ID"); |
Chris Lattner | 6dad506 | 2001-11-07 13:49:12 +0000 | [diff] [blame] | 310 | return 0; |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | } |
| 314 | |
| 315 | |
Ruchira Sasanka | ae4bcd7 | 2001-11-10 21:20:43 +0000 | [diff] [blame] | 316 | int getRegType(int reg) const { |
| 317 | if( reg < 32 ) |
| 318 | return IntRegType; |
| 319 | else if ( reg < (32 + 32) ) |
| 320 | return FPSingleRegType; |
| 321 | else if ( reg < (64 + 32) ) |
| 322 | return FPDoubleRegType; |
| 323 | else if( reg < (64+32+4) ) |
| 324 | return FloatCCRegType; |
| 325 | else if( reg < (64+32+4+2) ) |
| 326 | return IntCCRegType; |
| 327 | else |
| 328 | assert(0 && "Invalid register number in getRegType"); |
| 329 | } |
| 330 | |
| 331 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 332 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 333 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 334 | // The following methods are used to generate copy instructions to move |
| 335 | // data between condition code registers |
| 336 | // |
Ruchira Sasanka | 3839e6e | 2001-11-03 19:59:59 +0000 | [diff] [blame] | 337 | MachineInstr * cpCCR2IntMI(const unsigned IntReg) const; |
| 338 | MachineInstr * cpInt2CCRMI(const unsigned IntReg) const; |
| 339 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 340 | // Used to generate a copy instruction based on the register class of |
| 341 | // value. |
| 342 | // |
| 343 | MachineInstr * cpValue2RegMI(Value * Val, const unsigned DestReg, |
| 344 | const int RegType) const; |
Ruchira Sasanka | ae4bcd7 | 2001-11-10 21:20:43 +0000 | [diff] [blame] | 345 | |
| 346 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 347 | // The following 2 methods are used to order the instructions addeed by |
| 348 | // the register allocator in association with method calling. See |
| 349 | // SparcRegInfo.cpp for more details |
| 350 | // |
Ruchira Sasanka | ae4bcd7 | 2001-11-10 21:20:43 +0000 | [diff] [blame] | 351 | void moveInst2OrdVec(vector<MachineInstr *> &OrdVec, MachineInstr *UnordInst, |
| 352 | PhyRegAlloc &PRA ) const; |
| 353 | |
Ruchira Sasanka | 868cf82 | 2001-11-09 23:49:14 +0000 | [diff] [blame] | 354 | void OrderAddedInstrns( vector<MachineInstr *> &UnordVec, |
Ruchira Sasanka | ae4bcd7 | 2001-11-10 21:20:43 +0000 | [diff] [blame] | 355 | vector<MachineInstr *> &OrdVec, |
| 356 | PhyRegAlloc &PRA) const; |
| 357 | |
| 358 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 359 | // To find whether a particular call is to a var arg method |
| 360 | // |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 361 | bool isVarArgCall(const MachineInstr *CallMI) const; |
Ruchira Sasanka | ae4bcd7 | 2001-11-10 21:20:43 +0000 | [diff] [blame] | 362 | |
Ruchira Sasanka | 868cf82 | 2001-11-09 23:49:14 +0000 | [diff] [blame] | 363 | |
| 364 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 365 | public: |
| 366 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 367 | // constructor |
| 368 | // |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 369 | UltraSparcRegInfo(const TargetMachine& tgt ) : |
| 370 | MachineRegInfo(tgt), |
| 371 | UltraSparcInfo(& (const UltraSparc&) tgt), |
| 372 | NumOfIntArgRegs(6), |
| 373 | NumOfFloatArgRegs(32), |
| 374 | InvalidRegNum(1000), |
| 375 | SizeOfOperandOnStack(8) { |
| 376 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 377 | MachineRegClassArr.push_back( new SparcIntRegClass(IntRegClassID) ); |
| 378 | MachineRegClassArr.push_back( new SparcFloatRegClass(FloatRegClassID) ); |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 379 | MachineRegClassArr.push_back( new SparcIntCCRegClass(IntCCRegClassID) ); |
| 380 | MachineRegClassArr.push_back( new SparcFloatCCRegClass(FloatCCRegClassID)); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 381 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 382 | assert( SparcFloatRegOrder::StartOfNonVolatileRegs == 32 && |
| 383 | "32 Float regs are used for float arg passing"); |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 384 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 385 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 386 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 387 | |
| 388 | ~UltraSparcRegInfo(void) { } // empty destructor |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 389 | |
| 390 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 391 | // To get complete machine information structure using the machine register |
| 392 | // information |
| 393 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 394 | inline const UltraSparc & getUltraSparcInfo() const { |
| 395 | return *UltraSparcInfo; |
| 396 | } |
| 397 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 398 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 399 | // To find the register class of a Value |
| 400 | // |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 401 | inline unsigned getRegClassIDOfValue (const Value *const Val, |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 402 | bool isCCReg = false) const { |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 403 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 404 | Type::PrimitiveID ty = (Val->getType())->getPrimitiveID(); |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 405 | |
| 406 | unsigned res; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 407 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 408 | if( (ty && ty <= Type::LongTyID) || (ty == Type::LabelTyID) || |
| 409 | (ty == Type::MethodTyID) || (ty == Type::PointerTyID) ) |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 410 | res = IntRegClassID; // sparc int reg (ty=0: void) |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 411 | else if( ty <= Type::DoubleTyID) |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 412 | res = FloatRegClassID; // sparc float reg class |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 413 | else { |
Chris Lattner | 1e23ed7 | 2001-10-15 18:15:27 +0000 | [diff] [blame] | 414 | cerr << "TypeID: " << ty << endl; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 415 | assert(0 && "Cannot resolve register class for type"); |
Chris Lattner | 8e5c0b4 | 2001-11-07 14:01:59 +0000 | [diff] [blame] | 416 | return 0; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 417 | } |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 418 | |
| 419 | if(isCCReg) |
| 420 | return res + 2; // corresponidng condition code regiser |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 421 | else |
| 422 | return res; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 423 | } |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 424 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 425 | |
| 426 | |
| 427 | // returns the register that contains always zero |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 428 | // this is the unified register number |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 429 | // |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 430 | inline int getZeroRegNum() const { return SparcIntRegOrder::g0; } |
| 431 | |
| 432 | // returns the reg used for pushing the address when a method is called. |
| 433 | // This can be used for other purposes between calls |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 434 | // |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 435 | unsigned getCallAddressReg() const { return SparcIntRegOrder::o7; } |
| 436 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 437 | // Returns the register containing the return address. |
| 438 | // It should be made sure that this register contains the return |
| 439 | // value when a return instruction is reached. |
| 440 | // |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 441 | unsigned getReturnAddressReg() const { return SparcIntRegOrder::i7; } |
| 442 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 443 | |
| 444 | |
| 445 | // The following methods are used to color special live ranges (e.g. |
| 446 | // method args and return values etc.) with specific hardware registers |
| 447 | // as required. See SparcRegInfo.cpp for the implementation for Sparc. |
| 448 | // |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 449 | void suggestRegs4MethodArgs(const Method *const Meth, |
| 450 | LiveRangeInfo& LRI) const; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 451 | |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 452 | void suggestRegs4CallArgs(const MachineInstr *const CallMI, |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 453 | LiveRangeInfo& LRI, vector<RegClass *> RCL) const; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 454 | |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 455 | void suggestReg4RetValue(const MachineInstr *const RetMI, |
| 456 | LiveRangeInfo& LRI ) const; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 457 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 458 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 459 | void colorMethodArgs(const Method *const Meth, LiveRangeInfo& LRI, |
| 460 | AddedInstrns *const FirstAI) const; |
| 461 | |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 462 | void colorCallArgs(const MachineInstr *const CallMI, LiveRangeInfo& LRI, |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 463 | AddedInstrns *const CallAI, PhyRegAlloc &PRA, |
| 464 | const BasicBlock *BB) const; |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 465 | |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 466 | void colorRetValue(const MachineInstr *const RetI, LiveRangeInfo& LRI, |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 467 | AddedInstrns *const RetAI) const; |
| 468 | |
| 469 | |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 470 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 471 | // method used for printing a register for debugging purposes |
| 472 | // |
| 473 | static void printReg(const LiveRange *const LR) ; |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 474 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 475 | // this method provides a unique number for each register |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 476 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 477 | inline int getUnifiedRegNum(int RegClassID, int reg) const { |
| 478 | |
| 479 | if( RegClassID == IntRegClassID && reg < 32 ) |
| 480 | return reg; |
| 481 | else if ( RegClassID == FloatRegClassID && reg < 64) |
| 482 | return reg + 32; // we have 32 int regs |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 483 | else if( RegClassID == FloatCCRegClassID && reg < 4) |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 484 | return reg + 32 + 64; // 32 int, 64 float |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 485 | else if( RegClassID == IntCCRegClassID ) |
| 486 | return 4+ 32 + 64; // only int cc reg |
Ruchira Sasanka | c4d4b76 | 2001-10-16 01:23:19 +0000 | [diff] [blame] | 487 | else if (reg==InvalidRegNum) |
| 488 | return InvalidRegNum; |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 489 | else |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 490 | assert(0 && "Invalid register class or reg number"); |
Chris Lattner | 6dad506 | 2001-11-07 13:49:12 +0000 | [diff] [blame] | 491 | return 0; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | // given the unified register number, this gives the name |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 495 | // for generating assembly code or debugging. |
| 496 | // |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 497 | inline const string getUnifiedRegName(int reg) const { |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 498 | if( reg < 32 ) |
| 499 | return SparcIntRegOrder::getRegName(reg); |
| 500 | else if ( reg < (64 + 32) ) |
| 501 | return SparcFloatRegOrder::getRegName( reg - 32); |
| 502 | else if( reg < (64+32+4) ) |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 503 | return SparcFloatCCRegOrder::getRegName( reg -32 - 64); |
Ruchira Sasanka | 3839e6e | 2001-11-03 19:59:59 +0000 | [diff] [blame] | 504 | else if( reg < (64+32+4+2) ) // two names: %xcc and %ccr |
| 505 | return SparcIntCCRegOrder::getRegName( reg -32 - 64 - 4); |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 506 | else if (reg== InvalidRegNum) //****** TODO: Remove */ |
Ruchira Sasanka | ab304c4 | 2001-09-30 23:19:57 +0000 | [diff] [blame] | 507 | return "<*NoReg*>"; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 508 | else |
| 509 | assert(0 && "Invalid register number"); |
Chris Lattner | 6dad506 | 2001-11-07 13:49:12 +0000 | [diff] [blame] | 510 | return ""; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 513 | |
| 514 | |
| 515 | // The fllowing methods are used by instruction selection |
| 516 | // |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 517 | inline unsigned int getRegNumInCallersWindow(int reg) { |
| 518 | if (reg == InvalidRegNum || reg >= 32) |
| 519 | return reg; |
| 520 | return SparcIntRegOrder::getRegNumInCallersWindow(reg); |
| 521 | } |
| 522 | |
| 523 | inline bool mustBeRemappedInCallersWindow(int reg) { |
| 524 | return (reg != InvalidRegNum && reg < 32); |
| 525 | } |
| 526 | |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 527 | |
| 528 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 529 | // returns the # of bytes of stack space allocated for each register |
| 530 | // type. For Sparc, currently we allocate 8 bytes on stack for all |
| 531 | // register types. We can optimize this later if necessary to save stack |
| 532 | // space (However, should make sure that stack alignment is correct) |
| 533 | // |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 534 | inline int getSpilledRegSize(const int RegType) const { |
| 535 | return 8; |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 538 | |
| 539 | // To obtain the return value contained in a CALL machine instruction |
| 540 | // |
Ruchira Sasanka | b3b6f53 | 2001-10-21 16:43:41 +0000 | [diff] [blame] | 541 | const Value * getCallInstRetVal(const MachineInstr *CallMI) const; |
| 542 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 543 | |
| 544 | // The following methods are used to generate "copy" machine instructions |
| 545 | // for an architecture. |
| 546 | // |
Ruchira Sasanka | c4d4b76 | 2001-10-16 01:23:19 +0000 | [diff] [blame] | 547 | MachineInstr * cpReg2RegMI(const unsigned SrcReg, const unsigned DestReg, |
| 548 | const int RegType) const; |
| 549 | |
| 550 | MachineInstr * cpReg2MemMI(const unsigned SrcReg, const unsigned DestPtrReg, |
| 551 | const int Offset, const int RegType) const; |
| 552 | |
| 553 | MachineInstr * cpMem2RegMI(const unsigned SrcPtrReg, const int Offset, |
| 554 | const unsigned DestReg, const int RegType) const; |
| 555 | |
Ruchira Sasanka | ef1b0cb | 2001-11-03 17:13:27 +0000 | [diff] [blame] | 556 | MachineInstr* cpValue2Value(Value *Src, Value *Dest) const; |
| 557 | |
| 558 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 559 | // To see whether a register is a volatile (i.e., whehter it must be |
| 560 | // preserved acorss calls) |
| 561 | // |
Ruchira Sasanka | c4d4b76 | 2001-10-16 01:23:19 +0000 | [diff] [blame] | 562 | inline bool isRegVolatile(const int RegClassID, const int Reg) const { |
| 563 | return (MachineRegClassArr[RegClassID])->isRegVolatile(Reg); |
| 564 | } |
| 565 | |
| 566 | |
| 567 | inline unsigned getFramePointer() const { |
| 568 | return SparcIntRegOrder::i6; |
| 569 | } |
| 570 | |
| 571 | inline unsigned getStackPointer() const { |
| 572 | return SparcIntRegOrder::o6; |
| 573 | } |
| 574 | |
| 575 | inline int getInvalidRegNum() const { |
| 576 | return InvalidRegNum; |
| 577 | } |
| 578 | |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 579 | |
Ruchira Sasanka | 2563a98 | 2002-01-07 20:28:49 +0000 | [diff] [blame^] | 580 | |
| 581 | // This method inserts the caller saving code for call instructions |
| 582 | // |
Ruchira Sasanka | 20c82b1 | 2001-10-28 18:15:12 +0000 | [diff] [blame] | 583 | void insertCallerSavingCode(const MachineInstr *MInst, |
| 584 | const BasicBlock *BB, PhyRegAlloc &PRA ) const; |
| 585 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 586 | }; |
| 587 | |
| 588 | |
| 589 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 590 | /*--------------------------------------------------------------------------- |
| 591 | Scheduling guidelines for SPARC IIi: |
| 592 | |
| 593 | I-Cache alignment rules (pg 326) |
| 594 | -- Align a branch target instruction so that it's entire group is within |
| 595 | the same cache line (may be 1-4 instructions). |
| 596 | ** Don't let a branch that is predicted taken be the last instruction |
| 597 | on an I-cache line: delay slot will need an entire line to be fetched |
| 598 | -- Make a FP instruction or a branch be the 4th instruction in a group. |
| 599 | For branches, there are tradeoffs in reordering to make this happen |
| 600 | (see pg. 327). |
| 601 | ** Don't put a branch in a group that crosses a 32-byte boundary! |
| 602 | An artificial branch is inserted after every 32 bytes, and having |
| 603 | another branch will force the group to be broken into 2 groups. |
| 604 | |
| 605 | iTLB rules: |
| 606 | -- Don't let a loop span two memory pages, if possible |
| 607 | |
| 608 | Branch prediction performance: |
| 609 | -- Don't make the branch in a delay slot the target of a branch |
| 610 | -- Try not to have 2 predicted branches within a group of 4 instructions |
| 611 | (because each such group has a single branch target field). |
| 612 | -- Try to align branches in slots 0, 2, 4 or 6 of a cache line (to avoid |
| 613 | the wrong prediction bits being used in some cases). |
| 614 | |
| 615 | D-Cache timing constraints: |
| 616 | -- Signed int loads of less than 64 bits have 3 cycle latency, not 2 |
| 617 | -- All other loads that hit in D-Cache have 2 cycle latency |
| 618 | -- All loads are returned IN ORDER, so a D-Cache miss will delay a later hit |
| 619 | -- Mis-aligned loads or stores cause a trap. In particular, replace |
| 620 | mis-aligned FP double precision l/s with 2 single-precision l/s. |
| 621 | -- Simulations of integer codes show increase in avg. group size of |
| 622 | 33% when code (including esp. non-faulting loads) is moved across |
| 623 | one branch, and 50% across 2 branches. |
| 624 | |
| 625 | E-Cache timing constraints: |
| 626 | -- Scheduling for E-cache (D-Cache misses) is effective (due to load buffering) |
| 627 | |
| 628 | Store buffer timing constraints: |
| 629 | -- Stores can be executed in same cycle as instruction producing the value |
| 630 | -- Stores are buffered and have lower priority for E-cache until |
| 631 | highwater mark is reached in the store buffer (5 stores) |
| 632 | |
| 633 | Pipeline constraints: |
| 634 | -- Shifts can only use IEU0. |
| 635 | -- CC setting instructions can only use IEU1. |
| 636 | -- Several other instructions must only use IEU1: |
| 637 | EDGE(?), ARRAY(?), CALL, JMPL, BPr, PST, and FCMP. |
| 638 | -- Two instructions cannot store to the same register file in a single cycle |
| 639 | (single write port per file). |
| 640 | |
| 641 | Issue and grouping constraints: |
| 642 | -- FP and branch instructions must use slot 4. |
| 643 | -- Shift instructions cannot be grouped with other IEU0-specific instructions. |
| 644 | -- CC setting instructions cannot be grouped with other IEU1-specific instrs. |
| 645 | -- Several instructions must be issued in a single-instruction group: |
| 646 | MOVcc or MOVr, MULs/x and DIVs/x, SAVE/RESTORE, many others |
| 647 | -- A CALL or JMPL breaks a group, ie, is not combined with subsequent instrs. |
| 648 | -- |
| 649 | -- |
| 650 | |
| 651 | Branch delay slot scheduling rules: |
| 652 | -- A CTI couple (two back-to-back CTI instructions in the dynamic stream) |
| 653 | has a 9-instruction penalty: the entire pipeline is flushed when the |
| 654 | second instruction reaches stage 9 (W-Writeback). |
| 655 | -- Avoid putting multicycle instructions, and instructions that may cause |
| 656 | load misses, in the delay slot of an annulling branch. |
| 657 | -- Avoid putting WR, SAVE..., RESTORE and RETURN instructions in the |
| 658 | delay slot of an annulling branch. |
| 659 | |
| 660 | *--------------------------------------------------------------------------- */ |
| 661 | |
| 662 | //--------------------------------------------------------------------------- |
| 663 | // List of CPUResources for UltraSPARC IIi. |
| 664 | //--------------------------------------------------------------------------- |
| 665 | |
| 666 | const CPUResource AllIssueSlots( "All Instr Slots", 4); |
| 667 | const CPUResource IntIssueSlots( "Int Instr Slots", 3); |
| 668 | const CPUResource First3IssueSlots("Instr Slots 0-3", 3); |
| 669 | const CPUResource LSIssueSlots( "Load-Store Instr Slot", 1); |
| 670 | const CPUResource CTIIssueSlots( "Ctrl Transfer Instr Slot", 1); |
| 671 | const CPUResource FPAIssueSlots( "Int Instr Slot 1", 1); |
| 672 | const CPUResource FPMIssueSlots( "Int Instr Slot 1", 1); |
| 673 | |
| 674 | // IEUN instructions can use either Alu and should use IAluN. |
| 675 | // IEU0 instructions must use Alu 1 and should use both IAluN and IAlu0. |
| 676 | // IEU1 instructions must use Alu 2 and should use both IAluN and IAlu1. |
| 677 | const CPUResource IAluN("Int ALU 1or2", 2); |
| 678 | const CPUResource IAlu0("Int ALU 1", 1); |
| 679 | const CPUResource IAlu1("Int ALU 2", 1); |
| 680 | |
| 681 | const CPUResource LSAluC1("Load/Store Unit Addr Cycle", 1); |
| 682 | const CPUResource LSAluC2("Load/Store Unit Issue Cycle", 1); |
| 683 | const CPUResource LdReturn("Load Return Unit", 1); |
| 684 | |
| 685 | const CPUResource FPMAluC1("FP Mul/Div Alu Cycle 1", 1); |
| 686 | const CPUResource FPMAluC2("FP Mul/Div Alu Cycle 2", 1); |
| 687 | const CPUResource FPMAluC3("FP Mul/Div Alu Cycle 3", 1); |
| 688 | |
| 689 | const CPUResource FPAAluC1("FP Other Alu Cycle 1", 1); |
| 690 | const CPUResource FPAAluC2("FP Other Alu Cycle 2", 1); |
| 691 | const CPUResource FPAAluC3("FP Other Alu Cycle 3", 1); |
| 692 | |
| 693 | const CPUResource IRegReadPorts("Int Reg ReadPorts", INT_MAX); // CHECK |
| 694 | const CPUResource IRegWritePorts("Int Reg WritePorts", 2); // CHECK |
| 695 | const CPUResource FPRegReadPorts("FP Reg Read Ports", INT_MAX); // CHECK |
| 696 | const CPUResource FPRegWritePorts("FP Reg Write Ports", 1); // CHECK |
| 697 | |
| 698 | const CPUResource CTIDelayCycle( "CTI delay cycle", 1); |
| 699 | const CPUResource FCMPDelayCycle("FCMP delay cycle", 1); |
| 700 | |
| 701 | |
| 702 | //--------------------------------------------------------------------------- |
| 703 | // const InstrClassRUsage SparcRUsageDesc[] |
| 704 | // |
| 705 | // Purpose: |
| 706 | // Resource usage information for instruction in each scheduling class. |
| 707 | // The InstrRUsage Objects for individual classes are specified first. |
| 708 | // Note that fetch and decode are decoupled from the execution pipelines |
| 709 | // via an instr buffer, so they are not included in the cycles below. |
| 710 | //--------------------------------------------------------------------------- |
| 711 | |
| 712 | const InstrClassRUsage NoneClassRUsage = { |
| 713 | SPARC_NONE, |
| 714 | /*totCycles*/ 7, |
| 715 | |
| 716 | /* maxIssueNum */ 4, |
| 717 | /* isSingleIssue */ false, |
| 718 | /* breaksGroup */ false, |
| 719 | /* numBubbles */ 0, |
| 720 | |
| 721 | /*numSlots*/ 4, |
| 722 | /* feasibleSlots[] */ { 0, 1, 2, 3 }, |
| 723 | |
| 724 | /*numEntries*/ 0, |
| 725 | /* V[] */ { |
| 726 | /*Cycle G */ |
Ruchira Sasanka | c4d4b76 | 2001-10-16 01:23:19 +0000 | [diff] [blame] | 727 | /*Ccle E */ |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 728 | /*Cycle C */ |
| 729 | /*Cycle N1*/ |
| 730 | /*Cycle N1*/ |
| 731 | /*Cycle N1*/ |
| 732 | /*Cycle W */ |
| 733 | } |
| 734 | }; |
| 735 | |
| 736 | const InstrClassRUsage IEUNClassRUsage = { |
| 737 | SPARC_IEUN, |
| 738 | /*totCycles*/ 7, |
| 739 | |
| 740 | /* maxIssueNum */ 3, |
| 741 | /* isSingleIssue */ false, |
| 742 | /* breaksGroup */ false, |
| 743 | /* numBubbles */ 0, |
| 744 | |
| 745 | /*numSlots*/ 3, |
| 746 | /* feasibleSlots[] */ { 0, 1, 2 }, |
| 747 | |
| 748 | /*numEntries*/ 4, |
| 749 | /* V[] */ { |
| 750 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 751 | { IntIssueSlots.rid, 0, 1 }, |
| 752 | /*Cycle E */ { IAluN.rid, 1, 1 }, |
| 753 | /*Cycle C */ |
| 754 | /*Cycle N1*/ |
| 755 | /*Cycle N1*/ |
| 756 | /*Cycle N1*/ |
| 757 | /*Cycle W */ { IRegWritePorts.rid, 6, 1 } |
| 758 | } |
| 759 | }; |
| 760 | |
| 761 | const InstrClassRUsage IEU0ClassRUsage = { |
| 762 | SPARC_IEU0, |
| 763 | /*totCycles*/ 7, |
| 764 | |
| 765 | /* maxIssueNum */ 1, |
| 766 | /* isSingleIssue */ false, |
| 767 | /* breaksGroup */ false, |
| 768 | /* numBubbles */ 0, |
| 769 | |
| 770 | /*numSlots*/ 3, |
| 771 | /* feasibleSlots[] */ { 0, 1, 2 }, |
| 772 | |
| 773 | /*numEntries*/ 5, |
| 774 | /* V[] */ { |
| 775 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 776 | { IntIssueSlots.rid, 0, 1 }, |
| 777 | /*Cycle E */ { IAluN.rid, 1, 1 }, |
| 778 | { IAlu0.rid, 1, 1 }, |
| 779 | /*Cycle C */ |
| 780 | /*Cycle N1*/ |
| 781 | /*Cycle N1*/ |
| 782 | /*Cycle N1*/ |
| 783 | /*Cycle W */ { IRegWritePorts.rid, 6, 1 } |
| 784 | } |
| 785 | }; |
| 786 | |
| 787 | const InstrClassRUsage IEU1ClassRUsage = { |
| 788 | SPARC_IEU1, |
| 789 | /*totCycles*/ 7, |
| 790 | |
| 791 | /* maxIssueNum */ 1, |
| 792 | /* isSingleIssue */ false, |
| 793 | /* breaksGroup */ false, |
| 794 | /* numBubbles */ 0, |
| 795 | |
| 796 | /*numSlots*/ 3, |
| 797 | /* feasibleSlots[] */ { 0, 1, 2 }, |
| 798 | |
| 799 | /*numEntries*/ 5, |
| 800 | /* V[] */ { |
| 801 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 802 | { IntIssueSlots.rid, 0, 1 }, |
| 803 | /*Cycle E */ { IAluN.rid, 1, 1 }, |
| 804 | { IAlu1.rid, 1, 1 }, |
| 805 | /*Cycle C */ |
| 806 | /*Cycle N1*/ |
| 807 | /*Cycle N1*/ |
| 808 | /*Cycle N1*/ |
| 809 | /*Cycle W */ { IRegWritePorts.rid, 6, 1 } |
| 810 | } |
| 811 | }; |
| 812 | |
| 813 | const InstrClassRUsage FPMClassRUsage = { |
| 814 | SPARC_FPM, |
| 815 | /*totCycles*/ 7, |
| 816 | |
| 817 | /* maxIssueNum */ 1, |
| 818 | /* isSingleIssue */ false, |
| 819 | /* breaksGroup */ false, |
| 820 | /* numBubbles */ 0, |
| 821 | |
| 822 | /*numSlots*/ 4, |
| 823 | /* feasibleSlots[] */ { 0, 1, 2, 3 }, |
| 824 | |
| 825 | /*numEntries*/ 7, |
| 826 | /* V[] */ { |
| 827 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 828 | { FPMIssueSlots.rid, 0, 1 }, |
| 829 | /*Cycle E */ { FPRegReadPorts.rid, 1, 1 }, |
| 830 | /*Cycle C */ { FPMAluC1.rid, 2, 1 }, |
| 831 | /*Cycle N1*/ { FPMAluC2.rid, 3, 1 }, |
| 832 | /*Cycle N1*/ { FPMAluC3.rid, 4, 1 }, |
| 833 | /*Cycle N1*/ |
| 834 | /*Cycle W */ { FPRegWritePorts.rid, 6, 1 } |
| 835 | } |
| 836 | }; |
| 837 | |
| 838 | const InstrClassRUsage FPAClassRUsage = { |
| 839 | SPARC_FPA, |
| 840 | /*totCycles*/ 7, |
| 841 | |
| 842 | /* maxIssueNum */ 1, |
| 843 | /* isSingleIssue */ false, |
| 844 | /* breaksGroup */ false, |
| 845 | /* numBubbles */ 0, |
| 846 | |
| 847 | /*numSlots*/ 4, |
| 848 | /* feasibleSlots[] */ { 0, 1, 2, 3 }, |
| 849 | |
| 850 | /*numEntries*/ 7, |
| 851 | /* V[] */ { |
| 852 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 853 | { FPAIssueSlots.rid, 0, 1 }, |
| 854 | /*Cycle E */ { FPRegReadPorts.rid, 1, 1 }, |
| 855 | /*Cycle C */ { FPAAluC1.rid, 2, 1 }, |
| 856 | /*Cycle N1*/ { FPAAluC2.rid, 3, 1 }, |
| 857 | /*Cycle N1*/ { FPAAluC3.rid, 4, 1 }, |
| 858 | /*Cycle N1*/ |
| 859 | /*Cycle W */ { FPRegWritePorts.rid, 6, 1 } |
| 860 | } |
| 861 | }; |
| 862 | |
| 863 | const InstrClassRUsage LDClassRUsage = { |
| 864 | SPARC_LD, |
| 865 | /*totCycles*/ 7, |
| 866 | |
| 867 | /* maxIssueNum */ 1, |
| 868 | /* isSingleIssue */ false, |
| 869 | /* breaksGroup */ false, |
| 870 | /* numBubbles */ 0, |
| 871 | |
| 872 | /*numSlots*/ 3, |
| 873 | /* feasibleSlots[] */ { 0, 1, 2, }, |
| 874 | |
| 875 | /*numEntries*/ 6, |
| 876 | /* V[] */ { |
| 877 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 878 | { First3IssueSlots.rid, 0, 1 }, |
| 879 | { LSIssueSlots.rid, 0, 1 }, |
| 880 | /*Cycle E */ { LSAluC1.rid, 1, 1 }, |
| 881 | /*Cycle C */ { LSAluC2.rid, 2, 1 }, |
| 882 | { LdReturn.rid, 2, 1 }, |
| 883 | /*Cycle N1*/ |
| 884 | /*Cycle N1*/ |
| 885 | /*Cycle N1*/ |
| 886 | /*Cycle W */ { IRegWritePorts.rid, 6, 1 } |
| 887 | } |
| 888 | }; |
| 889 | |
| 890 | const InstrClassRUsage STClassRUsage = { |
| 891 | SPARC_ST, |
| 892 | /*totCycles*/ 7, |
| 893 | |
| 894 | /* maxIssueNum */ 1, |
| 895 | /* isSingleIssue */ false, |
| 896 | /* breaksGroup */ false, |
| 897 | /* numBubbles */ 0, |
| 898 | |
| 899 | /*numSlots*/ 3, |
| 900 | /* feasibleSlots[] */ { 0, 1, 2 }, |
| 901 | |
| 902 | /*numEntries*/ 4, |
| 903 | /* V[] */ { |
| 904 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 905 | { First3IssueSlots.rid, 0, 1 }, |
| 906 | { LSIssueSlots.rid, 0, 1 }, |
| 907 | /*Cycle E */ { LSAluC1.rid, 1, 1 }, |
| 908 | /*Cycle C */ { LSAluC2.rid, 2, 1 } |
| 909 | /*Cycle N1*/ |
| 910 | /*Cycle N1*/ |
| 911 | /*Cycle N1*/ |
| 912 | /*Cycle W */ |
| 913 | } |
| 914 | }; |
| 915 | |
| 916 | const InstrClassRUsage CTIClassRUsage = { |
| 917 | SPARC_CTI, |
| 918 | /*totCycles*/ 7, |
| 919 | |
| 920 | /* maxIssueNum */ 1, |
| 921 | /* isSingleIssue */ false, |
| 922 | /* breaksGroup */ false, |
| 923 | /* numBubbles */ 0, |
| 924 | |
| 925 | /*numSlots*/ 4, |
| 926 | /* feasibleSlots[] */ { 0, 1, 2, 3 }, |
| 927 | |
| 928 | /*numEntries*/ 4, |
| 929 | /* V[] */ { |
| 930 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 931 | { CTIIssueSlots.rid, 0, 1 }, |
| 932 | /*Cycle E */ { IAlu0.rid, 1, 1 }, |
| 933 | /*Cycles E-C */ { CTIDelayCycle.rid, 1, 2 } |
| 934 | /*Cycle C */ |
| 935 | /*Cycle N1*/ |
| 936 | /*Cycle N1*/ |
| 937 | /*Cycle N1*/ |
| 938 | /*Cycle W */ |
| 939 | } |
| 940 | }; |
| 941 | |
| 942 | const InstrClassRUsage SingleClassRUsage = { |
| 943 | SPARC_SINGLE, |
| 944 | /*totCycles*/ 7, |
| 945 | |
| 946 | /* maxIssueNum */ 1, |
| 947 | /* isSingleIssue */ true, |
| 948 | /* breaksGroup */ false, |
| 949 | /* numBubbles */ 0, |
| 950 | |
| 951 | /*numSlots*/ 1, |
| 952 | /* feasibleSlots[] */ { 0 }, |
| 953 | |
| 954 | /*numEntries*/ 5, |
| 955 | /* V[] */ { |
| 956 | /*Cycle G */ { AllIssueSlots.rid, 0, 1 }, |
| 957 | { AllIssueSlots.rid, 0, 1 }, |
| 958 | { AllIssueSlots.rid, 0, 1 }, |
| 959 | { AllIssueSlots.rid, 0, 1 }, |
| 960 | /*Cycle E */ { IAlu0.rid, 1, 1 } |
| 961 | /*Cycle C */ |
| 962 | /*Cycle N1*/ |
| 963 | /*Cycle N1*/ |
| 964 | /*Cycle N1*/ |
| 965 | /*Cycle W */ |
| 966 | } |
| 967 | }; |
| 968 | |
| 969 | |
| 970 | const InstrClassRUsage SparcRUsageDesc[] = { |
| 971 | NoneClassRUsage, |
| 972 | IEUNClassRUsage, |
| 973 | IEU0ClassRUsage, |
| 974 | IEU1ClassRUsage, |
| 975 | FPMClassRUsage, |
| 976 | FPAClassRUsage, |
| 977 | CTIClassRUsage, |
| 978 | LDClassRUsage, |
| 979 | STClassRUsage, |
| 980 | SingleClassRUsage |
| 981 | }; |
| 982 | |
| 983 | |
| 984 | //--------------------------------------------------------------------------- |
| 985 | // const InstrIssueDelta SparcInstrIssueDeltas[] |
| 986 | // |
| 987 | // Purpose: |
| 988 | // Changes to issue restrictions information in InstrClassRUsage for |
| 989 | // instructions that differ from other instructions in their class. |
| 990 | //--------------------------------------------------------------------------- |
| 991 | |
| 992 | const InstrIssueDelta SparcInstrIssueDeltas[] = { |
| 993 | |
| 994 | // opCode, isSingleIssue, breaksGroup, numBubbles |
| 995 | |
| 996 | // Special cases for single-issue only |
| 997 | // Other single issue cases are below. |
| 998 | //{ LDDA, true, true, 0 }, |
| 999 | //{ STDA, true, true, 0 }, |
| 1000 | //{ LDDF, true, true, 0 }, |
| 1001 | //{ LDDFA, true, true, 0 }, |
| 1002 | { ADDC, true, true, 0 }, |
| 1003 | { ADDCcc, true, true, 0 }, |
| 1004 | { SUBC, true, true, 0 }, |
| 1005 | { SUBCcc, true, true, 0 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1006 | //{ LDSTUB, true, true, 0 }, |
| 1007 | //{ SWAP, true, true, 0 }, |
| 1008 | //{ SWAPA, true, true, 0 }, |
| 1009 | //{ CAS, true, true, 0 }, |
| 1010 | //{ CASA, true, true, 0 }, |
| 1011 | //{ CASX, true, true, 0 }, |
| 1012 | //{ CASXA, true, true, 0 }, |
| 1013 | //{ LDFSR, true, true, 0 }, |
| 1014 | //{ LDFSRA, true, true, 0 }, |
| 1015 | //{ LDXFSR, true, true, 0 }, |
| 1016 | //{ LDXFSRA, true, true, 0 }, |
| 1017 | //{ STFSR, true, true, 0 }, |
| 1018 | //{ STFSRA, true, true, 0 }, |
| 1019 | //{ STXFSR, true, true, 0 }, |
| 1020 | //{ STXFSRA, true, true, 0 }, |
| 1021 | //{ SAVED, true, true, 0 }, |
| 1022 | //{ RESTORED, true, true, 0 }, |
| 1023 | //{ FLUSH, true, true, 9 }, |
| 1024 | //{ FLUSHW, true, true, 9 }, |
| 1025 | //{ ALIGNADDR, true, true, 0 }, |
| 1026 | { RETURN, true, true, 0 }, |
| 1027 | //{ DONE, true, true, 0 }, |
| 1028 | //{ RETRY, true, true, 0 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1029 | //{ TCC, true, true, 0 }, |
| 1030 | //{ SHUTDOWN, true, true, 0 }, |
| 1031 | |
| 1032 | // Special cases for breaking group *before* |
| 1033 | // CURRENTLY NOT SUPPORTED! |
| 1034 | { CALL, false, false, 0 }, |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1035 | { JMPLCALL, false, false, 0 }, |
| 1036 | { JMPLRET, false, false, 0 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1037 | |
| 1038 | // Special cases for breaking the group *after* |
| 1039 | { MULX, true, true, (4+34)/2 }, |
| 1040 | { FDIVS, false, true, 0 }, |
| 1041 | { FDIVD, false, true, 0 }, |
| 1042 | { FDIVQ, false, true, 0 }, |
| 1043 | { FSQRTS, false, true, 0 }, |
| 1044 | { FSQRTD, false, true, 0 }, |
| 1045 | { FSQRTQ, false, true, 0 }, |
| 1046 | //{ FCMP{LE,GT,NE,EQ}, false, true, 0 }, |
| 1047 | |
| 1048 | // Instructions that introduce bubbles |
| 1049 | //{ MULScc, true, true, 2 }, |
| 1050 | //{ SMULcc, true, true, (4+18)/2 }, |
| 1051 | //{ UMULcc, true, true, (4+19)/2 }, |
| 1052 | { SDIVX, true, true, 68 }, |
| 1053 | { UDIVX, true, true, 68 }, |
| 1054 | //{ SDIVcc, true, true, 36 }, |
| 1055 | //{ UDIVcc, true, true, 37 }, |
Vikram S. Adve | b7f06f4 | 2001-11-04 19:34:49 +0000 | [diff] [blame] | 1056 | { WRCCR, true, true, 4 }, |
| 1057 | //{ WRPR, true, true, 4 }, |
| 1058 | //{ RDCCR, true, true, 0 }, // no bubbles after, but see below |
| 1059 | //{ RDPR, true, true, 0 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1060 | }; |
| 1061 | |
| 1062 | |
| 1063 | //--------------------------------------------------------------------------- |
| 1064 | // const InstrRUsageDelta SparcInstrUsageDeltas[] |
| 1065 | // |
| 1066 | // Purpose: |
| 1067 | // Changes to resource usage information in InstrClassRUsage for |
| 1068 | // instructions that differ from other instructions in their class. |
| 1069 | //--------------------------------------------------------------------------- |
| 1070 | |
| 1071 | const InstrRUsageDelta SparcInstrUsageDeltas[] = { |
| 1072 | |
| 1073 | // MachineOpCode, Resource, Start cycle, Num cycles |
| 1074 | |
| 1075 | // |
| 1076 | // JMPL counts as a load/store instruction for issue! |
| 1077 | // |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1078 | { JMPLCALL, LSIssueSlots.rid, 0, 1 }, |
| 1079 | { JMPLRET, LSIssueSlots.rid, 0, 1 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1080 | |
| 1081 | // |
| 1082 | // Many instructions cannot issue for the next 2 cycles after an FCMP |
| 1083 | // We model that with a fake resource FCMPDelayCycle. |
| 1084 | // |
| 1085 | { FCMPS, FCMPDelayCycle.rid, 1, 3 }, |
| 1086 | { FCMPD, FCMPDelayCycle.rid, 1, 3 }, |
| 1087 | { FCMPQ, FCMPDelayCycle.rid, 1, 3 }, |
| 1088 | |
| 1089 | { MULX, FCMPDelayCycle.rid, 1, 1 }, |
| 1090 | { SDIVX, FCMPDelayCycle.rid, 1, 1 }, |
| 1091 | { UDIVX, FCMPDelayCycle.rid, 1, 1 }, |
| 1092 | //{ SMULcc, FCMPDelayCycle.rid, 1, 1 }, |
| 1093 | //{ UMULcc, FCMPDelayCycle.rid, 1, 1 }, |
| 1094 | //{ SDIVcc, FCMPDelayCycle.rid, 1, 1 }, |
| 1095 | //{ UDIVcc, FCMPDelayCycle.rid, 1, 1 }, |
| 1096 | { STD, FCMPDelayCycle.rid, 1, 1 }, |
| 1097 | { FMOVRSZ, FCMPDelayCycle.rid, 1, 1 }, |
| 1098 | { FMOVRSLEZ,FCMPDelayCycle.rid, 1, 1 }, |
| 1099 | { FMOVRSLZ, FCMPDelayCycle.rid, 1, 1 }, |
| 1100 | { FMOVRSNZ, FCMPDelayCycle.rid, 1, 1 }, |
| 1101 | { FMOVRSGZ, FCMPDelayCycle.rid, 1, 1 }, |
| 1102 | { FMOVRSGEZ,FCMPDelayCycle.rid, 1, 1 }, |
| 1103 | |
| 1104 | // |
| 1105 | // Some instructions are stalled in the GROUP stage if a CTI is in |
Vikram S. Adve | b7f06f4 | 2001-11-04 19:34:49 +0000 | [diff] [blame] | 1106 | // the E or C stage. We model that with a fake resource CTIDelayCycle. |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1107 | // |
| 1108 | { LDD, CTIDelayCycle.rid, 1, 1 }, |
| 1109 | //{ LDDA, CTIDelayCycle.rid, 1, 1 }, |
| 1110 | //{ LDDSTUB, CTIDelayCycle.rid, 1, 1 }, |
| 1111 | //{ LDDSTUBA, CTIDelayCycle.rid, 1, 1 }, |
| 1112 | //{ SWAP, CTIDelayCycle.rid, 1, 1 }, |
| 1113 | //{ SWAPA, CTIDelayCycle.rid, 1, 1 }, |
| 1114 | //{ CAS, CTIDelayCycle.rid, 1, 1 }, |
| 1115 | //{ CASA, CTIDelayCycle.rid, 1, 1 }, |
| 1116 | //{ CASX, CTIDelayCycle.rid, 1, 1 }, |
| 1117 | //{ CASXA, CTIDelayCycle.rid, 1, 1 }, |
| 1118 | |
| 1119 | // |
| 1120 | // Signed int loads of less than dword size return data in cycle N1 (not C) |
| 1121 | // and put all loads in consecutive cycles into delayed load return mode. |
| 1122 | // |
| 1123 | { LDSB, LdReturn.rid, 2, -1 }, |
| 1124 | { LDSB, LdReturn.rid, 3, 1 }, |
| 1125 | |
| 1126 | { LDSH, LdReturn.rid, 2, -1 }, |
| 1127 | { LDSH, LdReturn.rid, 3, 1 }, |
| 1128 | |
| 1129 | { LDSW, LdReturn.rid, 2, -1 }, |
| 1130 | { LDSW, LdReturn.rid, 3, 1 }, |
| 1131 | |
Vikram S. Adve | b7f06f4 | 2001-11-04 19:34:49 +0000 | [diff] [blame] | 1132 | // |
| 1133 | // RDPR from certain registers and RD from any register are not dispatchable |
| 1134 | // until four clocks after they reach the head of the instr. buffer. |
| 1135 | // Together with their single-issue requirement, this means all four issue |
| 1136 | // slots are effectively blocked for those cycles, plus the issue cycle. |
| 1137 | // This does not increase the latency of the instruction itself. |
| 1138 | // |
| 1139 | { RDCCR, AllIssueSlots.rid, 0, 5 }, |
| 1140 | { RDCCR, AllIssueSlots.rid, 0, 5 }, |
| 1141 | { RDCCR, AllIssueSlots.rid, 0, 5 }, |
| 1142 | { RDCCR, AllIssueSlots.rid, 0, 5 }, |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1143 | |
| 1144 | #undef EXPLICIT_BUBBLES_NEEDED |
| 1145 | #ifdef EXPLICIT_BUBBLES_NEEDED |
| 1146 | // |
| 1147 | // MULScc inserts one bubble. |
| 1148 | // This means it breaks the current group (captured in UltraSparcSchedInfo) |
| 1149 | // *and occupies all issue slots for the next cycle |
| 1150 | // |
| 1151 | //{ MULScc, AllIssueSlots.rid, 2, 2-1 }, |
| 1152 | //{ MULScc, AllIssueSlots.rid, 2, 2-1 }, |
| 1153 | //{ MULScc, AllIssueSlots.rid, 2, 2-1 }, |
| 1154 | //{ MULScc, AllIssueSlots.rid, 2, 2-1 }, |
| 1155 | |
| 1156 | // |
| 1157 | // SMULcc inserts between 4 and 18 bubbles, depending on #leading 0s in rs1. |
| 1158 | // We just model this with a simple average. |
| 1159 | // |
| 1160 | //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 }, |
| 1161 | //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 }, |
| 1162 | //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 }, |
| 1163 | //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 }, |
| 1164 | |
| 1165 | // SMULcc inserts between 4 and 19 bubbles, depending on #leading 0s in rs1. |
| 1166 | //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 }, |
| 1167 | //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 }, |
| 1168 | //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 }, |
| 1169 | //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 }, |
| 1170 | |
| 1171 | // |
| 1172 | // MULX inserts between 4 and 34 bubbles, depending on #leading 0s in rs1. |
| 1173 | // |
| 1174 | { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 }, |
| 1175 | { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 }, |
| 1176 | { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 }, |
| 1177 | { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 }, |
| 1178 | |
| 1179 | // |
| 1180 | // SDIVcc inserts 36 bubbles. |
| 1181 | // |
| 1182 | //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 }, |
| 1183 | //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 }, |
| 1184 | //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 }, |
| 1185 | //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 }, |
| 1186 | |
| 1187 | // UDIVcc inserts 37 bubbles. |
| 1188 | //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 }, |
| 1189 | //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 }, |
| 1190 | //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 }, |
| 1191 | //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 }, |
| 1192 | |
| 1193 | // |
| 1194 | // SDIVX inserts 68 bubbles. |
| 1195 | // |
| 1196 | { SDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1197 | { SDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1198 | { SDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1199 | { SDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1200 | |
| 1201 | // |
| 1202 | // UDIVX inserts 68 bubbles. |
| 1203 | // |
| 1204 | { UDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1205 | { UDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1206 | { UDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1207 | { UDIVX, AllIssueSlots.rid, 2, 68-1 }, |
| 1208 | |
| 1209 | // |
| 1210 | // WR inserts 4 bubbles. |
| 1211 | // |
| 1212 | //{ WR, AllIssueSlots.rid, 2, 68-1 }, |
| 1213 | //{ WR, AllIssueSlots.rid, 2, 68-1 }, |
| 1214 | //{ WR, AllIssueSlots.rid, 2, 68-1 }, |
| 1215 | //{ WR, AllIssueSlots.rid, 2, 68-1 }, |
| 1216 | |
| 1217 | // |
| 1218 | // WRPR inserts 4 bubbles. |
| 1219 | // |
| 1220 | //{ WRPR, AllIssueSlots.rid, 2, 68-1 }, |
| 1221 | //{ WRPR, AllIssueSlots.rid, 2, 68-1 }, |
| 1222 | //{ WRPR, AllIssueSlots.rid, 2, 68-1 }, |
| 1223 | //{ WRPR, AllIssueSlots.rid, 2, 68-1 }, |
| 1224 | |
| 1225 | // |
| 1226 | // DONE inserts 9 bubbles. |
| 1227 | // |
| 1228 | //{ DONE, AllIssueSlots.rid, 2, 9-1 }, |
| 1229 | //{ DONE, AllIssueSlots.rid, 2, 9-1 }, |
| 1230 | //{ DONE, AllIssueSlots.rid, 2, 9-1 }, |
| 1231 | //{ DONE, AllIssueSlots.rid, 2, 9-1 }, |
| 1232 | |
| 1233 | // |
| 1234 | // RETRY inserts 9 bubbles. |
| 1235 | // |
| 1236 | //{ RETRY, AllIssueSlots.rid, 2, 9-1 }, |
| 1237 | //{ RETRY, AllIssueSlots.rid, 2, 9-1 }, |
| 1238 | //{ RETRY, AllIssueSlots.rid, 2, 9-1 }, |
| 1239 | //{ RETRY, AllIssueSlots.rid, 2, 9-1 }, |
| 1240 | |
Chris Lattner | e369fcb | 2001-10-13 06:54:54 +0000 | [diff] [blame] | 1241 | #endif /*EXPLICIT_BUBBLES_NEEDED */ |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1242 | }; |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | // Additional delays to be captured in code: |
| 1247 | // 1. RDPR from several state registers (page 349) |
| 1248 | // 2. RD from *any* register (page 349) |
| 1249 | // 3. Writes to TICK, PSTATE, TL registers and FLUSH{W} instr (page 349) |
| 1250 | // 4. Integer store can be in same group as instr producing value to store. |
| 1251 | // 5. BICC and BPICC can be in the same group as instr producing CC (pg 350) |
| 1252 | // 6. FMOVr cannot be in the same or next group as an IEU instr (pg 351). |
| 1253 | // 7. The second instr. of a CTI group inserts 9 bubbles (pg 351) |
| 1254 | // 8. WR{PR}, SVAE, SAVED, RESTORE, RESTORED, RETURN, RETRY, and DONE that |
| 1255 | // follow an annulling branch cannot be issued in the same group or in |
| 1256 | // the 3 groups following the branch. |
| 1257 | // 9. A predicted annulled load does not stall dependent instructions. |
| 1258 | // Other annulled delay slot instructions *do* stall dependents, so |
| 1259 | // nothing special needs to be done for them during scheduling. |
| 1260 | //10. Do not put a load use that may be annulled in the same group as the |
| 1261 | // branch. The group will stall until the load returns. |
| 1262 | //11. Single-prec. FP loads lock 2 registers, for dependency checking. |
| 1263 | // |
| 1264 | // |
| 1265 | // Additional delays we cannot or will not capture: |
| 1266 | // 1. If DCTI is last word of cache line, it is delayed until next line can be |
| 1267 | // fetched. Also, other DCTI alignment-related delays (pg 352) |
| 1268 | // 2. Load-after-store is delayed by 7 extra cycles if load hits in D-Cache. |
| 1269 | // Also, several other store-load and load-store conflicts (pg 358) |
| 1270 | // 3. MEMBAR, LD{X}FSR, LDD{A} and a bunch of other load stalls (pg 358) |
| 1271 | // 4. There can be at most 8 outstanding buffered store instructions |
| 1272 | // (including some others like MEMBAR, LDSTUB, CAS{AX}, and FLUSH) |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | //--------------------------------------------------------------------------- |
| 1277 | // class UltraSparcSchedInfo |
| 1278 | // |
| 1279 | // Purpose: |
| 1280 | // Interface to instruction scheduling information for UltraSPARC. |
| 1281 | // The parameter values above are based on UltraSPARC IIi. |
| 1282 | //--------------------------------------------------------------------------- |
| 1283 | |
| 1284 | |
| 1285 | class UltraSparcSchedInfo: public MachineSchedInfo { |
| 1286 | public: |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1287 | /*ctor*/ UltraSparcSchedInfo (const TargetMachine& tgt); |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1288 | /*dtor*/ virtual ~UltraSparcSchedInfo () {} |
| 1289 | protected: |
| 1290 | virtual void initializeResources (); |
| 1291 | }; |
| 1292 | |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1293 | |
| 1294 | //--------------------------------------------------------------------------- |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1295 | // class UltraSparcFrameInfo |
| 1296 | // |
| 1297 | // Purpose: |
| 1298 | // Interface to stack frame layout info for the UltraSPARC. |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 1299 | // Starting offsets for each area of the stack frame are aligned at |
| 1300 | // a multiple of getStackFrameSizeAlignment(). |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1301 | //--------------------------------------------------------------------------- |
| 1302 | |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1303 | class UltraSparcFrameInfo: public MachineFrameInfo { |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1304 | public: |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1305 | /*ctor*/ UltraSparcFrameInfo(const TargetMachine& tgt) : MachineFrameInfo(tgt) {} |
| 1306 | |
| 1307 | public: |
| 1308 | int getStackFrameSizeAlignment () const { return StackFrameSizeAlignment;} |
| 1309 | int getMinStackFrameSize () const { return MinStackFrameSize; } |
| 1310 | int getNumFixedOutgoingArgs () const { return NumFixedOutgoingArgs; } |
| 1311 | int getSizeOfEachArgOnStack () const { return SizeOfEachArgOnStack; } |
| 1312 | bool argsOnStackHaveFixedSize () const { return true; } |
| 1313 | |
| 1314 | // |
| 1315 | // These methods compute offsets using the frame contents for a |
| 1316 | // particular method. The frame contents are obtained from the |
| 1317 | // MachineCodeInfoForMethod object for the given method. |
| 1318 | // |
| 1319 | int getFirstIncomingArgOffset (MachineCodeForMethod& mcInfo, |
| 1320 | bool& pos) const |
| 1321 | { |
| 1322 | pos = true; // arguments area grows upwards |
| 1323 | return FirstIncomingArgOffsetFromFP; |
| 1324 | } |
| 1325 | int getFirstOutgoingArgOffset (MachineCodeForMethod& mcInfo, |
| 1326 | bool& pos) const |
| 1327 | { |
| 1328 | pos = true; // arguments area grows upwards |
| 1329 | return FirstOutgoingArgOffsetFromSP; |
| 1330 | } |
| 1331 | int getFirstOptionalOutgoingArgOffset(MachineCodeForMethod& mcInfo, |
| 1332 | bool& pos)const |
| 1333 | { |
| 1334 | pos = true; // arguments area grows upwards |
| 1335 | return FirstOptionalOutgoingArgOffsetFromSP; |
| 1336 | } |
| 1337 | |
| 1338 | int getFirstAutomaticVarOffset (MachineCodeForMethod& mcInfo, |
| 1339 | bool& pos) const; |
| 1340 | int getRegSpillAreaOffset (MachineCodeForMethod& mcInfo, |
| 1341 | bool& pos) const; |
| 1342 | int getTmpAreaOffset (MachineCodeForMethod& mcInfo, |
| 1343 | bool& pos) const; |
| 1344 | int getDynamicAreaOffset (MachineCodeForMethod& mcInfo, |
| 1345 | bool& pos) const; |
| 1346 | |
| 1347 | // |
| 1348 | // These methods specify the base register used for each stack area |
| 1349 | // (generally FP or SP) |
| 1350 | // |
| 1351 | virtual int getIncomingArgBaseRegNum() const { |
| 1352 | return (int) target.getRegInfo().getFramePointer(); |
| 1353 | } |
| 1354 | virtual int getOutgoingArgBaseRegNum() const { |
| 1355 | return (int) target.getRegInfo().getStackPointer(); |
| 1356 | } |
| 1357 | virtual int getOptionalOutgoingArgBaseRegNum() const { |
| 1358 | return (int) target.getRegInfo().getStackPointer(); |
| 1359 | } |
| 1360 | virtual int getAutomaticVarBaseRegNum() const { |
| 1361 | return (int) target.getRegInfo().getFramePointer(); |
| 1362 | } |
| 1363 | virtual int getRegSpillAreaBaseRegNum() const { |
| 1364 | return (int) target.getRegInfo().getFramePointer(); |
| 1365 | } |
| 1366 | virtual int getDynamicAreaBaseRegNum() const { |
| 1367 | return (int) target.getRegInfo().getStackPointer(); |
| 1368 | } |
| 1369 | |
| 1370 | private: |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 1371 | // All stack addresses must be offset by 0x7ff (2047) on Sparc V9. |
| 1372 | static const int OFFSET = (int) 0x7ff; |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1373 | static const int StackFrameSizeAlignment = 16; |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1374 | static const int MinStackFrameSize = 176; |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1375 | static const int NumFixedOutgoingArgs = 6; |
| 1376 | static const int SizeOfEachArgOnStack = 8; |
Ruchira Sasanka | 67a463a | 2001-11-12 14:45:33 +0000 | [diff] [blame] | 1377 | static const int StaticAreaOffsetFromFP = 0 + OFFSET; |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 1378 | static const int FirstIncomingArgOffsetFromFP = 128 + OFFSET; |
| 1379 | static const int FirstOptionalIncomingArgOffsetFromFP = 176 + OFFSET; |
| 1380 | static const int FirstOutgoingArgOffsetFromSP = 128 + OFFSET; |
| 1381 | static const int FirstOptionalOutgoingArgOffsetFromSP = 176 + OFFSET; |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1382 | }; |
| 1383 | |
| 1384 | |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 1385 | //--------------------------------------------------------------------------- |
| 1386 | // class UltraSparcCacheInfo |
| 1387 | // |
| 1388 | // Purpose: |
| 1389 | // Interface to cache parameters for the UltraSPARC. |
| 1390 | // Just use defaults for now. |
| 1391 | //--------------------------------------------------------------------------- |
| 1392 | |
| 1393 | class UltraSparcCacheInfo: public MachineCacheInfo { |
| 1394 | public: |
| 1395 | /*ctor*/ UltraSparcCacheInfo (const TargetMachine& target) : |
| 1396 | MachineCacheInfo(target) {} |
| 1397 | }; |
| 1398 | |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1399 | |
| 1400 | //--------------------------------------------------------------------------- |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1401 | // class UltraSparcMachine |
| 1402 | // |
| 1403 | // Purpose: |
| 1404 | // Primary interface to machine description for the UltraSPARC. |
| 1405 | // Primarily just initializes machine-dependent parameters in |
| 1406 | // class TargetMachine, and creates machine-dependent subclasses |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 1407 | // for classes such as InstrInfo, SchedInfo and RegInfo. |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1408 | //--------------------------------------------------------------------------- |
| 1409 | |
| 1410 | class UltraSparc : public TargetMachine { |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 1411 | private: |
| 1412 | UltraSparcInstrInfo instrInfo; |
| 1413 | UltraSparcSchedInfo schedInfo; |
| 1414 | UltraSparcRegInfo regInfo; |
Vikram S. Adve | c152163 | 2001-10-22 13:31:53 +0000 | [diff] [blame] | 1415 | UltraSparcFrameInfo frameInfo; |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 1416 | UltraSparcCacheInfo cacheInfo; |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1417 | public: |
| 1418 | UltraSparc(); |
| 1419 | virtual ~UltraSparc() {} |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 1420 | |
Chris Lattner | 32f600a | 2001-09-19 13:47:12 +0000 | [diff] [blame] | 1421 | virtual const MachineInstrInfo &getInstrInfo() const { return instrInfo; } |
| 1422 | virtual const MachineSchedInfo &getSchedInfo() const { return schedInfo; } |
| 1423 | virtual const MachineRegInfo &getRegInfo() const { return regInfo; } |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 1424 | virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; } |
Vikram S. Adve | 5afff3b | 2001-11-09 02:15:52 +0000 | [diff] [blame] | 1425 | virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; } |
Vikram S. Adve | 339084b | 2001-09-18 13:04:24 +0000 | [diff] [blame] | 1426 | |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1427 | // compileMethod - For the sparc, we do instruction selection, followed by |
| 1428 | // delay slot scheduling, then register allocation. |
| 1429 | // |
| 1430 | virtual bool compileMethod(Method *M); |
Chris Lattner | 32f600a | 2001-09-19 13:47:12 +0000 | [diff] [blame] | 1431 | |
| 1432 | // |
| 1433 | // emitAssembly - Output assembly language code (a .s file) for the specified |
| 1434 | // module. The specified module must have been compiled before this may be |
| 1435 | // used. |
| 1436 | // |
Chris Lattner | ec0a95f | 2001-10-15 15:54:43 +0000 | [diff] [blame] | 1437 | virtual void emitAssembly(const Module *M, ostream &OutStr) const; |
Chris Lattner | f6e0e28 | 2001-09-14 04:32:55 +0000 | [diff] [blame] | 1438 | }; |
| 1439 | |
| 1440 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 1441 | #endif |