blob: 812378c7bba295952a64a63d618fcb37fc6695e4 [file] [log] [blame]
Chris Lattnerc6495ee2001-09-14 03:56:45 +00001//===-- 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 Sasanka89fb46b2001-09-18 22:52:44 +000011
12#include "SparcRegClassInfo.h"
13#include "llvm/Target/TargetMachine.h"
14#include "llvm/Target/MachineInstrInfo.h"
15
Vikram S. Adve339084b2001-09-18 13:04:24 +000016#include "llvm/Target/MachineSchedInfo.h"
Ruchira Sasankaab304c42001-09-30 23:19:57 +000017#include "llvm/CodeGen/RegClass.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000018#include "llvm/Type.h"
Vikram S. Adve339084b2001-09-18 13:04:24 +000019
Chris Lattner46cbff62001-09-14 16:56:32 +000020#include <sys/types.h>
Chris Lattnerc6495ee2001-09-14 03:56:45 +000021
Chris Lattnerf6e0e282001-09-14 04:32:55 +000022class UltraSparc;
23
Chris Lattnerc6495ee2001-09-14 03:56:45 +000024// OpCodeMask definitions for the Sparc V9
25//
26const OpCodeMask Immed = 0x00002000; // immed or reg operand?
27const OpCodeMask Annul = 0x20000000; // annul delay instr?
28const OpCodeMask PredictTaken = 0x00080000; // predict branch taken?
29
30
31enum 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 Lattnerc6495ee2001-09-14 03:56:45 +000047
48//---------------------------------------------------------------------------
49// enum SparcMachineOpCode.
50// const MachineInstrDescriptor SparcMachineInstrDesc[]
51//
52// Purpose:
53// Description of UltraSparc machine instructions.
54//
55//---------------------------------------------------------------------------
56
Chris Lattnerc6495ee2001-09-14 03:56:45 +000057enum SparcMachineOpCode {
Chris Lattner9a3d63b2001-09-19 15:56:23 +000058#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
59 NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
60 ENUM,
61#include "SparcInstr.def"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000062
Chris Lattnerc6495ee2001-09-14 03:56:45 +000063 // End-of-array marker
64 INVALID_OPCODE,
65 NUM_REAL_OPCODES = RETURN+1, // number of valid opcodes
66 NUM_TOTAL_OPCODES = INVALID_OPCODE
67};
68
Chris Lattnerc6495ee2001-09-14 03:56:45 +000069
Chris Lattner9a3d63b2001-09-19 15:56:23 +000070// Array of machine instruction descriptions...
71extern const MachineInstrDescriptor SparcMachineInstrDesc[];
Chris Lattnerc6495ee2001-09-14 03:56:45 +000072
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
84class UltraSparcInstrInfo : public MachineInstrInfo {
85public:
86 /*ctor*/ UltraSparcInstrInfo();
87
88 virtual bool hasResultInterlock (MachineOpCode opCode)
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
Ruchira Sasankaab304c42001-09-30 23:19:57 +000099
100
101
102
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000103};
104
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000105
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000106
107class LiveRange;
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000108class UltraSparc;
109
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000110
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000111
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000112class UltraSparcRegInfo : public MachineRegInfo
113{
114
115 private:
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000116
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000117 // The actual register classes in the Sparc
118
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000119 enum RegClassIDs {
120 IntRegClassID,
121 FloatRegClassID,
122 IntCCRegClassID,
123 FloatCCRegClassID
124 };
125
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000126
127 // Type of registers available in Sparc. There can be several reg types
128 // in the same class. For instace, the float reg class has Single/Double
129 // types
130 enum RegTypes {
131 IntRegType,
132 FPSingleRegType,
133 FPDoubleRegType,
134 IntCCRegType,
135 FloatCCRegType
136 };
137
138
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000139 // WARNING: If the above enum order must be changed, also modify
140 // getRegisterClassOfValue method below since it assumes this particular
141 // order for efficiency.
142
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000143
144 // reverse pointer to get info about the ultra sparc machine
145 const UltraSparc *const UltraSparcInfo;
146
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000147 // Both int and float rguments can be passed in 6 int regs -
148 // %o0 to %o5 (cannot be changed)
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000149 unsigned const NumOfIntArgRegs;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000150 unsigned const NumOfFloatArgRegs;
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000151 unsigned const InvalidRegNum;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000152
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000153 //void setCallArgColor(LiveRange *const LR, const unsigned RegNo) const;
154
155 void setCallOrRetArgCol(LiveRange *const LR, const unsigned RegNo,
156 const MachineInstr *MI,AddedInstrMapType &AIMap)const;
157
158 MachineInstr * getCopy2RegMI(const Value *SrcVal, const unsigned Reg,
159 unsigned RegClassID) const ;
160
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000161
162 void suggestReg4RetAddr(const MachineInstr * RetMI,
163 LiveRangeInfo& LRI) const;
164
165 void suggestReg4CallAddr(const MachineInstr * CallMI) const;
166
167
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000168 Value *getValue4ReturnAddr( const MachineInstr * MInst ) const ;
169
170 int getRegType(const LiveRange *const LR) const {
171
172 unsigned Typ;
173
174 switch( (LR->getRegClass())->getID() ) {
175
176 case IntRegClassID: return IntRegType;
177
178 case FloatRegClassID:
179 Typ = LR->getTypeID();
180 if( Typ == Type::FloatTyID )
181 return FPSingleRegType;
182 else if( Typ == Type::DoubleTyID )
183 return FPDoubleRegType;
184 else assert(0 && "Unknown type in FloatRegClass");
185
186 case IntCCRegClassID: return IntCCRegType;
187
188 case FloatCCRegClassID: return FloatCCRegType ;
189
190 default: assert( 0 && "Unknown reg class ID");
191
192 }
193
194 }
195
196 int getRegType(const Value *const Val) const {
197
198 unsigned Typ;
199
200 switch( getRegClassIDOfValue(Val) ) {
201
202 case IntRegClassID: return IntRegType;
203
204 case FloatRegClassID:
205 Typ = (Val->getType())->getPrimitiveID();
206 if( Typ == Type::FloatTyID )
207 return FPSingleRegType;
208 else if( Typ == Type::DoubleTyID )
209 return FPDoubleRegType;
210 else assert(0 && "Unknown type in FloatRegClass");
211
212 case IntCCRegClassID: return IntCCRegType;
213
214 case FloatCCRegClassID: return FloatCCRegType ;
215
216 default: assert( 0 && "Unknown reg class ID");
217
218 }
219
220 }
221
222
223
224
225 MachineInstr * cpReg2RegMI(const unsigned SrcReg, const unsigned DestReg,
226 const int RegType) const;
227
228 MachineInstr * cpValue2RegMI(Value * Val, const unsigned DestReg,
229 const int RegType) const;
230
231
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000232 public:
233
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000234
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000235 UltraSparcRegInfo(const UltraSparc *const USI ) : UltraSparcInfo(USI),
236 NumOfIntArgRegs(6),
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000237 NumOfFloatArgRegs(32),
238 InvalidRegNum(1000)
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000239 {
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000240 MachineRegClassArr.push_back( new SparcIntRegClass(IntRegClassID) );
241 MachineRegClassArr.push_back( new SparcFloatRegClass(FloatRegClassID) );
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000242 MachineRegClassArr.push_back( new SparcIntCCRegClass(IntCCRegClassID) );
243 MachineRegClassArr.push_back( new SparcFloatCCRegClass(FloatCCRegClassID));
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000244
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000245 assert( SparcFloatRegOrder::StartOfNonVolatileRegs == 32 &&
246 "32 Float regs are used for float arg passing");
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000247 }
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000248
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000249 // ***** TODO Delete
250 ~UltraSparcRegInfo(void) { } // empty destructor
251
252
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000253 inline const UltraSparc & getUltraSparcInfo() const {
254 return *UltraSparcInfo;
255 }
256
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000257
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000258
259 inline unsigned getRegClassIDOfValue (const Value *const Val,
260 bool isCCReg = false) const {
261
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000262 Type::PrimitiveID ty = (Val->getType())->getPrimitiveID();
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000263
264 unsigned res;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000265
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000266 if( (ty && ty <= Type::LongTyID) || (ty == Type::LabelTyID) ||
267 (ty == Type::MethodTyID) || (ty == Type::PointerTyID) )
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000268 res = IntRegClassID; // sparc int reg (ty=0: void)
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000269 else if( ty <= Type::DoubleTyID)
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000270 res = FloatRegClassID; // sparc float reg class
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000271 else {
Chris Lattner1e23ed72001-10-15 18:15:27 +0000272 cerr << "TypeID: " << ty << endl;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000273 assert(0 && "Cannot resolve register class for type");
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000274 }
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000275
276 if(isCCReg)
277 return res + 2; // corresponidng condition code regiser
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000278 else
279 return res;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000280 }
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000281
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000282 // returns the register tha contains always zero
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000283 // this is the unified register number
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000284 inline int getZeroRegNum() const { return SparcIntRegOrder::g0; }
285
286 // returns the reg used for pushing the address when a method is called.
287 // This can be used for other purposes between calls
288 unsigned getCallAddressReg() const { return SparcIntRegOrder::o7; }
289
290
291 // and when we return from a method. It should be made sure that this
292 // register contains the return value when a return instruction is reached.
293 unsigned getReturnAddressReg() const { return SparcIntRegOrder::i7; }
294
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000295 void suggestRegs4MethodArgs(const Method *const Meth,
296 LiveRangeInfo& LRI) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000297
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000298 void suggestRegs4CallArgs(const MachineInstr *const CallMI,
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000299 LiveRangeInfo& LRI, vector<RegClass *> RCL) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000300
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000301 void suggestReg4RetValue(const MachineInstr *const RetMI,
302 LiveRangeInfo& LRI ) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000303
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000304
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000305 void colorMethodArgs(const Method *const Meth, LiveRangeInfo& LRI,
306 AddedInstrns *const FirstAI) const;
307
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000308 void colorCallArgs(const MachineInstr *const CallMI, LiveRangeInfo& LRI,
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000309 AddedInstrns *const CallAI) const;
310
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000311 void colorRetValue(const MachineInstr *const RetI, LiveRangeInfo& LRI,
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000312 AddedInstrns *const RetAI) const;
313
314
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000315 // bool handleSpecialMInstr(const MachineInstr * MInst,
316 // LiveRangeInfo& LRI, vector<RegClass *> RCL) const;
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000317
318
319 static void printReg(const LiveRange *const LR) ;
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000320
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000321 // this method provides a unique number for each register
322 inline int getUnifiedRegNum(int RegClassID, int reg) const {
323
324 if( RegClassID == IntRegClassID && reg < 32 )
325 return reg;
326 else if ( RegClassID == FloatRegClassID && reg < 64)
327 return reg + 32; // we have 32 int regs
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000328 else if( RegClassID == FloatCCRegClassID && reg < 4)
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000329 return reg + 32 + 64; // 32 int, 64 float
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000330 else if( RegClassID == IntCCRegClassID )
331 return 4+ 32 + 64; // only int cc reg
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000332 else if (reg==1000) //****** TODO: Remove
333 return 1000;
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000334 else
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000335 assert(0 && "Invalid register class or reg number");
336
337 }
338
339 // given the unified register number, this gives the name
340 inline const string getUnifiedRegName(int reg) const {
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000341 if( reg < 32 )
342 return SparcIntRegOrder::getRegName(reg);
343 else if ( reg < (64 + 32) )
344 return SparcFloatRegOrder::getRegName( reg - 32);
345 else if( reg < (64+32+4) )
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000346 return SparcFloatCCRegOrder::getRegName( reg -32 - 64);
347 else if ( reg == 64+32+4)
348 return "xcc"; // only integer cc reg
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000349
350 else if (reg==1000) //****** TODO: Remove
351 return "<*NoReg*>";
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000352 else
353 assert(0 && "Invalid register number");
354 }
355
356
357};
358
359
360
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000361/*---------------------------------------------------------------------------
362Scheduling guidelines for SPARC IIi:
363
364I-Cache alignment rules (pg 326)
365-- Align a branch target instruction so that it's entire group is within
366 the same cache line (may be 1-4 instructions).
367** Don't let a branch that is predicted taken be the last instruction
368 on an I-cache line: delay slot will need an entire line to be fetched
369-- Make a FP instruction or a branch be the 4th instruction in a group.
370 For branches, there are tradeoffs in reordering to make this happen
371 (see pg. 327).
372** Don't put a branch in a group that crosses a 32-byte boundary!
373 An artificial branch is inserted after every 32 bytes, and having
374 another branch will force the group to be broken into 2 groups.
375
376iTLB rules:
377-- Don't let a loop span two memory pages, if possible
378
379Branch prediction performance:
380-- Don't make the branch in a delay slot the target of a branch
381-- Try not to have 2 predicted branches within a group of 4 instructions
382 (because each such group has a single branch target field).
383-- Try to align branches in slots 0, 2, 4 or 6 of a cache line (to avoid
384 the wrong prediction bits being used in some cases).
385
386D-Cache timing constraints:
387-- Signed int loads of less than 64 bits have 3 cycle latency, not 2
388-- All other loads that hit in D-Cache have 2 cycle latency
389-- All loads are returned IN ORDER, so a D-Cache miss will delay a later hit
390-- Mis-aligned loads or stores cause a trap. In particular, replace
391 mis-aligned FP double precision l/s with 2 single-precision l/s.
392-- Simulations of integer codes show increase in avg. group size of
393 33% when code (including esp. non-faulting loads) is moved across
394 one branch, and 50% across 2 branches.
395
396E-Cache timing constraints:
397-- Scheduling for E-cache (D-Cache misses) is effective (due to load buffering)
398
399Store buffer timing constraints:
400-- Stores can be executed in same cycle as instruction producing the value
401-- Stores are buffered and have lower priority for E-cache until
402 highwater mark is reached in the store buffer (5 stores)
403
404Pipeline constraints:
405-- Shifts can only use IEU0.
406-- CC setting instructions can only use IEU1.
407-- Several other instructions must only use IEU1:
408 EDGE(?), ARRAY(?), CALL, JMPL, BPr, PST, and FCMP.
409-- Two instructions cannot store to the same register file in a single cycle
410 (single write port per file).
411
412Issue and grouping constraints:
413-- FP and branch instructions must use slot 4.
414-- Shift instructions cannot be grouped with other IEU0-specific instructions.
415-- CC setting instructions cannot be grouped with other IEU1-specific instrs.
416-- Several instructions must be issued in a single-instruction group:
417 MOVcc or MOVr, MULs/x and DIVs/x, SAVE/RESTORE, many others
418-- A CALL or JMPL breaks a group, ie, is not combined with subsequent instrs.
419--
420--
421
422Branch delay slot scheduling rules:
423-- A CTI couple (two back-to-back CTI instructions in the dynamic stream)
424 has a 9-instruction penalty: the entire pipeline is flushed when the
425 second instruction reaches stage 9 (W-Writeback).
426-- Avoid putting multicycle instructions, and instructions that may cause
427 load misses, in the delay slot of an annulling branch.
428-- Avoid putting WR, SAVE..., RESTORE and RETURN instructions in the
429 delay slot of an annulling branch.
430
431 *--------------------------------------------------------------------------- */
432
433//---------------------------------------------------------------------------
434// List of CPUResources for UltraSPARC IIi.
435//---------------------------------------------------------------------------
436
437const CPUResource AllIssueSlots( "All Instr Slots", 4);
438const CPUResource IntIssueSlots( "Int Instr Slots", 3);
439const CPUResource First3IssueSlots("Instr Slots 0-3", 3);
440const CPUResource LSIssueSlots( "Load-Store Instr Slot", 1);
441const CPUResource CTIIssueSlots( "Ctrl Transfer Instr Slot", 1);
442const CPUResource FPAIssueSlots( "Int Instr Slot 1", 1);
443const CPUResource FPMIssueSlots( "Int Instr Slot 1", 1);
444
445// IEUN instructions can use either Alu and should use IAluN.
446// IEU0 instructions must use Alu 1 and should use both IAluN and IAlu0.
447// IEU1 instructions must use Alu 2 and should use both IAluN and IAlu1.
448const CPUResource IAluN("Int ALU 1or2", 2);
449const CPUResource IAlu0("Int ALU 1", 1);
450const CPUResource IAlu1("Int ALU 2", 1);
451
452const CPUResource LSAluC1("Load/Store Unit Addr Cycle", 1);
453const CPUResource LSAluC2("Load/Store Unit Issue Cycle", 1);
454const CPUResource LdReturn("Load Return Unit", 1);
455
456const CPUResource FPMAluC1("FP Mul/Div Alu Cycle 1", 1);
457const CPUResource FPMAluC2("FP Mul/Div Alu Cycle 2", 1);
458const CPUResource FPMAluC3("FP Mul/Div Alu Cycle 3", 1);
459
460const CPUResource FPAAluC1("FP Other Alu Cycle 1", 1);
461const CPUResource FPAAluC2("FP Other Alu Cycle 2", 1);
462const CPUResource FPAAluC3("FP Other Alu Cycle 3", 1);
463
464const CPUResource IRegReadPorts("Int Reg ReadPorts", INT_MAX); // CHECK
465const CPUResource IRegWritePorts("Int Reg WritePorts", 2); // CHECK
466const CPUResource FPRegReadPorts("FP Reg Read Ports", INT_MAX); // CHECK
467const CPUResource FPRegWritePorts("FP Reg Write Ports", 1); // CHECK
468
469const CPUResource CTIDelayCycle( "CTI delay cycle", 1);
470const CPUResource FCMPDelayCycle("FCMP delay cycle", 1);
471
472
473//---------------------------------------------------------------------------
474// const InstrClassRUsage SparcRUsageDesc[]
475//
476// Purpose:
477// Resource usage information for instruction in each scheduling class.
478// The InstrRUsage Objects for individual classes are specified first.
479// Note that fetch and decode are decoupled from the execution pipelines
480// via an instr buffer, so they are not included in the cycles below.
481//---------------------------------------------------------------------------
482
483const InstrClassRUsage NoneClassRUsage = {
484 SPARC_NONE,
485 /*totCycles*/ 7,
486
487 /* maxIssueNum */ 4,
488 /* isSingleIssue */ false,
489 /* breaksGroup */ false,
490 /* numBubbles */ 0,
491
492 /*numSlots*/ 4,
493 /* feasibleSlots[] */ { 0, 1, 2, 3 },
494
495 /*numEntries*/ 0,
496 /* V[] */ {
497 /*Cycle G */
498 /*Cycle E */
499 /*Cycle C */
500 /*Cycle N1*/
501 /*Cycle N1*/
502 /*Cycle N1*/
503 /*Cycle W */
504 }
505};
506
507const InstrClassRUsage IEUNClassRUsage = {
508 SPARC_IEUN,
509 /*totCycles*/ 7,
510
511 /* maxIssueNum */ 3,
512 /* isSingleIssue */ false,
513 /* breaksGroup */ false,
514 /* numBubbles */ 0,
515
516 /*numSlots*/ 3,
517 /* feasibleSlots[] */ { 0, 1, 2 },
518
519 /*numEntries*/ 4,
520 /* V[] */ {
521 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
522 { IntIssueSlots.rid, 0, 1 },
523 /*Cycle E */ { IAluN.rid, 1, 1 },
524 /*Cycle C */
525 /*Cycle N1*/
526 /*Cycle N1*/
527 /*Cycle N1*/
528 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
529 }
530};
531
532const InstrClassRUsage IEU0ClassRUsage = {
533 SPARC_IEU0,
534 /*totCycles*/ 7,
535
536 /* maxIssueNum */ 1,
537 /* isSingleIssue */ false,
538 /* breaksGroup */ false,
539 /* numBubbles */ 0,
540
541 /*numSlots*/ 3,
542 /* feasibleSlots[] */ { 0, 1, 2 },
543
544 /*numEntries*/ 5,
545 /* V[] */ {
546 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
547 { IntIssueSlots.rid, 0, 1 },
548 /*Cycle E */ { IAluN.rid, 1, 1 },
549 { IAlu0.rid, 1, 1 },
550 /*Cycle C */
551 /*Cycle N1*/
552 /*Cycle N1*/
553 /*Cycle N1*/
554 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
555 }
556};
557
558const InstrClassRUsage IEU1ClassRUsage = {
559 SPARC_IEU1,
560 /*totCycles*/ 7,
561
562 /* maxIssueNum */ 1,
563 /* isSingleIssue */ false,
564 /* breaksGroup */ false,
565 /* numBubbles */ 0,
566
567 /*numSlots*/ 3,
568 /* feasibleSlots[] */ { 0, 1, 2 },
569
570 /*numEntries*/ 5,
571 /* V[] */ {
572 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
573 { IntIssueSlots.rid, 0, 1 },
574 /*Cycle E */ { IAluN.rid, 1, 1 },
575 { IAlu1.rid, 1, 1 },
576 /*Cycle C */
577 /*Cycle N1*/
578 /*Cycle N1*/
579 /*Cycle N1*/
580 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
581 }
582};
583
584const InstrClassRUsage FPMClassRUsage = {
585 SPARC_FPM,
586 /*totCycles*/ 7,
587
588 /* maxIssueNum */ 1,
589 /* isSingleIssue */ false,
590 /* breaksGroup */ false,
591 /* numBubbles */ 0,
592
593 /*numSlots*/ 4,
594 /* feasibleSlots[] */ { 0, 1, 2, 3 },
595
596 /*numEntries*/ 7,
597 /* V[] */ {
598 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
599 { FPMIssueSlots.rid, 0, 1 },
600 /*Cycle E */ { FPRegReadPorts.rid, 1, 1 },
601 /*Cycle C */ { FPMAluC1.rid, 2, 1 },
602 /*Cycle N1*/ { FPMAluC2.rid, 3, 1 },
603 /*Cycle N1*/ { FPMAluC3.rid, 4, 1 },
604 /*Cycle N1*/
605 /*Cycle W */ { FPRegWritePorts.rid, 6, 1 }
606 }
607};
608
609const InstrClassRUsage FPAClassRUsage = {
610 SPARC_FPA,
611 /*totCycles*/ 7,
612
613 /* maxIssueNum */ 1,
614 /* isSingleIssue */ false,
615 /* breaksGroup */ false,
616 /* numBubbles */ 0,
617
618 /*numSlots*/ 4,
619 /* feasibleSlots[] */ { 0, 1, 2, 3 },
620
621 /*numEntries*/ 7,
622 /* V[] */ {
623 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
624 { FPAIssueSlots.rid, 0, 1 },
625 /*Cycle E */ { FPRegReadPorts.rid, 1, 1 },
626 /*Cycle C */ { FPAAluC1.rid, 2, 1 },
627 /*Cycle N1*/ { FPAAluC2.rid, 3, 1 },
628 /*Cycle N1*/ { FPAAluC3.rid, 4, 1 },
629 /*Cycle N1*/
630 /*Cycle W */ { FPRegWritePorts.rid, 6, 1 }
631 }
632};
633
634const InstrClassRUsage LDClassRUsage = {
635 SPARC_LD,
636 /*totCycles*/ 7,
637
638 /* maxIssueNum */ 1,
639 /* isSingleIssue */ false,
640 /* breaksGroup */ false,
641 /* numBubbles */ 0,
642
643 /*numSlots*/ 3,
644 /* feasibleSlots[] */ { 0, 1, 2, },
645
646 /*numEntries*/ 6,
647 /* V[] */ {
648 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
649 { First3IssueSlots.rid, 0, 1 },
650 { LSIssueSlots.rid, 0, 1 },
651 /*Cycle E */ { LSAluC1.rid, 1, 1 },
652 /*Cycle C */ { LSAluC2.rid, 2, 1 },
653 { LdReturn.rid, 2, 1 },
654 /*Cycle N1*/
655 /*Cycle N1*/
656 /*Cycle N1*/
657 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
658 }
659};
660
661const InstrClassRUsage STClassRUsage = {
662 SPARC_ST,
663 /*totCycles*/ 7,
664
665 /* maxIssueNum */ 1,
666 /* isSingleIssue */ false,
667 /* breaksGroup */ false,
668 /* numBubbles */ 0,
669
670 /*numSlots*/ 3,
671 /* feasibleSlots[] */ { 0, 1, 2 },
672
673 /*numEntries*/ 4,
674 /* V[] */ {
675 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
676 { First3IssueSlots.rid, 0, 1 },
677 { LSIssueSlots.rid, 0, 1 },
678 /*Cycle E */ { LSAluC1.rid, 1, 1 },
679 /*Cycle C */ { LSAluC2.rid, 2, 1 }
680 /*Cycle N1*/
681 /*Cycle N1*/
682 /*Cycle N1*/
683 /*Cycle W */
684 }
685};
686
687const InstrClassRUsage CTIClassRUsage = {
688 SPARC_CTI,
689 /*totCycles*/ 7,
690
691 /* maxIssueNum */ 1,
692 /* isSingleIssue */ false,
693 /* breaksGroup */ false,
694 /* numBubbles */ 0,
695
696 /*numSlots*/ 4,
697 /* feasibleSlots[] */ { 0, 1, 2, 3 },
698
699 /*numEntries*/ 4,
700 /* V[] */ {
701 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
702 { CTIIssueSlots.rid, 0, 1 },
703 /*Cycle E */ { IAlu0.rid, 1, 1 },
704 /*Cycles E-C */ { CTIDelayCycle.rid, 1, 2 }
705 /*Cycle C */
706 /*Cycle N1*/
707 /*Cycle N1*/
708 /*Cycle N1*/
709 /*Cycle W */
710 }
711};
712
713const InstrClassRUsage SingleClassRUsage = {
714 SPARC_SINGLE,
715 /*totCycles*/ 7,
716
717 /* maxIssueNum */ 1,
718 /* isSingleIssue */ true,
719 /* breaksGroup */ false,
720 /* numBubbles */ 0,
721
722 /*numSlots*/ 1,
723 /* feasibleSlots[] */ { 0 },
724
725 /*numEntries*/ 5,
726 /* V[] */ {
727 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
728 { AllIssueSlots.rid, 0, 1 },
729 { AllIssueSlots.rid, 0, 1 },
730 { AllIssueSlots.rid, 0, 1 },
731 /*Cycle E */ { IAlu0.rid, 1, 1 }
732 /*Cycle C */
733 /*Cycle N1*/
734 /*Cycle N1*/
735 /*Cycle N1*/
736 /*Cycle W */
737 }
738};
739
740
741const InstrClassRUsage SparcRUsageDesc[] = {
742 NoneClassRUsage,
743 IEUNClassRUsage,
744 IEU0ClassRUsage,
745 IEU1ClassRUsage,
746 FPMClassRUsage,
747 FPAClassRUsage,
748 CTIClassRUsage,
749 LDClassRUsage,
750 STClassRUsage,
751 SingleClassRUsage
752};
753
754
755//---------------------------------------------------------------------------
756// const InstrIssueDelta SparcInstrIssueDeltas[]
757//
758// Purpose:
759// Changes to issue restrictions information in InstrClassRUsage for
760// instructions that differ from other instructions in their class.
761//---------------------------------------------------------------------------
762
763const InstrIssueDelta SparcInstrIssueDeltas[] = {
764
765 // opCode, isSingleIssue, breaksGroup, numBubbles
766
767 // Special cases for single-issue only
768 // Other single issue cases are below.
769//{ LDDA, true, true, 0 },
770//{ STDA, true, true, 0 },
771//{ LDDF, true, true, 0 },
772//{ LDDFA, true, true, 0 },
773 { ADDC, true, true, 0 },
774 { ADDCcc, true, true, 0 },
775 { SUBC, true, true, 0 },
776 { SUBCcc, true, true, 0 },
777//{ SAVE, true, true, 0 },
778//{ RESTORE, true, true, 0 },
779//{ LDSTUB, true, true, 0 },
780//{ SWAP, true, true, 0 },
781//{ SWAPA, true, true, 0 },
782//{ CAS, true, true, 0 },
783//{ CASA, true, true, 0 },
784//{ CASX, true, true, 0 },
785//{ CASXA, true, true, 0 },
786//{ LDFSR, true, true, 0 },
787//{ LDFSRA, true, true, 0 },
788//{ LDXFSR, true, true, 0 },
789//{ LDXFSRA, true, true, 0 },
790//{ STFSR, true, true, 0 },
791//{ STFSRA, true, true, 0 },
792//{ STXFSR, true, true, 0 },
793//{ STXFSRA, true, true, 0 },
794//{ SAVED, true, true, 0 },
795//{ RESTORED, true, true, 0 },
796//{ FLUSH, true, true, 9 },
797//{ FLUSHW, true, true, 9 },
798//{ ALIGNADDR, true, true, 0 },
799 { RETURN, true, true, 0 },
800//{ DONE, true, true, 0 },
801//{ RETRY, true, true, 0 },
802//{ WR, true, true, 0 },
803//{ WRPR, true, true, 4 },
804//{ RD, true, true, 0 },
805//{ RDPR, true, true, 0 },
806//{ TCC, true, true, 0 },
807//{ SHUTDOWN, true, true, 0 },
808
809 // Special cases for breaking group *before*
810 // CURRENTLY NOT SUPPORTED!
811 { CALL, false, false, 0 },
812 { JMPL, false, false, 0 },
813
814 // Special cases for breaking the group *after*
815 { MULX, true, true, (4+34)/2 },
816 { FDIVS, false, true, 0 },
817 { FDIVD, false, true, 0 },
818 { FDIVQ, false, true, 0 },
819 { FSQRTS, false, true, 0 },
820 { FSQRTD, false, true, 0 },
821 { FSQRTQ, false, true, 0 },
822//{ FCMP{LE,GT,NE,EQ}, false, true, 0 },
823
824 // Instructions that introduce bubbles
825//{ MULScc, true, true, 2 },
826//{ SMULcc, true, true, (4+18)/2 },
827//{ UMULcc, true, true, (4+19)/2 },
828 { SDIVX, true, true, 68 },
829 { UDIVX, true, true, 68 },
830//{ SDIVcc, true, true, 36 },
831//{ UDIVcc, true, true, 37 },
832//{ WR, false, false, 4 },
833//{ WRPR, false, false, 4 },
834};
835
836
837//---------------------------------------------------------------------------
838// const InstrRUsageDelta SparcInstrUsageDeltas[]
839//
840// Purpose:
841// Changes to resource usage information in InstrClassRUsage for
842// instructions that differ from other instructions in their class.
843//---------------------------------------------------------------------------
844
845const InstrRUsageDelta SparcInstrUsageDeltas[] = {
846
847 // MachineOpCode, Resource, Start cycle, Num cycles
848
849 //
850 // JMPL counts as a load/store instruction for issue!
851 //
852 { JMPL, LSIssueSlots.rid, 0, 1 },
853
854 //
855 // Many instructions cannot issue for the next 2 cycles after an FCMP
856 // We model that with a fake resource FCMPDelayCycle.
857 //
858 { FCMPS, FCMPDelayCycle.rid, 1, 3 },
859 { FCMPD, FCMPDelayCycle.rid, 1, 3 },
860 { FCMPQ, FCMPDelayCycle.rid, 1, 3 },
861
862 { MULX, FCMPDelayCycle.rid, 1, 1 },
863 { SDIVX, FCMPDelayCycle.rid, 1, 1 },
864 { UDIVX, FCMPDelayCycle.rid, 1, 1 },
865//{ SMULcc, FCMPDelayCycle.rid, 1, 1 },
866//{ UMULcc, FCMPDelayCycle.rid, 1, 1 },
867//{ SDIVcc, FCMPDelayCycle.rid, 1, 1 },
868//{ UDIVcc, FCMPDelayCycle.rid, 1, 1 },
869 { STD, FCMPDelayCycle.rid, 1, 1 },
870 { FMOVRSZ, FCMPDelayCycle.rid, 1, 1 },
871 { FMOVRSLEZ,FCMPDelayCycle.rid, 1, 1 },
872 { FMOVRSLZ, FCMPDelayCycle.rid, 1, 1 },
873 { FMOVRSNZ, FCMPDelayCycle.rid, 1, 1 },
874 { FMOVRSGZ, FCMPDelayCycle.rid, 1, 1 },
875 { FMOVRSGEZ,FCMPDelayCycle.rid, 1, 1 },
876
877 //
878 // Some instructions are stalled in the GROUP stage if a CTI is in
879 // the E or C stage
880 //
881 { LDD, CTIDelayCycle.rid, 1, 1 },
882//{ LDDA, CTIDelayCycle.rid, 1, 1 },
883//{ LDDSTUB, CTIDelayCycle.rid, 1, 1 },
884//{ LDDSTUBA, CTIDelayCycle.rid, 1, 1 },
885//{ SWAP, CTIDelayCycle.rid, 1, 1 },
886//{ SWAPA, CTIDelayCycle.rid, 1, 1 },
887//{ CAS, CTIDelayCycle.rid, 1, 1 },
888//{ CASA, CTIDelayCycle.rid, 1, 1 },
889//{ CASX, CTIDelayCycle.rid, 1, 1 },
890//{ CASXA, CTIDelayCycle.rid, 1, 1 },
891
892 //
893 // Signed int loads of less than dword size return data in cycle N1 (not C)
894 // and put all loads in consecutive cycles into delayed load return mode.
895 //
896 { LDSB, LdReturn.rid, 2, -1 },
897 { LDSB, LdReturn.rid, 3, 1 },
898
899 { LDSH, LdReturn.rid, 2, -1 },
900 { LDSH, LdReturn.rid, 3, 1 },
901
902 { LDSW, LdReturn.rid, 2, -1 },
903 { LDSW, LdReturn.rid, 3, 1 },
904
905
906#undef EXPLICIT_BUBBLES_NEEDED
907#ifdef EXPLICIT_BUBBLES_NEEDED
908 //
909 // MULScc inserts one bubble.
910 // This means it breaks the current group (captured in UltraSparcSchedInfo)
911 // *and occupies all issue slots for the next cycle
912 //
913//{ MULScc, AllIssueSlots.rid, 2, 2-1 },
914//{ MULScc, AllIssueSlots.rid, 2, 2-1 },
915//{ MULScc, AllIssueSlots.rid, 2, 2-1 },
916//{ MULScc, AllIssueSlots.rid, 2, 2-1 },
917
918 //
919 // SMULcc inserts between 4 and 18 bubbles, depending on #leading 0s in rs1.
920 // We just model this with a simple average.
921 //
922//{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
923//{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
924//{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
925//{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
926
927 // SMULcc inserts between 4 and 19 bubbles, depending on #leading 0s in rs1.
928//{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
929//{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
930//{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
931//{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
932
933 //
934 // MULX inserts between 4 and 34 bubbles, depending on #leading 0s in rs1.
935 //
936 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
937 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
938 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
939 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
940
941 //
942 // SDIVcc inserts 36 bubbles.
943 //
944//{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
945//{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
946//{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
947//{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
948
949 // UDIVcc inserts 37 bubbles.
950//{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
951//{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
952//{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
953//{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
954
955 //
956 // SDIVX inserts 68 bubbles.
957 //
958 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
959 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
960 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
961 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
962
963 //
964 // UDIVX inserts 68 bubbles.
965 //
966 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
967 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
968 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
969 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
970
971 //
972 // WR inserts 4 bubbles.
973 //
974//{ WR, AllIssueSlots.rid, 2, 68-1 },
975//{ WR, AllIssueSlots.rid, 2, 68-1 },
976//{ WR, AllIssueSlots.rid, 2, 68-1 },
977//{ WR, AllIssueSlots.rid, 2, 68-1 },
978
979 //
980 // WRPR inserts 4 bubbles.
981 //
982//{ WRPR, AllIssueSlots.rid, 2, 68-1 },
983//{ WRPR, AllIssueSlots.rid, 2, 68-1 },
984//{ WRPR, AllIssueSlots.rid, 2, 68-1 },
985//{ WRPR, AllIssueSlots.rid, 2, 68-1 },
986
987 //
988 // DONE inserts 9 bubbles.
989 //
990//{ DONE, AllIssueSlots.rid, 2, 9-1 },
991//{ DONE, AllIssueSlots.rid, 2, 9-1 },
992//{ DONE, AllIssueSlots.rid, 2, 9-1 },
993//{ DONE, AllIssueSlots.rid, 2, 9-1 },
994
995 //
996 // RETRY inserts 9 bubbles.
997 //
998//{ RETRY, AllIssueSlots.rid, 2, 9-1 },
999//{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1000//{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1001//{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1002
Chris Lattnere369fcb2001-10-13 06:54:54 +00001003#endif /*EXPLICIT_BUBBLES_NEEDED */
Chris Lattnerc6495ee2001-09-14 03:56:45 +00001004};
1005
1006
1007
1008// Additional delays to be captured in code:
1009// 1. RDPR from several state registers (page 349)
1010// 2. RD from *any* register (page 349)
1011// 3. Writes to TICK, PSTATE, TL registers and FLUSH{W} instr (page 349)
1012// 4. Integer store can be in same group as instr producing value to store.
1013// 5. BICC and BPICC can be in the same group as instr producing CC (pg 350)
1014// 6. FMOVr cannot be in the same or next group as an IEU instr (pg 351).
1015// 7. The second instr. of a CTI group inserts 9 bubbles (pg 351)
1016// 8. WR{PR}, SVAE, SAVED, RESTORE, RESTORED, RETURN, RETRY, and DONE that
1017// follow an annulling branch cannot be issued in the same group or in
1018// the 3 groups following the branch.
1019// 9. A predicted annulled load does not stall dependent instructions.
1020// Other annulled delay slot instructions *do* stall dependents, so
1021// nothing special needs to be done for them during scheduling.
1022//10. Do not put a load use that may be annulled in the same group as the
1023// branch. The group will stall until the load returns.
1024//11. Single-prec. FP loads lock 2 registers, for dependency checking.
1025//
1026//
1027// Additional delays we cannot or will not capture:
1028// 1. If DCTI is last word of cache line, it is delayed until next line can be
1029// fetched. Also, other DCTI alignment-related delays (pg 352)
1030// 2. Load-after-store is delayed by 7 extra cycles if load hits in D-Cache.
1031// Also, several other store-load and load-store conflicts (pg 358)
1032// 3. MEMBAR, LD{X}FSR, LDD{A} and a bunch of other load stalls (pg 358)
1033// 4. There can be at most 8 outstanding buffered store instructions
1034// (including some others like MEMBAR, LDSTUB, CAS{AX}, and FLUSH)
1035
1036
1037
1038//---------------------------------------------------------------------------
1039// class UltraSparcSchedInfo
1040//
1041// Purpose:
1042// Interface to instruction scheduling information for UltraSPARC.
1043// The parameter values above are based on UltraSPARC IIi.
1044//---------------------------------------------------------------------------
1045
1046
1047class UltraSparcSchedInfo: public MachineSchedInfo {
1048public:
1049 /*ctor*/ UltraSparcSchedInfo (const MachineInstrInfo* mii);
1050 /*dtor*/ virtual ~UltraSparcSchedInfo () {}
1051protected:
1052 virtual void initializeResources ();
1053};
1054
Chris Lattnerf6e0e282001-09-14 04:32:55 +00001055
1056//---------------------------------------------------------------------------
1057// class UltraSparcMachine
1058//
1059// Purpose:
1060// Primary interface to machine description for the UltraSPARC.
1061// Primarily just initializes machine-dependent parameters in
1062// class TargetMachine, and creates machine-dependent subclasses
Vikram S. Adve339084b2001-09-18 13:04:24 +00001063// for classes such as InstrInfo, SchedInfo and RegInfo.
Chris Lattnerf6e0e282001-09-14 04:32:55 +00001064//---------------------------------------------------------------------------
1065
1066class UltraSparc : public TargetMachine {
Vikram S. Adve339084b2001-09-18 13:04:24 +00001067private:
1068 UltraSparcInstrInfo instrInfo;
1069 UltraSparcSchedInfo schedInfo;
1070 UltraSparcRegInfo regInfo;
Chris Lattnerf6e0e282001-09-14 04:32:55 +00001071public:
1072 UltraSparc();
1073 virtual ~UltraSparc() {}
Vikram S. Adve339084b2001-09-18 13:04:24 +00001074
Chris Lattner32f600a2001-09-19 13:47:12 +00001075 virtual const MachineInstrInfo &getInstrInfo() const { return instrInfo; }
1076 virtual const MachineSchedInfo &getSchedInfo() const { return schedInfo; }
1077 virtual const MachineRegInfo &getRegInfo() const { return regInfo; }
Vikram S. Adve339084b2001-09-18 13:04:24 +00001078
Chris Lattnerf6e0e282001-09-14 04:32:55 +00001079 // compileMethod - For the sparc, we do instruction selection, followed by
1080 // delay slot scheduling, then register allocation.
1081 //
1082 virtual bool compileMethod(Method *M);
Chris Lattner32f600a2001-09-19 13:47:12 +00001083
1084 //
1085 // emitAssembly - Output assembly language code (a .s file) for the specified
1086 // module. The specified module must have been compiled before this may be
1087 // used.
1088 //
Chris Lattnerec0a95f2001-10-15 15:54:43 +00001089 virtual void emitAssembly(const Module *M, ostream &OutStr) const;
Chris Lattnerf6e0e282001-09-14 04:32:55 +00001090};
1091
1092
Chris Lattnerc6495ee2001-09-14 03:56:45 +00001093#endif