diff --git a/include/llvm/CodeGen/MachineDebugInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h similarity index 96% rename from include/llvm/CodeGen/MachineDebugInfo.h rename to include/llvm/CodeGen/MachineModuleInfo.h index 1676f6b85b3..a1c69083be1 100644 --- a/include/llvm/CodeGen/MachineDebugInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/MachineDebugInfo.h -------------------------*- C++ -*-===// +//===-- llvm/CodeGen/MachineModuleInfo.h ------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,14 +7,15 @@ // //===----------------------------------------------------------------------===// // -// Collect debug information for a module. This information should be in a -// neutral form that can be used by different debugging schemes. +// Collect meta information for a module. This information should be in a +// neutral form that can be used by different debugging and exception handling +// schemes. // // The organization of information is primarily clustered around the source // compile units. The main exception is source line correspondence where // inlining may interleave code from various compile units. // -// The following information can be retrieved from the MachineDebugInfo. +// The following information can be retrieved from the MachineModuleInfo. // // -- Source directories - Directories are uniqued based on their canonical // string and assigned a sequential numeric ID (base 1.) @@ -27,8 +28,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H -#define LLVM_CODEGEN_MACHINEDEBUGINFO_H +#ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H +#define LLVM_CODEGEN_MACHINEMODULEINFO_H #include "llvm/Support/Dwarf.h" #include "llvm/Support/DataTypes.h" @@ -948,11 +949,11 @@ public: }; //===----------------------------------------------------------------------===// -/// MachineDebugInfo - This class contains debug information specific to a -/// module. Queries can be made by different debugging schemes and reformated -/// for specific use. +/// MachineModuleInfo - This class contains meta information specific to a +/// module. Queries can be made by different debugging and exception handling +/// schemes and reformated for specific use. /// -class MachineDebugInfo : public ImmutablePass { +class MachineModuleInfo : public ImmutablePass { private: // Use the same deserializer/verifier for the module. DIDeserializer DR; @@ -984,26 +985,26 @@ private: DebugScope *RootScope; // FrameMoves - List of moves done by a function's prolog. Used to construct - // frame maps by debug consumers. + // frame maps by debug and exception handling consumers. std::vector FrameMoves; public: - MachineDebugInfo(); - ~MachineDebugInfo(); + MachineModuleInfo(); + ~MachineModuleInfo(); - /// doInitialization - Initialize the debug state for a new module. + /// doInitialization - Initialize the state for a new module. /// bool doInitialization(); - /// doFinalization - Tear down the debug state after completion of a module. + /// doFinalization - Tear down the state after completion of a module. /// bool doFinalization(); - /// BeginFunction - Begin gathering function debug information. + /// BeginFunction - Begin gathering function meta information. /// void BeginFunction(MachineFunction *MF); - /// EndFunction - Discard function debug information. + /// EndFunction - Discard function meta information. /// void EndFunction(); @@ -1020,9 +1021,9 @@ public: /// void AnalyzeModule(Module &M); - /// hasInfo - Returns true if valid debug info is present. + /// hasDebugInfo - Returns true if valid debug info is present. /// - bool hasInfo() const { return !CompileUnits.empty(); } + bool hasDebugInfo() const { return !CompileUnits.empty(); } /// NextLabelID - Return the next unique label id. /// @@ -1033,12 +1034,12 @@ public: } /// RecordLabel - Records location information and associates it with a - /// debug label. Returns a unique label ID used to generate a label and + /// label. Returns a unique label ID used to generate a label and /// provide correspondence to the source line list. unsigned RecordLabel(unsigned Line, unsigned Column, unsigned Source); /// InvalidateLabel - Inhibit use of the specified label # from - /// MachineDebugInfo, for example because the code was deleted. + /// MachineModuleInfo, for example because the code was deleted. void InvalidateLabel(unsigned LabelID) { // Remap to zero to indicate deletion. RemapLabel(LabelID, 0); @@ -1048,9 +1049,9 @@ public: /// void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) { assert(0 < OldLabelID && OldLabelID <= LabelIDList.size() && - "Old debug label ID out of range."); + "Old label ID out of range."); assert(NewLabelID <= LabelIDList.size() && - "New debug label ID out of range."); + "New label ID out of range."); LabelIDList[OldLabelID - 1] = NewLabelID; } @@ -1144,10 +1145,11 @@ public: DebugScope *getOrCreateScope(DebugInfoDesc *ScopeDesc); /// getFrameMoves - Returns a reference to a list of moves done in the current - /// function's prologue. Used to construct frame maps for debug comsumers. + /// function's prologue. Used to construct frame maps for debug and exception + /// handling comsumers. std::vector &getFrameMoves() { return FrameMoves; } -}; // End class MachineDebugInfo +}; // End class MachineModuleInfo } // End llvm namespace diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp similarity index 95% rename from lib/CodeGen/MachineDebugInfo.cpp rename to lib/CodeGen/MachineModuleInfo.cpp index 45e7fa2a6b1..065d6cf295e 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/MachineDebugInfo.cpp -----------------------*- C++ -*-===// +//===-- llvm/CodeGen/MachineModuleInfo.cpp ----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/CodeGen/MachineDebugInfo.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Constants.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -27,7 +27,7 @@ using namespace llvm::dwarf; // Handle the Pass registration stuff necessary to use TargetData's. namespace { - RegisterPass X("machinedebuginfo", "Debug Information"); + RegisterPass X("machinemoduleinfo", "Module Information"); } //===----------------------------------------------------------------------===// @@ -1460,7 +1460,7 @@ DebugScope::~DebugScope() { //===----------------------------------------------------------------------===// -MachineDebugInfo::MachineDebugInfo() +MachineModuleInfo::MachineModuleInfo() : DR() , VR() , CompileUnits() @@ -1472,31 +1472,31 @@ MachineDebugInfo::MachineDebugInfo() , RootScope(NULL) , FrameMoves() {} -MachineDebugInfo::~MachineDebugInfo() { +MachineModuleInfo::~MachineModuleInfo() { } -/// doInitialization - Initialize the debug state for a new module. +/// doInitialization - Initialize the state for a new module. /// -bool MachineDebugInfo::doInitialization() { +bool MachineModuleInfo::doInitialization() { return false; } -/// doFinalization - Tear down the debug state after completion of a module. +/// doFinalization - Tear down the state after completion of a module. /// -bool MachineDebugInfo::doFinalization() { +bool MachineModuleInfo::doFinalization() { return false; } -/// BeginFunction - Begin gathering function debug information. +/// BeginFunction - Begin gathering function meta information. /// -void MachineDebugInfo::BeginFunction(MachineFunction *MF) { +void MachineModuleInfo::BeginFunction(MachineFunction *MF) { // Coming soon. } -/// MachineDebugInfo::EndFunction - Discard function debug information. +/// EndFunction - Discard function meta information. /// -void MachineDebugInfo::EndFunction() { +void MachineModuleInfo::EndFunction() { // Clean up scope information. if (RootScope) { delete RootScope; @@ -1511,25 +1511,25 @@ void MachineDebugInfo::EndFunction() { /// getDescFor - Convert a Value to a debug information descriptor. /// // FIXME - use new Value type when available. -DebugInfoDesc *MachineDebugInfo::getDescFor(Value *V) { +DebugInfoDesc *MachineModuleInfo::getDescFor(Value *V) { return DR.Deserialize(V); } /// Verify - Verify that a Value is debug information descriptor. /// -bool MachineDebugInfo::Verify(Value *V) { +bool MachineModuleInfo::Verify(Value *V) { return VR.Verify(V); } /// AnalyzeModule - Scan the module for global debug information. /// -void MachineDebugInfo::AnalyzeModule(Module &M) { +void MachineModuleInfo::AnalyzeModule(Module &M) { SetupCompileUnits(M); } /// SetupCompileUnits - Set up the unique vector of compile units. /// -void MachineDebugInfo::SetupCompileUnits(Module &M) { +void MachineModuleInfo::SetupCompileUnits(Module &M) { std::vectorCU = getAnchoredDescriptors(M); for (unsigned i = 0, N = CU.size(); i < N; i++) { @@ -1539,22 +1539,22 @@ void MachineDebugInfo::SetupCompileUnits(Module &M) { /// getCompileUnits - Return a vector of debug compile units. /// -const UniqueVector MachineDebugInfo::getCompileUnits()const{ +const UniqueVector MachineModuleInfo::getCompileUnits()const{ return CompileUnits; } /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. std::vector -MachineDebugInfo::getGlobalVariablesUsing(Module &M, - const std::string &RootName) { +MachineModuleInfo::getGlobalVariablesUsing(Module &M, + const std::string &RootName) { return ::getGlobalVariablesUsing(M, RootName); } /// RecordLabel - Records location information and associates it with a /// debug label. Returns a unique label ID used to generate a label and /// provide correspondence to the source line list. -unsigned MachineDebugInfo::RecordLabel(unsigned Line, unsigned Column, +unsigned MachineModuleInfo::RecordLabel(unsigned Line, unsigned Column, unsigned Source) { unsigned ID = NextLabelID(); Lines.push_back(SourceLineInfo(Line, Column, Source, ID)); @@ -1563,19 +1563,19 @@ unsigned MachineDebugInfo::RecordLabel(unsigned Line, unsigned Column, /// RecordSource - Register a source file with debug info. Returns an source /// ID. -unsigned MachineDebugInfo::RecordSource(const std::string &Directory, - const std::string &Source) { +unsigned MachineModuleInfo::RecordSource(const std::string &Directory, + const std::string &Source) { unsigned DirectoryID = Directories.insert(Directory); return SourceFiles.insert(SourceFileInfo(DirectoryID, Source)); } -unsigned MachineDebugInfo::RecordSource(const CompileUnitDesc *CompileUnit) { +unsigned MachineModuleInfo::RecordSource(const CompileUnitDesc *CompileUnit) { return RecordSource(CompileUnit->getDirectory(), CompileUnit->getFileName()); } /// RecordRegionStart - Indicate the start of a region. /// -unsigned MachineDebugInfo::RecordRegionStart(Value *V) { +unsigned MachineModuleInfo::RecordRegionStart(Value *V) { // FIXME - need to be able to handle split scopes because of bb cloning. DebugInfoDesc *ScopeDesc = DR.Deserialize(V); DebugScope *Scope = getOrCreateScope(ScopeDesc); @@ -1586,7 +1586,7 @@ unsigned MachineDebugInfo::RecordRegionStart(Value *V) { /// RecordRegionEnd - Indicate the end of a region. /// -unsigned MachineDebugInfo::RecordRegionEnd(Value *V) { +unsigned MachineModuleInfo::RecordRegionEnd(Value *V) { // FIXME - need to be able to handle split scopes because of bb cloning. DebugInfoDesc *ScopeDesc = DR.Deserialize(V); DebugScope *Scope = getOrCreateScope(ScopeDesc); @@ -1597,7 +1597,7 @@ unsigned MachineDebugInfo::RecordRegionEnd(Value *V) { /// RecordVariable - Indicate the declaration of a local variable. /// -void MachineDebugInfo::RecordVariable(Value *V, unsigned FrameIndex) { +void MachineModuleInfo::RecordVariable(Value *V, unsigned FrameIndex) { VariableDesc *VD = cast(DR.Deserialize(V)); DebugScope *Scope = getOrCreateScope(VD->getContext()); DebugVariable *DV = new DebugVariable(VD, FrameIndex); @@ -1606,7 +1606,7 @@ void MachineDebugInfo::RecordVariable(Value *V, unsigned FrameIndex) { /// getOrCreateScope - Returns the scope associated with the given descriptor. /// -DebugScope *MachineDebugInfo::getOrCreateScope(DebugInfoDesc *ScopeDesc) { +DebugScope *MachineModuleInfo::getOrCreateScope(DebugInfoDesc *ScopeDesc) { DebugScope *&Slot = ScopeMap[ScopeDesc]; if (!Slot) { // FIXME - breaks down when the context is an inlined function. @@ -1631,21 +1631,21 @@ DebugScope *MachineDebugInfo::getOrCreateScope(DebugInfoDesc *ScopeDesc) { } //===----------------------------------------------------------------------===// -/// DebugLabelFolding pass - This pass prunes out redundant debug labels. This -/// allows a debug emitter to determine if the range of two labels is empty, -/// by seeing if the labels map to the same reduced label. +/// DebugLabelFolding pass - This pass prunes out redundant labels. This allows +/// a info consumer to determine if the range of two labels is empty, by seeing +/// if the labels map to the same reduced label. namespace llvm { struct DebugLabelFolder : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); - virtual const char *getPassName() const { return "Debug Label Folder"; } + virtual const char *getPassName() const { return "Label Folder"; } }; bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { - // Get machine debug info. - MachineDebugInfo *MDI = getAnalysisToUpdate(); - if (!MDI) return false; + // Get machine module info. + MachineModuleInfo *MMI = getAnalysisToUpdate(); + if (!MMI) return false; // Get target instruction info. const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); if (!TII) return false; @@ -1660,7 +1660,7 @@ bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { BB != E; ++BB) { // Iterate through instructions. for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { - // Is it a debug label. + // Is it a label. if ((unsigned)I->getOpcode() == TargetInstrInfo::LABEL) { // The label ID # is always operand #0, an immediate. unsigned NextLabel = I->getOperand(0).getImm(); @@ -1668,7 +1668,7 @@ bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { // If there was an immediate prior label. if (PriorLabel) { // Remap the current label to prior label. - MDI->RemapLabel(NextLabel, PriorLabel); + MMI->RemapLabel(NextLabel, PriorLabel); // Delete the current label. I = BB->erase(I); // Indicate a change has been made.