Remove dead member variables of SparcV9SchedInfo and TargetSchedInfo
[oota-llvm.git] / lib / Target / SparcV9 / MachineInstrAnnot.h
1 //===-- llvm/CodeGen/MachineInstrAnnot.h ------------------------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 //  Annotations used to pass information between code generation phases.
11 // 
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MACHINE_INSTR_ANNOT_h
15 #define MACHINE_INSTR_ANNOT_h
16
17 #include "llvm/CodeGen/MachineInstr.h"
18 #include "llvm/Target/TargetRegInfo.h"
19
20 namespace llvm {
21
22 class Value;
23 class TmpInstruction;
24 class CallInst;
25
26 class CallArgInfo {
27   // Flag values for different argument passing methods
28   static const unsigned char IntArgReg = 0x1;
29   static const unsigned char FPArgReg  = 0x2;
30   static const unsigned char StackSlot = 0x4;
31   
32   Value*        argVal;         // this argument
33   int           argCopyReg;     // register used for second copy of arg. when
34                                 // multiple  copies must be passed in registers
35   unsigned char passingMethod;  // flags recording passing methods
36   
37 public:
38   // Constructors
39   CallArgInfo(Value* _argVal)
40     : argVal(_argVal), argCopyReg(TargetRegInfo::getInvalidRegNum()),
41       passingMethod(0x0) {}
42   
43   CallArgInfo(const CallArgInfo& obj)
44     : argVal(obj.argVal), argCopyReg(obj.argCopyReg),
45       passingMethod(obj.passingMethod) {}
46   
47   // Accessor methods
48   Value*        getArgVal()       { return argVal; }
49   int           getArgCopy()      { return argCopyReg; }
50   bool          usesIntArgReg()   { return (bool) (passingMethod & IntArgReg);} 
51   bool          usesFPArgReg()    { return (bool) (passingMethod & FPArgReg); } 
52   bool          usesStackSlot()   { return (bool) (passingMethod & StackSlot);} 
53   
54   // Modifier methods
55   void          replaceArgVal(Value* newVal) { argVal = newVal; }
56   void          setUseIntArgReg() { passingMethod |= IntArgReg; }
57   void          setUseFPArgReg()  { passingMethod |= FPArgReg; }
58   void          setUseStackSlot() { passingMethod |= StackSlot; }
59   void          setArgCopy(int copyReg) { argCopyReg = copyReg; }
60 };
61
62
63 class CallArgsDescriptor {
64
65   std::vector<CallArgInfo> argInfoVec;  // Descriptor for each argument
66   CallInst* callInstr;                  // The call instruction == result value
67   Value* funcPtr;                       // Pointer for indirect calls 
68   TmpInstruction* retAddrReg;           // Tmp value for return address reg.
69   bool isVarArgs;                       // Is this a varargs call?
70   bool noPrototype;                     // Is this a call with no prototype?
71   
72 public:
73   CallArgsDescriptor(CallInst* _callInstr, TmpInstruction* _retAddrReg,
74                      bool _isVarArgs, bool _noPrototype);
75   
76   // Accessor methods to retrieve information about the call
77   // Note that operands are numbered 1..#CallArgs
78   unsigned int    getNumArgs() const          { return argInfoVec.size(); }
79   CallArgInfo&    getArgInfo(unsigned int op) { assert(op < argInfoVec.size());
80                                                 return argInfoVec[op]; }
81   CallInst*       getCallInst() const         { return callInstr; }
82   CallInst*       getReturnValue() const;
83   Value*          getIndirectFuncPtr() const  { return funcPtr; }
84   TmpInstruction* getReturnAddrReg() const    { return retAddrReg; }
85   bool            isVarArgsFunc() const       { return isVarArgs; }
86   bool            hasNoPrototype() const      { return noPrototype; }
87
88   // Mechanism to get the descriptor for a CALL MachineInstr.
89   // 
90   static CallArgsDescriptor *get(const MachineInstr* MI);
91 };
92
93 } // End llvm namespace
94
95 #endif