class InvokeInst;
class IntrinsicInst;
class LandingPadInst;
+class MCExpr;
class MCSymbol;
class MachineBasicBlock;
class Value;
// exceptions on Windows.
typedef PointerUnion<const BasicBlock *, MachineBasicBlock *> MBBOrBasicBlock;
-typedef PointerUnion<const Value *, MachineBasicBlock *> ValueOrMBB;
+typedef PointerUnion<const Value *, const MachineBasicBlock *> ValueOrMBB;
struct WinEHUnwindMapEntry {
int ToState;
struct WinEHHandlerType {
int Adjectives;
- GlobalVariable *TypeDescriptor;
int CatchObjRecoverIdx;
+ /// The CatchObj starts out life as an LLVM alloca, is turned into a frame
+ /// index, and after PEI, becomes a raw offset.
+ union {
+ const AllocaInst *Alloca;
+ int FrameOffset;
+ int FrameIndex;
+ } CatchObj = {};
+ GlobalVariable *TypeDescriptor;
ValueOrMBB Handler;
};
};
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 Instruction *, int> EHPadStateMap;
- DenseMap<const Function *, int> CatchHandlerParentFrameObjIdx;
- DenseMap<const Function *, int> CatchHandlerParentFrameObjOffset;
- DenseMap<const Function *, int> CatchHandlerMaxState;
- DenseMap<const Function *, int> HandlerBaseState;
+ DenseMap<const CatchReturnInst *, const BasicBlock *>
+ CatchRetSuccessorColorMap;
+ DenseMap<MCSymbol *, std::pair<int, MCSymbol *>> InvokeToStateMap;
SmallVector<WinEHUnwindMapEntry, 4> UnwindMap;
SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap;
SmallVector<SEHUnwindMapEntry, 4> SEHUnwindMap;
- SmallVector<std::pair<MCSymbol *, int>, 4> IPToStateList;
int UnwindHelpFrameIdx = INT_MAX;
int UnwindHelpFrameOffset = -1;
- unsigned NumIPToStateFuncsVisited = 0;
int getLastStateNumber() const { return UnwindMap.size() - 1; }
+ void addIPToStateRange(const BasicBlock *PadBB, 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;
WinEHFuncInfo() {}
};
void calculateSEHStateNumbers(const Function *ParentFn,
WinEHFuncInfo &FuncInfo);
+
+void calculateCatchReturnSuccessorColors(const Function *Fn,
+ WinEHFuncInfo &FuncInfo);
}
#endif // LLVM_CODEGEN_WINEHFUNCINFO_H