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