diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-14 01:41:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-14 01:41:15 +0000 |
commit | 1611273351d75b5cbe2a67485bb9831d5916fe26 (patch) | |
tree | 0fa59fecf1480ead468d8c2208a8a95ae2e2e875 /include | |
parent | bf2d4c034da3a0109175d1c48c2c898b496a18b9 (diff) | |
download | external_llvm-1611273351d75b5cbe2a67485bb9831d5916fe26.zip external_llvm-1611273351d75b5cbe2a67485bb9831d5916fe26.tar.gz external_llvm-1611273351d75b5cbe2a67485bb9831d5916fe26.tar.bz2 |
change EH related stuff (other than EH_LABEL) to use MCSymbol
instead of label ID's. This cleans up and regularizes a bunch
of code and makes way for future progress.
Unfortunately, this pointed out to me that JITDwarfEmitter.cpp
is largely copy and paste from DwarfException/MachineModuleInfo
and other places. This is very sad and disturbing. :(
One major change here is that TidyLandingPads moved from being
called in DwarfException::BeginFunction to being called in
DwarfException::EndFunction. There should not be any
functionality change from doing this, but I'm not an EH expert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/JITCodeEmitter.h | 10 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineCodeEmitter.h | 7 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfo.h | 30 | ||||
-rw-r--r-- | include/llvm/CodeGen/ObjectCodeEmitter.h | 7 |
4 files changed, 24 insertions, 30 deletions
diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h index 0a1d4f4..5da4961 100644 --- a/include/llvm/CodeGen/JITCodeEmitter.h +++ b/include/llvm/CodeGen/JITCodeEmitter.h @@ -35,7 +35,7 @@ class MachineRelocation; class Value; class GlobalValue; class Function; - + /// JITCodeEmitter - This class defines two sorts of methods: those for /// emitting the actual bytes of machine code, and those for emitting auxillary /// structures, such as jump tables, relocations, etc. @@ -242,7 +242,7 @@ public: /// emitLabel - Emits a label - virtual void emitLabel(uint64_t LabelID) = 0; + virtual void emitLabel(MCSymbol *Label) = 0; /// allocateSpace - Allocate a block of space in the current output buffer, /// returning null (and setting conditions to indicate buffer overflow) on @@ -316,10 +316,10 @@ public: /// virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const= 0; - /// getLabelAddress - Return the address of the specified LabelID, only usable - /// after the LabelID has been emitted. + /// getLabelAddress - Return the address of the specified Label, only usable + /// after the Label has been emitted. /// - virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0; + virtual uintptr_t getLabelAddress(MCSymbol *Label) const = 0; /// Specifies the MachineModuleInfo object. This is used for exception handling /// purposes. diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h index 48b4082..7abb49a 100644 --- a/include/llvm/CodeGen/MachineCodeEmitter.h +++ b/include/llvm/CodeGen/MachineCodeEmitter.h @@ -31,6 +31,7 @@ class MachineRelocation; class Value; class GlobalValue; class Function; +class MCSymbol; /// MachineCodeEmitter - This class defines two sorts of methods: those for /// emitting the actual bytes of machine code, and those for emitting auxillary @@ -247,7 +248,7 @@ public: virtual void processDebugLoc(DebugLoc DL, bool BeforePrintintInsn) {} /// emitLabel - Emits a label - virtual void emitLabel(uint64_t LabelID) = 0; + virtual void emitLabel(MCSymbol *Label) = 0; /// allocateSpace - Allocate a block of space in the current output buffer, /// returning null (and setting conditions to indicate buffer overflow) on @@ -316,10 +317,10 @@ public: /// virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const= 0; - /// getLabelAddress - Return the address of the specified LabelID, only usable + /// getLabelAddress - Return the address of the specified Label, only usable /// after the LabelID has been emitted. /// - virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0; + virtual uintptr_t getLabelAddress(MCSymbol *Label) const = 0; /// Specifies the MachineModuleInfo object. This is used for exception handling /// purposes. diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 3ad91ad..b4b6418 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -77,18 +77,15 @@ protected: /// the current function. /// struct LandingPadInfo { - MachineBasicBlock *LandingPadBlock; // Landing pad block. - SmallVector<unsigned, 1> BeginLabels; // Labels prior to invoke. - SmallVector<unsigned, 1> EndLabels; // Labels after invoke. - unsigned LandingPadLabel; // Label at beginning of landing pad. - Function *Personality; // Personality function. - std::vector<int> TypeIds; // List of type ids (filters negative) + MachineBasicBlock *LandingPadBlock; // Landing pad block. + SmallVector<MCSymbol*, 1> BeginLabels; // Labels prior to invoke. + SmallVector<MCSymbol*, 1> EndLabels; // Labels after invoke. + MCSymbol *LandingPadLabel; // Label at beginning of landing pad. + Function *Personality; // Personality function. + std::vector<int> TypeIds; // List of type ids (filters negative) explicit LandingPadInfo(MachineBasicBlock *MBB) - : LandingPadBlock(MBB) - , LandingPadLabel(0) - , Personality(NULL) - {} + : LandingPadBlock(MBB), LandingPadLabel(0), Personality(0) {} }; //===----------------------------------------------------------------------===// @@ -121,7 +118,7 @@ class MachineModuleInfo : public ImmutablePass { // Map of invoke call site index values to associated begin EH_LABEL for // the current function. - DenseMap<unsigned, unsigned> CallSiteMap; + DenseMap<MCSymbol*, unsigned> CallSiteMap; // The current call site index being processed, if any. 0 if none. unsigned CurCallSite; @@ -215,6 +212,9 @@ public: return ID; } + /// getLabelSym - Turn a label ID into a symbol. + MCSymbol *getLabelSym(unsigned ID); + /// InvalidateLabel - Inhibit use of the specified label # from /// MachineModuleInfo, for example because the code was deleted. void InvalidateLabel(unsigned LabelID) { @@ -245,8 +245,8 @@ public: /// addInvoke - Provide the begin and end labels of an invoke style call and /// associate it with a try landing pad block. - void addInvoke(MachineBasicBlock *LandingPad, unsigned BeginLabel, - unsigned EndLabel); + void addInvoke(MachineBasicBlock *LandingPad, + MCSymbol *BeginLabel, MCSymbol *EndLabel); /// addLandingPad - Add a new panding pad. Returns the label ID for the /// landing pad entry. @@ -305,12 +305,12 @@ public: } /// setCallSiteBeginLabel - Map the begin label for a call site - void setCallSiteBeginLabel(unsigned BeginLabel, unsigned Site) { + void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) { CallSiteMap[BeginLabel] = Site; } /// getCallSiteBeginLabel - Get the call site number for a begin label - unsigned getCallSiteBeginLabel(unsigned BeginLabel) { + unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) { assert(CallSiteMap.count(BeginLabel) && "Missing call site number for EH_LABEL!"); return CallSiteMap[BeginLabel]; diff --git a/include/llvm/CodeGen/ObjectCodeEmitter.h b/include/llvm/CodeGen/ObjectCodeEmitter.h index 170c0c8..d46628c 100644 --- a/include/llvm/CodeGen/ObjectCodeEmitter.h +++ b/include/llvm/CodeGen/ObjectCodeEmitter.h @@ -137,13 +137,6 @@ public: /// emitted. virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const; - /// emitLabel - Emits a label - virtual void emitLabel(uint64_t LabelID) = 0; - - /// getLabelAddress - Return the address of the specified LabelID, only usable - /// after the LabelID has been emitted. - virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0; - /// emitJumpTables - Emit all the jump tables for a given jump table info /// record to the appropriate section. virtual void emitJumpTables(MachineJumpTableInfo *MJTI) = 0; |