Add an ivar that maps a landing pad's EH symbol to the call sites that may jump
authorBill Wendling <isanbard@gmail.com>
Wed, 5 Oct 2011 22:20:38 +0000 (22:20 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 5 Oct 2011 22:20:38 +0000 (22:20 +0000)
to the landing pad. This will be used by the back-end to generate the jump
tables for dispatching the arriving longjmp in sjlj eh.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141224 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineModuleInfo.h
lib/CodeGen/MachineModuleInfo.cpp

index 4daa663bac3c1037f5da9688bc751ed1c9f8efe6..a09a71400ddea36b5e98b98fe33c838a19f675f1 100644 (file)
@@ -119,6 +119,10 @@ class MachineModuleInfo : public ImmutablePass {
   /// information in the current function.
   std::vector<LandingPadInfo> LandingPads;
 
+  /// LPadToCallSiteMap - Map a landing pad's EH symbol to the call site
+  /// indexes.
+  DenseMap<MCSymbol*, SmallVector<unsigned, 4> > LPadToCallSiteMap;
+
   /// CallSiteMap - Map of invoke call site index values to associated begin
   /// EH_LABEL for the current function.
   DenseMap<MCSymbol*, unsigned> CallSiteMap;
@@ -327,6 +331,16 @@ public:
     return LandingPads;
   }
 
+  /// setCallSiteLandingPad - Map the landing pad's EH symbol to the call
+  /// site indexes.
+  void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
+
+  /// getCallSiteLandingPad - Get the call site indexes for a landing pad EH
+  /// symbol.
+  SmallVectorImpl<unsigned> &getCallSiteLandingPad(MCSymbol *Sym) {
+    return LPadToCallSiteMap[Sym];
+  }
+
   /// setCallSiteBeginLabel - Map the begin label for a call site.
   void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
     CallSiteMap[BeginLabel] = Site;
index 58ced92237f505d547e252ff6c9944b851b35253..80c4854238afe3e63fe0df3df3eb69326d633add 100644 (file)
@@ -499,6 +499,14 @@ void MachineModuleInfo::TidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {
   }
 }
 
+/// setCallSiteLandingPad - Map the landing pad's EH symbol to the call site
+/// indexes.
+void MachineModuleInfo::setCallSiteLandingPad(MCSymbol *Sym,
+                                              ArrayRef<unsigned> Sites) {
+  for (unsigned I = 0, E = Sites.size(); I != E; ++I)
+    LPadToCallSiteMap[Sym].push_back(Sites[I]);
+}
+
 /// getTypeIDFor - Return the type id for the specified typeinfo.  This is
 /// function wide.
 unsigned MachineModuleInfo::getTypeIDFor(const GlobalVariable *TI) {