llvm.org GIT mirror llvm / 8bdf87d
All targets are now allowed to have their own MachineFunctionInfo objects, also, make getInfo do some checking and cast to the appropriate concrete type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15903 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
1 changed file(s) with 24 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2222
2323 namespace llvm {
2424
25 class Function;
26 class TargetMachine;
27 class SSARegMap;
28 class MachineFrameInfo;
29 class MachineConstantPool;
30
2531 // ilist_traits
2632 template <>
2733 class ilist_traits {
5763 ilist_iterator last);
5864 };
5965
60
61 class Function;
62 class TargetMachine;
63 class SSARegMap;
64 class MachineFrameInfo;
65 class MachineConstantPool;
66 // MachineFunctionInfoBase - This is a gross SparcV9 hack
67 struct MachineFunctionInfoBase { virtual ~MachineFunctionInfoBase() {}; };
68 class MachineFunctionInfo;
66 /// MachineFunctionInfo - This class can be derived from and used by targets to
67 /// hold private target-specific information for each MachineFunction. Objects
68 /// of type are accessed/created with MF::getInfo and destroyed when the
69 /// MachineFunction is destroyed.
70 struct MachineFunctionInfo {
71 virtual ~MachineFunctionInfo() {};
72 };
6973
7074 class MachineFunction : private Annotation {
7175 const Function *Fn;
7781 // Keeping track of mapping from SSA values to registers
7882 SSARegMap *SSARegMapping;
7983
80 // Used to keep track of frame and constant area information for SparcV9 BE.
81 mutable MachineFunctionInfoBase *MFInfo;
84 // Used to keep track of target-specific per-machine function information for
85 // the target implementation.
86 MachineFunctionInfo *MFInfo;
8287
8388 // Keep track of objects allocated on the stack.
8489 MachineFrameInfo *FrameInfo;
123128 /// MachineFunctionInfo - Keep track of various per-function pieces of
124129 /// information for the sparc backend.
125130 ///
126 MachineFunctionInfo *getInfo() const;
131 template
132 Ty *getInfo() {
133 if (!MFInfo) MFInfo = new Ty(*this);
134
135 assert((void*)dynamic_cast(MFInfo) == (void*)MFInfo &&
136 "Invalid concrete type or multiple inheritence for getInfo");
137 return static_cast(MFInfo);
138 }
127139
128140 /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
129141 /// are inserted into the machine function. The block number for a machine