//===----------------------------------------------------------------------===//
// Forward declarations.
class Constant;
+class MDNode;
class GlobalVariable;
class MachineBasicBlock;
class MachineFunction;
/// 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();
};
/// 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.
/// DbgInfoAvailable - True if debugging information is available
/// in this module.
bool DbgInfoAvailable;
+
public:
static char ID; // Pass identification, replacement for typeid
+ typedef DenseMap<MDNode *, std::pair<MDNode *, unsigned> > VariableDbgInfoMapTy;
+ VariableDbgInfoMapTy VariableDbgInfo;
+
MachineModuleInfo();
~MachineModuleInfo();
/// BeginFunction - Begin gathering function meta information.
///
- void BeginFunction(MachineFunction *MF);
+ void BeginFunction(MachineFunction *) {}
/// EndFunction - Discard function meta information.
///
/// backends that would like to do so.
///
template<typename Ty>
- Ty *getInfo() {
- if (TargetMMI == 0)
- TargetMMI = new Ty(*this);
+ Ty &getObjFileInfo() {
+ if (ObjFileMMI == 0)
+ ObjFileMMI = new Ty(*this);
- assert((void*)dynamic_cast<Ty*>(TargetMMI) == (void*)TargetMMI &&
+ assert((void*)dynamic_cast<Ty*>(ObjFileMMI) == (void*)ObjFileMMI &&
"Invalid concrete type or multiple inheritence for getInfo");
- return static_cast<Ty*>(TargetMMI);
+ return *static_cast<Ty*>(ObjFileMMI);
}
template<typename Ty>
- const Ty *getInfo() const {
- return const_cast<MachineModuleInfo*>(this)->getInfo<Ty>();
+ const Ty &getObjFileInfo() const {
+ return const_cast<MachineModuleInfo*>(this)->getObjFileInfo<Ty>();
}
/// AnalyzeModule - Scan the module for global debug information.
/// 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