[WinEH] Start inserting state number stores for C++ EH
[oota-llvm.git] / include / llvm / CodeGen / WinEHFuncInfo.h
index 904e01c448a9345f9222b927d70aae4bc0f9ab1b..1cff3203f2bbf7416f1b4b4af34c491b6293d56f 100644 (file)
@@ -22,7 +22,8 @@ namespace llvm {
 class BasicBlock;
 class Constant;
 class Function;
-class GlobalValue;
+class GlobalVariable;
+class InvokeInst;
 class IntrinsicInst;
 class LandingPadInst;
 class MCSymbol;
@@ -107,8 +108,7 @@ public:
 };
 
 void parseEHActions(const IntrinsicInst *II,
-  SmallVectorImpl<ActionHandler *> &Actions);
-
+                    SmallVectorImpl<std::unique_ptr<ActionHandler>> &Actions);
 
 // The following structs respresent the .xdata for functions using C++
 // exceptions on Windows.
@@ -132,6 +132,10 @@ struct WinEHTryBlockMapEntry {
 };
 
 struct WinEHFuncInfo {
+  DenseMap<const Function *, const LandingPadInst *> RootLPad;
+  DenseMap<const Function *, const InvokeInst *> LastInvoke;
+  DenseMap<const Function *, int> HandlerEnclosedState;
+  DenseMap<const Function *, bool> LastInvokeVisited;
   DenseMap<const LandingPadInst *, int> LandingPadStateMap;
   DenseMap<const Function *, int> CatchHandlerParentFrameObjIdx;
   DenseMap<const Function *, int> CatchHandlerParentFrameObjOffset;
@@ -150,5 +154,11 @@ struct WinEHFuncInfo {
         NumIPToStateFuncsVisited(0) {}
 };
 
+/// Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which
+/// describes the state numbers and tables used by __CxxFrameHandler3. This
+/// analysis assumes that WinEHPrepare has already been run.
+void calculateWinCXXEHStateNumbers(const Function *ParentFn,
+                                   WinEHFuncInfo &FuncInfo);
+
 }
 #endif // LLVM_CODEGEN_WINEHFUNCINFO_H