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