diff options
Diffstat (limited to 'include/llvm/CodeGen/MachineDebugInfo.h')
-rw-r--r-- | include/llvm/CodeGen/MachineDebugInfo.h | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/MachineDebugInfo.h b/include/llvm/CodeGen/MachineDebugInfo.h index 39b2464072..7b6386730b 100644 --- a/include/llvm/CodeGen/MachineDebugInfo.h +++ b/include/llvm/CodeGen/MachineDebugInfo.h @@ -969,8 +969,11 @@ private: // Lines - List of of source line correspondence. std::vector<SourceLineInfo> Lines; - // LabelID - Current number assigned to unique label numbers. - unsigned LabelID; + // 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. + // Any other value indicates the label has been deleted by is mapped to + // another label. + std::vector<unsigned> LabelIDList; // ScopeMap - Tracks the scopes in the current function. std::map<DebugInfoDesc *, DebugScope *> ScopeMap; @@ -979,10 +982,6 @@ private: // DebugScope *RootScope; - // DeletedLabelIDs - Sorted list of label IDs that have been removed from the - // module. - std::vector<unsigned> DeletedLabelIDs; - // FrameMoves - List of moves done by a function's prolog. Used to construct // frame maps by debug consumers. std::vector<MachineMove *> FrameMoves; @@ -1026,7 +1025,11 @@ public: /// NextLabelID - Return the next unique label id. /// - unsigned NextLabelID() { return ++LabelID; } + unsigned NextLabelID() { + unsigned ID = LabelIDList.size() + 1; + LabelIDList.push_back(ID); + return ID; + } /// RecordLabel - Records location information and associates it with a /// debug label. Returns a unique label ID used to generate a label and @@ -1035,11 +1038,22 @@ public: /// InvalidateLabel - Inhibit use of the specified label # from /// MachineDebugInfo, for example because the code was deleted. - void InvalidateLabel(unsigned LabelID); + void InvalidateLabel(unsigned LabelID) { + // Remap to zero to indicate deletion. + RemapLabel(LabelID, 0); + } + + /// RemapLabel - Indicate that a label has been merged into another. + /// + void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) { + LabelIDList[OldLabelID - 1] = NewLabelID; + } - /// isLabelValid - Check to make sure the label is still valid before - /// attempting to use. - bool isLabelValid(unsigned LabelID); + /// MappedLabel - Find out the label's final ID. Zero indicates deletion. + /// ID != Mapped ID indicates that the label was folded into another label. + unsigned MappedLabel(unsigned LabelID) const { + return LabelIDList[LabelID - 1]; + } /// RecordSource - Register a source file with debug info. Returns an source /// ID. |