llvm.org GIT mirror llvm / a70e2e3
add hooks to hang target-specific goop off MachineModuleInfo, move MachineFunctionInfo virtual method out of line to give it a home. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81940 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
4 changed file(s) with 47 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
6262 /// of type are accessed/created with MF::getInfo and destroyed when the
6363 /// MachineFunction is destroyed.
6464 struct MachineFunctionInfo {
65 virtual ~MachineFunctionInfo() {}
65 virtual ~MachineFunctionInfo();
6666 };
6767
6868 class MachineFunction {
158158 ///
159159 void setAlignment(unsigned A) { Alignment = A; }
160160
161 /// MachineFunctionInfo - Keep track of various per-function pieces of
162 /// information for backends that would like to do so.
161 /// getInfo - Keep track of various per-function pieces of information for
162 /// backends that would like to do so.
163163 ///
164164 template
165165 Ty *getInfo() {
5353 class Module;
5454 class PointerType;
5555 class StructType;
56
57
58 /// MachineModuleInfoImpl - This class can be derived from and used by targets
59 /// to hold private target-specific information for each Module. Objects of
60 /// type are accessed/created with MMI::getInfo and destroyed when the
61 /// MachineModuleInfo is destroyed.
62 struct MachineModuleInfoImpl {
63 virtual ~MachineModuleInfoImpl();
64 };
65
66
5667
5768 //===----------------------------------------------------------------------===//
5869 /// LandingPadInfo - This structure is used to retain landing pad info for
7990 /// schemes and reformated for specific use.
8091 ///
8192 class MachineModuleInfo : public ImmutablePass {
82 private:
93 /// TargetMMI - This is the target-specific implementation of
94 /// MachineModuleInfoImpl, which lets them accumulate whatever info they want.
95 MachineModuleInfoImpl *TargetMMI;
96
8397 // LabelIDList - One entry per assigned label. Normally the entry is equal to
8498 // the list index(+1). If the entry is zero then the label has been deleted.
8599 // Any other value indicates the label has been deleted by is mapped to
131145 MachineModuleInfo();
132146 ~MachineModuleInfo();
133147
134 /// doInitialization - Initialize the state for a new module.
135 ///
136148 bool doInitialization();
137
138 /// doFinalization - Tear down the state after completion of a module.
139 ///
140149 bool doFinalization();
141
150
142151 /// BeginFunction - Begin gathering function meta information.
143152 ///
144153 void BeginFunction(MachineFunction *MF);
147156 ///
148157 void EndFunction();
149158
159 /// getInfo - Keep track of various per-function pieces of information for
160 /// backends that would like to do so.
161 ///
162 template
163 Ty *getInfo() {
164 if (TargetMMI == 0)
165 TargetMMI = new Ty(*this);
166
167 assert((void*)dynamic_cast(TargetMMI) == (void*)TargetMMI &&
168 "Invalid concrete type or multiple inheritence for getInfo");
169 return static_cast(TargetMMI);
170 }
171
172 template
173 const Ty *getInfo() const {
174 return const_cast(this)->getInfo();
175 }
176
150177 /// AnalyzeModule - Scan the module for global debug information.
151178 ///
152179 void AnalyzeModule(Module &M);
7272 // MachineFunction implementation
7373 //===---------------------------------------------------------------------===//
7474
75 // Out of line virtual method.
76 MachineFunctionInfo::~MachineFunctionInfo() {}
77
7578 void ilist_traits::deleteNode(MachineBasicBlock *MBB) {
7679 MBB->getParent()->DeleteMachineBasicBlock(MBB);
7780 }
3131 X("machinemoduleinfo", "Module Information");
3232 char MachineModuleInfo::ID = 0;
3333
34 // Out of line virtual method.
35 MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
36
3437 //===----------------------------------------------------------------------===//
3538
3639 MachineModuleInfo::MachineModuleInfo()
3740 : ImmutablePass(&ID)
38 , LabelIDList()
39 , FrameMoves()
40 , LandingPads()
41 , Personalities()
41 , TargetMMI(0)
4242 , CallsEHReturn(0)
4343 , CallsUnwindInit(0)
44 , DbgInfoAvailable(false)
45 {
44 , DbgInfoAvailable(false) {
4645 // Always emit some info, by default "no personality" info.
4746 Personalities.push_back(NULL);
4847 }
48
4949 MachineModuleInfo::~MachineModuleInfo() {
50
50 delete TargetMMI;
5151 }
5252
5353 /// doInitialization - Initialize the state for a new module.