RegisterPressure: Expose RegisterOperands API
[oota-llvm.git] / include / llvm / CodeGen / WinEHFuncInfo.h
index 89a750582472d82994f0e001cfab6edca13b76a2..46c1029f62cf33b63a8f75b953e2c00bb6c0902a 100644 (file)
@@ -22,6 +22,7 @@
 namespace llvm {
 class AllocaInst;
 class BasicBlock;
+class CatchReturnInst;
 class Constant;
 class Function;
 class GlobalVariable;
@@ -37,11 +38,10 @@ class Value;
 // Windows-related EH personalities.
 
 typedef PointerUnion<const BasicBlock *, MachineBasicBlock *> MBBOrBasicBlock;
-typedef PointerUnion<const Value *, const MachineBasicBlock *> ValueOrMBB;
 
 struct CxxUnwindMapEntry {
   int ToState;
-  ValueOrMBB Cleanup;
+  MBBOrBasicBlock Cleanup;
 };
 
 /// Similar to CxxUnwindMapEntry, but supports SEH filters.
@@ -61,15 +61,14 @@ struct SEHUnwindMapEntry {
 
 struct WinEHHandlerType {
   int Adjectives;
-  int CatchObjRecoverIdx;
-  /// The CatchObj starts out life as an LLVM alloca, is turned into a frame
-  /// index, and after PEI, becomes a raw offset.
+  /// The CatchObj starts out life as an LLVM alloca and is eventually turned
+  /// frame index.
   union {
     const AllocaInst *Alloca;
     int FrameIndex;
   } CatchObj = {};
   GlobalVariable *TypeDescriptor;
-  ValueOrMBB Handler;
+  MBBOrBasicBlock Handler;
 };
 
 struct WinEHTryBlockMapEntry {
@@ -84,34 +83,34 @@ enum class ClrHandlerType { Catch, Finally, Fault, Filter };
 struct ClrEHUnwindMapEntry {
   MBBOrBasicBlock Handler;
   uint32_t TypeToken;
-  int Parent;
+  int HandlerParentState; ///< Outer handler enclosing this entry's handler
+  int TryParentState; ///< Outer try region enclosing this entry's try region,
+                      ///< treating later catches on same try as "outer"
   ClrHandlerType HandlerType;
 };
 
 struct WinEHFuncInfo {
   DenseMap<const Instruction *, int> EHPadStateMap;
-  DenseMap<const CatchReturnInst *, const BasicBlock *>
-      CatchRetSuccessorColorMap;
-  DenseMap<MCSymbol *, std::pair<int, MCSymbol *>> InvokeToStateMap;
+  DenseMap<const FuncletPadInst *, int> FuncletBaseStateMap;
+  DenseMap<const InvokeInst *, int> InvokeStateMap;
+  DenseMap<MCSymbol *, std::pair<int, MCSymbol *>> LabelToStateMap;
   SmallVector<CxxUnwindMapEntry, 4> CxxUnwindMap;
   SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap;
   SmallVector<SEHUnwindMapEntry, 4> SEHUnwindMap;
   SmallVector<ClrEHUnwindMapEntry, 4> ClrEHUnwindMap;
   int UnwindHelpFrameIdx = INT_MAX;
+  int PSPSymFrameIdx = INT_MAX;
 
   int getLastStateNumber() const { return CxxUnwindMap.size() - 1; }
 
-  void addIPToStateRange(const BasicBlock *PadBB, MCSymbol *InvokeBegin,
+  void addIPToStateRange(const InvokeInst *II, MCSymbol *InvokeBegin,
                          MCSymbol *InvokeEnd);
 
-  /// localescape index of the 32-bit EH registration node. Set by
-  /// WinEHStatePass and used indirectly by SEH filter functions of the parent.
-  int EHRegNodeEscapeIndex = INT_MAX;
-  const AllocaInst *EHRegNode = nullptr;
   int EHRegNodeFrameIndex = INT_MAX;
   int EHRegNodeEndOffset = INT_MAX;
+  int SEHSetFrameOffset = INT_MAX;
 
-  WinEHFuncInfo() {}
+  WinEHFuncInfo();
 };
 
 /// Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which
@@ -124,8 +123,5 @@ void calculateSEHStateNumbers(const Function *ParentFn,
                               WinEHFuncInfo &FuncInfo);
 
 void calculateClrEHStateNumbers(const Function *Fn, WinEHFuncInfo &FuncInfo);
-
-void calculateCatchReturnSuccessorColors(const Function *Fn,
-                                         WinEHFuncInfo &FuncInfo);
 }
 #endif // LLVM_CODEGEN_WINEHFUNCINFO_H