GCC 3.1 changes, finally the burm file builds the FIRST time a clean directory is...
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9Internals.h
1 //***************************************************************************
2 // File:
3 //      SparcInternals.h
4 // 
5 // Purpose:
6 //       This file defines stuff that is to be private to the Sparc
7 //       backend, but is shared among different portions of the backend.
8 //**************************************************************************/
9
10
11 #ifndef SPARC_INTERNALS_H
12 #define SPARC_INTERNALS_H
13
14 #include "llvm/Target/TargetMachine.h"
15 #include "llvm/Target/MachineSchedInfo.h"
16 #include "llvm/Target/MachineFrameInfo.h"
17 #include "llvm/Target/MachineCacheInfo.h"
18 #include "llvm/Target/MachineRegInfo.h"
19 #include "llvm/Type.h"
20 #include <sys/types.h>
21
22 class LiveRange;
23 class UltraSparc;
24 class PhyRegAlloc;
25 class Pass;
26
27 Pass *createPrologEpilogCodeInserter(TargetMachine &TM);
28
29 // OpCodeMask definitions for the Sparc V9
30 // 
31 const OpCodeMask        Immed           = 0x00002000; // immed or reg operand?
32 const OpCodeMask        Annul           = 0x20000000; // annul delay instr?
33 const OpCodeMask        PredictTaken    = 0x00080000; // predict branch taken?
34
35
36 enum SparcInstrSchedClass {
37   SPARC_NONE,           /* Instructions with no scheduling restrictions */
38   SPARC_IEUN,           /* Integer class that can use IEU0 or IEU1 */
39   SPARC_IEU0,           /* Integer class IEU0 */
40   SPARC_IEU1,           /* Integer class IEU1 */
41   SPARC_FPM,            /* FP Multiply or Divide instructions */
42   SPARC_FPA,            /* All other FP instructions */ 
43   SPARC_CTI,            /* Control-transfer instructions */
44   SPARC_LD,             /* Load instructions */
45   SPARC_ST,             /* Store instructions */
46   SPARC_SINGLE,         /* Instructions that must issue by themselves */
47   
48   SPARC_INV,            /* This should stay at the end for the next value */
49   SPARC_NUM_SCHED_CLASSES = SPARC_INV
50 };
51
52
53 //---------------------------------------------------------------------------
54 // enum SparcMachineOpCode. 
55 // const MachineInstrDescriptor SparcMachineInstrDesc[]
56 // 
57 // Purpose:
58 //   Description of UltraSparc machine instructions.
59 // 
60 //---------------------------------------------------------------------------
61
62 enum SparcMachineOpCode {
63 #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
64           NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS)             \
65    ENUM,
66 #include "SparcInstr.def"
67
68   // End-of-array marker
69   INVALID_OPCODE,
70   NUM_REAL_OPCODES = PHI,               // number of valid opcodes
71   NUM_TOTAL_OPCODES = INVALID_OPCODE
72 };
73
74
75 // Array of machine instruction descriptions...
76 extern const MachineInstrDescriptor SparcMachineInstrDesc[];
77
78
79 //---------------------------------------------------------------------------
80 // class UltraSparcInstrInfo 
81 // 
82 // Purpose:
83 //   Information about individual instructions.
84 //   Most information is stored in the SparcMachineInstrDesc array above.
85 //   Other information is computed on demand, and most such functions
86 //   default to member functions in base class MachineInstrInfo. 
87 //---------------------------------------------------------------------------
88
89 class UltraSparcInstrInfo : public MachineInstrInfo {
90 public:
91   /*ctor*/      UltraSparcInstrInfo(const TargetMachine& tgt);
92
93   //
94   // All immediate constants are in position 1 except the
95   // store instructions.
96   // 
97   virtual int getImmedConstantPos(MachineOpCode opCode) const {
98     bool ignore;
99     if (this->maxImmedConstant(opCode, ignore) != 0)
100       {
101         assert(! this->isStore((MachineOpCode) STB - 1)); // 1st  store opcode
102         assert(! this->isStore((MachineOpCode) STXFSR+1));// last store opcode
103         return (opCode >= STB && opCode <= STXFSR)? 2 : 1;
104       }
105     else
106       return -1;
107   }
108   
109   virtual bool          hasResultInterlock      (MachineOpCode opCode) const
110   {
111     // All UltraSPARC instructions have interlocks (note that delay slots
112     // are not considered here).
113     // However, instructions that use the result of an FCMP produce a
114     // 9-cycle stall if they are issued less than 3 cycles after the FCMP.
115     // Force the compiler to insert a software interlock (i.e., gap of
116     // 2 other groups, including NOPs if necessary).
117     return (opCode == FCMPS || opCode == FCMPD || opCode == FCMPQ);
118   }
119
120   //-------------------------------------------------------------------------
121   // Code generation support for creating individual machine instructions
122   //-------------------------------------------------------------------------
123   
124   // Create an instruction sequence to put the constant `val' into
125   // the virtual register `dest'.  `val' may be a Constant or a
126   // GlobalValue, viz., the constant address of a global variable or function.
127   // The generated instructions are returned in `mvec'.
128   // Any temp. registers (TmpInstruction) created are recorded in mcfi.
129   // Any stack space required is allocated via mcff.
130   // 
131   virtual void  CreateCodeToLoadConst(const TargetMachine& target,
132                                       Function* F,
133                                       Value* val,
134                                       Instruction* dest,
135                                       std::vector<MachineInstr*>& mvec,
136                                       MachineCodeForInstruction& mcfi) const;
137
138   // Create an instruction sequence to copy an integer value `val'
139   // to a floating point value `dest' by copying to memory and back.
140   // val must be an integral type.  dest must be a Float or Double.
141   // The generated instructions are returned in `mvec'.
142   // Any temp. registers (TmpInstruction) created are recorded in mcfi.
143   // Any stack space required is allocated via mcff.
144   // 
145   virtual void  CreateCodeToCopyIntToFloat(const TargetMachine& target,
146                                        Function* F,
147                                        Value* val,
148                                        Instruction* dest,
149                                        std::vector<MachineInstr*>& mvec,
150                                        MachineCodeForInstruction& mcfi) const;
151
152   // Similarly, create an instruction sequence to copy an FP value
153   // `val' to an integer value `dest' by copying to memory and back.
154   // The generated instructions are returned in `mvec'.
155   // Any temp. registers (TmpInstruction) created are recorded in mcfi.
156   // Any stack space required is allocated via mcff.
157   // 
158   virtual void  CreateCodeToCopyFloatToInt(const TargetMachine& target,
159                                        Function* F,
160                                        Value* val,
161                                        Instruction* dest,
162                                        std::vector<MachineInstr*>& mvec,
163                                        MachineCodeForInstruction& mcfi) const;
164   
165   // Create instruction(s) to copy src to dest, for arbitrary types
166   // The generated instructions are returned in `mvec'.
167   // Any temp. registers (TmpInstruction) created are recorded in mcfi.
168   // Any stack space required is allocated via mcff.
169   // 
170   virtual void CreateCopyInstructionsByType(const TargetMachine& target,
171                                        Function* F,
172                                        Value* src,
173                                        Instruction* dest,
174                                        std::vector<MachineInstr*>& mvec,
175                                        MachineCodeForInstruction& mcfi) const;
176
177   // Create instruction sequence to produce a sign-extended register value
178   // from an arbitrary sized value (sized in bits, not bytes).
179   // Any stack space required is allocated via mcff.
180   // 
181   virtual void CreateSignExtensionInstructions(const TargetMachine& target,
182                                        Function* F,
183                                        Value* unsignedSrcVal,
184                                        unsigned int srcSizeInBits,
185                                        Value* dest,
186                                        std::vector<MachineInstr*>& mvec,
187                                        MachineCodeForInstruction& mcfi) const;
188 };
189
190
191 //----------------------------------------------------------------------------
192 // class UltraSparcRegInfo
193 //
194 // This class implements the virtual class MachineRegInfo for Sparc.
195 //
196 //----------------------------------------------------------------------------
197
198 class UltraSparcRegInfo : public MachineRegInfo {
199   // The actual register classes in the Sparc
200   //
201   enum RegClassIDs { 
202     IntRegClassID,                      // Integer
203     FloatRegClassID,                    // Float (both single/double)
204     IntCCRegClassID,                    // Int Condition Code
205     FloatCCRegClassID                   // Float Condition code
206   };
207
208
209   // Type of registers available in Sparc. There can be several reg types
210   // in the same class. For instace, the float reg class has Single/Double
211   // types
212   //
213   enum RegTypes {
214     IntRegType,
215     FPSingleRegType,
216     FPDoubleRegType,
217     IntCCRegType,
218     FloatCCRegType
219   };
220
221   // **** WARNING: If the above enum order is changed, also modify 
222   // getRegisterClassOfValue method below since it assumes this particular 
223   // order for efficiency.
224
225
226   // reverse pointer to get info about the ultra sparc machine
227   //
228   const UltraSparc *const UltraSparcInfo;
229
230   // Number of registers used for passing int args (usually 6: %o0 - %o5)
231   //
232   unsigned const NumOfIntArgRegs;
233
234   // Number of registers used for passing float args (usually 32: %f0 - %f31)
235   //
236   unsigned const NumOfFloatArgRegs;
237
238   // An out of bound register number that can be used to initialize register
239   // numbers. Useful for error detection.
240   //
241   int const InvalidRegNum;
242
243
244   // ========================  Private Methods =============================
245
246   // The following methods are used to color special live ranges (e.g.
247   // function args and return values etc.) with specific hardware registers
248   // as required. See SparcRegInfo.cpp for the implementation.
249   //
250   void suggestReg4RetAddr(MachineInstr *RetMI, 
251                           LiveRangeInfo &LRI) const;
252
253   void suggestReg4CallAddr(MachineInstr *CallMI, LiveRangeInfo &LRI,
254                            std::vector<RegClass *> RCList) const;
255   
256   void InitializeOutgoingArg(MachineInstr* CallMI, AddedInstrns *CallAI,
257                              PhyRegAlloc &PRA, LiveRange* LR,
258                              unsigned regType, unsigned RegClassID,
259                              int  UniArgReg, unsigned int argNo,
260                              std::vector<MachineInstr *>& AddedInstrnsBefore)
261     const;
262   
263   // The following 4 methods are used to find the RegType (see enum above)
264   // for a reg class and a given primitive type, a LiveRange, a Value,
265   // or a particular machine register.
266   // The fifth function gives the reg class of the given RegType.
267   // 
268   int getRegType(unsigned regClassID, const Type* type) const;
269   int getRegType(const LiveRange *LR) const;
270   int getRegType(const Value *Val) const;
271   int getRegType(int unifiedRegNum) const;
272
273   // Used to generate a copy instruction based on the register class of
274   // value.
275   //
276   MachineInstr *cpValue2RegMI(Value *Val,  unsigned DestReg,
277                               int RegType) const;
278
279
280   // The following 2 methods are used to order the instructions addeed by
281   // the register allocator in association with function calling. See
282   // SparcRegInfo.cpp for more details
283   //
284   void moveInst2OrdVec(std::vector<MachineInstr *> &OrdVec,
285                        MachineInstr *UnordInst,
286                        PhyRegAlloc &PRA) const;
287
288   void OrderAddedInstrns(std::vector<MachineInstr *> &UnordVec, 
289                          std::vector<MachineInstr *> &OrdVec,
290                          PhyRegAlloc &PRA) const;
291
292
293   // Compute which register can be used for an argument, if any
294   // 
295   int regNumForIntArg(bool inCallee, bool isVarArgsCall,
296                       unsigned argNo, unsigned intArgNo, unsigned fpArgNo,
297                       unsigned& regClassId) const;
298
299   int regNumForFPArg(unsigned RegType, bool inCallee, bool isVarArgsCall,
300                      unsigned argNo, unsigned intArgNo, unsigned fpArgNo,
301                      unsigned& regClassId) const;
302   
303 public:
304   UltraSparcRegInfo(const UltraSparc &tgt);
305
306   // To get complete machine information structure using the machine register
307   // information
308   //
309   inline const UltraSparc &getUltraSparcInfo() const { 
310     return *UltraSparcInfo;
311   }
312
313   // To find the register class used for a specified Type
314   //
315   unsigned getRegClassIDOfType(const Type *type,
316                                bool isCCReg = false) const;
317
318   // To find the register class of a Value
319   //
320   inline unsigned getRegClassIDOfValue(const Value *Val,
321                                        bool isCCReg = false) const {
322     return getRegClassIDOfType(Val->getType(), isCCReg);
323   }
324
325   // To find the register class to which a specified register belongs
326   //
327   unsigned getRegClassIDOfReg(int unifiedRegNum) const;
328   unsigned getRegClassIDOfRegType(int regType) const;
329   
330   // getZeroRegNum - returns the register that contains always zero this is the
331   // unified register number
332   //
333   virtual int getZeroRegNum() const;
334
335   // getCallAddressReg - returns the reg used for pushing the address when a
336   // function is called. This can be used for other purposes between calls
337   //
338   unsigned getCallAddressReg() const;
339
340   // Returns the register containing the return address.
341   // It should be made sure that this  register contains the return 
342   // value when a return instruction is reached.
343   //
344   unsigned getReturnAddressReg() const;
345
346   // Number of registers used for passing int args (usually 6: %o0 - %o5)
347   // and float args (usually 32: %f0 - %f31)
348   //
349   unsigned const GetNumOfIntArgRegs() const   { return NumOfIntArgRegs; }
350   unsigned const GetNumOfFloatArgRegs() const { return NumOfFloatArgRegs; }
351   
352   // The following methods are used to color special live ranges (e.g.
353   // function args and return values etc.) with specific hardware registers
354   // as required. See SparcRegInfo.cpp for the implementation for Sparc.
355   //
356   void suggestRegs4MethodArgs(const Function *Meth, 
357                               LiveRangeInfo& LRI) const;
358
359   void suggestRegs4CallArgs(MachineInstr *CallMI, 
360                             LiveRangeInfo& LRI,
361                             std::vector<RegClass *> RCL) const; 
362
363   void suggestReg4RetValue(MachineInstr *RetMI, 
364                            LiveRangeInfo& LRI) const;
365   
366   void colorMethodArgs(const Function *Meth,  LiveRangeInfo &LRI,
367                        AddedInstrns *FirstAI) const;
368
369   void colorCallArgs(MachineInstr *CallMI, LiveRangeInfo &LRI,
370                      AddedInstrns *CallAI,  PhyRegAlloc &PRA,
371                      const BasicBlock *BB) const;
372
373   void colorRetValue(MachineInstr *RetI,   LiveRangeInfo& LRI,
374                      AddedInstrns *RetAI) const;
375
376
377   // method used for printing a register for debugging purposes
378   //
379   static void printReg(const LiveRange *LR);
380
381   // Each register class has a seperate space for register IDs. To convert
382   // a regId in a register class to a common Id, or vice versa,
383   // we use the folloing methods.
384   //
385   // This method provides a unique number for each register 
386   inline int getUnifiedRegNum(unsigned regClassID, int reg) const {
387     
388     if (regClassID == IntRegClassID) {
389       assert(reg < 32 && "Invalid reg. number");
390       return reg;
391     }
392     else if (regClassID == FloatRegClassID) {
393       assert(reg < 64 && "Invalid reg. number");
394       return reg + 32;                  // we have 32 int regs
395     }
396     else if (regClassID == FloatCCRegClassID) {
397       assert(reg < 4 && "Invalid reg. number");
398       return reg + 32 + 64;             // 32 int, 64 float
399     }
400     else if (regClassID == IntCCRegClassID ) {
401       assert(reg == 0 && "Invalid reg. number");
402       return reg + 4+ 32 + 64;          // only one int CC reg
403     }
404     else if (reg==InvalidRegNum) {
405       return InvalidRegNum;
406     }
407     else  
408       assert(0 && "Invalid register class");
409     return 0;
410   }
411   
412   // This method converts the unified number to the number in its class,
413   // and returns the class ID in regClassID.
414   inline int getClassRegNum(int ureg, unsigned& regClassID) const {
415     if      (ureg < 32)     { regClassID = IntRegClassID;     return ureg;    }
416     else if (ureg < 32+64)  { regClassID = FloatRegClassID;   return ureg-32; }
417     else if (ureg < 4 +96)  { regClassID = FloatCCRegClassID; return ureg-96; }
418     else if (ureg < 1 +100) { regClassID = IntCCRegClassID;   return ureg-100;}
419     else if (ureg == InvalidRegNum) { return InvalidRegNum; }
420     else { assert(0 && "Invalid unified register number"); }
421     return 0;
422   }
423   
424   // Returns the assembly-language name of the specified machine register.
425   //
426   virtual const std::string getUnifiedRegName(int reg) const;
427
428
429   // returns the # of bytes of stack space allocated for each register
430   // type. For Sparc, currently we allocate 8 bytes on stack for all 
431   // register types. We can optimize this later if necessary to save stack
432   // space (However, should make sure that stack alignment is correct)
433   //
434   inline int getSpilledRegSize(int RegType) const {
435     return 8;
436   }
437
438
439   // To obtain the return value and the indirect call address (if any)
440   // contained in a CALL machine instruction
441   //
442   const Value * getCallInstRetVal(const MachineInstr *CallMI) const;
443   const Value * getCallInstIndirectAddrVal(const MachineInstr *CallMI) const;
444
445   // The following methods are used to generate "copy" machine instructions
446   // for an architecture.
447   //
448   // The function regTypeNeedsScratchReg() can be used to check whether a
449   // scratch register is needed to copy a register of type `regType' to
450   // or from memory.  If so, such a scratch register can be provided by
451   // the caller (e.g., if it knows which regsiters are free); otherwise
452   // an arbitrary one will be chosen and spilled by the copy instructions.
453   //
454   bool regTypeNeedsScratchReg(int RegType,
455                               int& scratchRegClassId) const;
456
457   void cpReg2RegMI(std::vector<MachineInstr*>& mvec,
458                    unsigned SrcReg, unsigned DestReg,
459                    int RegType) const;
460
461   void cpReg2MemMI(std::vector<MachineInstr*>& mvec,
462                    unsigned SrcReg, unsigned DestPtrReg,
463                    int Offset, int RegType, int scratchReg = -1) const;
464
465   void cpMem2RegMI(std::vector<MachineInstr*>& mvec,
466                    unsigned SrcPtrReg, int Offset, unsigned DestReg,
467                    int RegType, int scratchReg = -1) const;
468
469   void cpValue2Value(Value *Src, Value *Dest,
470                      std::vector<MachineInstr*>& mvec) const;
471
472   // To see whether a register is a volatile (i.e., whehter it must be
473   // preserved acorss calls)
474   //
475   inline bool isRegVolatile(int RegClassID, int Reg) const {
476     return MachineRegClassArr[RegClassID]->isRegVolatile(Reg);
477   }
478
479
480   virtual unsigned getFramePointer() const;
481   virtual unsigned getStackPointer() const;
482
483   virtual int getInvalidRegNum() const {
484     return InvalidRegNum;
485   }
486
487   // This method inserts the caller saving code for call instructions
488   //
489   void insertCallerSavingCode(std::vector<MachineInstr*>& instrnsBefore,
490                               std::vector<MachineInstr*>& instrnsAfter,
491                               MachineInstr *MInst, 
492                               const BasicBlock *BB, PhyRegAlloc &PRA ) const;
493 };
494
495
496
497
498 //---------------------------------------------------------------------------
499 // class UltraSparcSchedInfo
500 // 
501 // Purpose:
502 //   Interface to instruction scheduling information for UltraSPARC.
503 //   The parameter values above are based on UltraSPARC IIi.
504 //---------------------------------------------------------------------------
505
506
507 class UltraSparcSchedInfo: public MachineSchedInfo {
508 public:
509   UltraSparcSchedInfo(const TargetMachine &tgt);
510 protected:
511   virtual void initializeResources();
512 };
513
514
515 //---------------------------------------------------------------------------
516 // class UltraSparcFrameInfo 
517 // 
518 // Purpose:
519 //   Interface to stack frame layout info for the UltraSPARC.
520 //   Starting offsets for each area of the stack frame are aligned at
521 //   a multiple of getStackFrameSizeAlignment().
522 //---------------------------------------------------------------------------
523
524 class UltraSparcFrameInfo: public MachineFrameInfo {
525 public:
526   UltraSparcFrameInfo(const TargetMachine &tgt) : MachineFrameInfo(tgt) {}
527   
528 public:
529   int  getStackFrameSizeAlignment() const { return StackFrameSizeAlignment;}
530   int  getMinStackFrameSize()       const { return MinStackFrameSize; }
531   int  getNumFixedOutgoingArgs()    const { return NumFixedOutgoingArgs; }
532   int  getSizeOfEachArgOnStack()    const { return SizeOfEachArgOnStack; }
533   bool argsOnStackHaveFixedSize()   const { return true; }
534
535   //
536   // These methods compute offsets using the frame contents for a
537   // particular function.  The frame contents are obtained from the
538   // MachineCodeInfoForMethod object for the given function.
539   // 
540   int getFirstIncomingArgOffset  (MachineCodeForMethod& mcInfo,
541                                   bool& growUp) const
542   {
543     growUp = true;                         // arguments area grows upwards
544     return FirstIncomingArgOffsetFromFP;
545   }
546   int getFirstOutgoingArgOffset  (MachineCodeForMethod& mcInfo,
547                                   bool& growUp) const
548   {
549     growUp = true;                         // arguments area grows upwards
550     return FirstOutgoingArgOffsetFromSP;
551   }
552   int getFirstOptionalOutgoingArgOffset(MachineCodeForMethod& mcInfo,
553                                         bool& growUp)const
554   {
555     growUp = true;                         // arguments area grows upwards
556     return FirstOptionalOutgoingArgOffsetFromSP;
557   }
558   
559   int getFirstAutomaticVarOffset (MachineCodeForMethod& mcInfo,
560                                   bool& growUp) const;
561   int getRegSpillAreaOffset      (MachineCodeForMethod& mcInfo,
562                                   bool& growUp) const;
563   int getTmpAreaOffset           (MachineCodeForMethod& mcInfo,
564                                   bool& growUp) const;
565   int getDynamicAreaOffset       (MachineCodeForMethod& mcInfo,
566                                   bool& growUp) const;
567
568   //
569   // These methods specify the base register used for each stack area
570   // (generally FP or SP)
571   // 
572   virtual int getIncomingArgBaseRegNum()               const {
573     return (int) target.getRegInfo().getFramePointer();
574   }
575   virtual int getOutgoingArgBaseRegNum()               const {
576     return (int) target.getRegInfo().getStackPointer();
577   }
578   virtual int getOptionalOutgoingArgBaseRegNum()       const {
579     return (int) target.getRegInfo().getStackPointer();
580   }
581   virtual int getAutomaticVarBaseRegNum()              const {
582     return (int) target.getRegInfo().getFramePointer();
583   }
584   virtual int getRegSpillAreaBaseRegNum()              const {
585     return (int) target.getRegInfo().getFramePointer();
586   }
587   virtual int getDynamicAreaBaseRegNum()               const {
588     return (int) target.getRegInfo().getStackPointer();
589   }
590   
591 private:
592   // All stack addresses must be offset by 0x7ff (2047) on Sparc V9.
593   static const int OFFSET                                  = (int) 0x7ff;
594   static const int StackFrameSizeAlignment                 =  16;
595   static const int MinStackFrameSize                       = 176;
596   static const int NumFixedOutgoingArgs                    =   6;
597   static const int SizeOfEachArgOnStack                    =   8;
598   static const int StaticAreaOffsetFromFP                  =  0 + OFFSET;
599   static const int FirstIncomingArgOffsetFromFP            = 128 + OFFSET;
600   static const int FirstOptionalIncomingArgOffsetFromFP    = 176 + OFFSET;
601   static const int FirstOutgoingArgOffsetFromSP            = 128 + OFFSET;
602   static const int FirstOptionalOutgoingArgOffsetFromSP    = 176 + OFFSET;
603 };
604
605
606 //---------------------------------------------------------------------------
607 // class UltraSparcCacheInfo 
608 // 
609 // Purpose:
610 //   Interface to cache parameters for the UltraSPARC.
611 //   Just use defaults for now.
612 //---------------------------------------------------------------------------
613
614 class UltraSparcCacheInfo: public MachineCacheInfo {
615 public:
616   UltraSparcCacheInfo(const TargetMachine &T) : MachineCacheInfo(T) {} 
617 };
618
619
620 //---------------------------------------------------------------------------
621 // class UltraSparcMachine 
622 // 
623 // Purpose:
624 //   Primary interface to machine description for the UltraSPARC.
625 //   Primarily just initializes machine-dependent parameters in
626 //   class TargetMachine, and creates machine-dependent subclasses
627 //   for classes such as InstrInfo, SchedInfo and RegInfo. 
628 //---------------------------------------------------------------------------
629
630 class UltraSparc : public TargetMachine {
631 private:
632   UltraSparcInstrInfo instrInfo;
633   UltraSparcSchedInfo schedInfo;
634   UltraSparcRegInfo   regInfo;
635   UltraSparcFrameInfo frameInfo;
636   UltraSparcCacheInfo cacheInfo;
637 public:
638   UltraSparc();
639   
640   virtual const MachineInstrInfo &getInstrInfo() const { return instrInfo; }
641   virtual const MachineSchedInfo &getSchedInfo() const { return schedInfo; }
642   virtual const MachineRegInfo   &getRegInfo()   const { return regInfo; }
643   virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; }
644   virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; }
645
646   //
647   // addPassesToEmitAssembly - Add passes to the specified pass manager to get
648   // assembly langage code emited.  For sparc, we have to do ...
649   //
650   virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
651
652 private:
653   Pass *getFunctionAsmPrinterPass(PassManager &PM, std::ostream &Out);
654   Pass *getModuleAsmPrinterPass(PassManager &PM, std::ostream &Out);
655   Pass *getEmitBytecodeToAsmPass(std::ostream &Out);
656 };
657
658 #endif