X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FMachineModuleInfo.h;h=b7b90198b1681c004e78eb2c00b4693d2e1ee6f3;hb=75549f4444cbb14e73c8f10ab90ec36c60413e8e;hp=88aba7ee5e4a5b9c388e448080b1bb00dbd5e8cc;hpb=a70e2e3d4831b8a39ea6bae5c62df29fa82a86f3;p=oota-llvm.git diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 88aba7ee5e4..b7b90198b16 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -48,6 +48,7 @@ namespace llvm { //===----------------------------------------------------------------------===// // Forward declarations. class Constant; +class MDNode; class GlobalVariable; class MachineBasicBlock; class MachineFunction; @@ -60,7 +61,8 @@ class StructType; /// to hold private target-specific information for each Module. Objects of /// type are accessed/created with MMI::getInfo and destroyed when the /// MachineModuleInfo is destroyed. -struct MachineModuleInfoImpl { +class MachineModuleInfoImpl { +public: virtual ~MachineModuleInfoImpl(); }; @@ -91,9 +93,10 @@ struct LandingPadInfo { /// schemes and reformated for specific use. /// class MachineModuleInfo : public ImmutablePass { - /// TargetMMI - This is the target-specific implementation of - /// MachineModuleInfoImpl, which lets them accumulate whatever info they want. - MachineModuleInfoImpl *TargetMMI; + /// ObjFileMMI - This is the object-file-format-specific implementation of + /// MachineModuleInfoImpl, which lets targets accumulate whatever info they + /// want. + MachineModuleInfoImpl *ObjFileMMI; // LabelIDList - One entry per assigned label. Normally the entry is equal to // the list index(+1). If the entry is zero then the label has been deleted. @@ -140,9 +143,13 @@ class MachineModuleInfo : public ImmutablePass { /// DbgInfoAvailable - True if debugging information is available /// in this module. bool DbgInfoAvailable; + public: static char ID; // Pass identification, replacement for typeid + typedef DenseMap > VariableDbgInfoMapTy; + VariableDbgInfoMapTy VariableDbgInfo; + MachineModuleInfo(); ~MachineModuleInfo(); @@ -151,7 +158,7 @@ public: /// BeginFunction - Begin gathering function meta information. /// - void BeginFunction(MachineFunction *MF); + void BeginFunction(MachineFunction *) {} /// EndFunction - Discard function meta information. /// @@ -161,18 +168,18 @@ public: /// backends that would like to do so. /// template - Ty *getInfo() { - if (TargetMMI == 0) - TargetMMI = new Ty(*this); + Ty &getObjFileInfo() { + if (ObjFileMMI == 0) + ObjFileMMI = new Ty(*this); - assert((void*)dynamic_cast(TargetMMI) == (void*)TargetMMI && + assert((void*)dynamic_cast(ObjFileMMI) == (void*)ObjFileMMI && "Invalid concrete type or multiple inheritence for getInfo"); - return static_cast(TargetMMI); + return *static_cast(ObjFileMMI); } template - const Ty *getInfo() const { - return const_cast(this)->getInfo(); + const Ty &getObjFileInfo() const { + return const_cast(this)->getObjFileInfo(); } /// AnalyzeModule - Scan the module for global debug information. @@ -323,6 +330,15 @@ public: /// of one is required to emit exception handling info. Function *getPersonality() const; + /// setVariableDbgInfo - Collect information used to emit debugging information + /// of a variable. + void setVariableDbgInfo(MDNode *N, MDNode *L, unsigned S) { + if (N && L) + VariableDbgInfo[N] = std::make_pair(L, S); + } + + VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; } + }; // End class MachineModuleInfo } // End llvm namespace