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
This commit is contained in:
Chris Lattner
2010-03-14 01:41:15 +00:00
parent bf2d4c034d
commit 1611273351
14 changed files with 139 additions and 159 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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];

View File

@@ -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;