diff options
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 7d8b7ebe8d62..e8a4d529faac 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -73,6 +73,7 @@ class SlotIndexes; class TargetMachine; class TargetRegisterClass; class TargetSubtargetInfo; +struct WasmEHFuncInfo; struct WinEHFuncInfo; template <> struct ilist_alloc_traits<MachineBasicBlock> { @@ -80,8 +81,8 @@ template <> struct ilist_alloc_traits<MachineBasicBlock> { }; template <> struct ilist_callback_traits<MachineBasicBlock> { - void addNodeToList(MachineBasicBlock* MBB); - void removeNodeFromList(MachineBasicBlock* MBB); + void addNodeToList(MachineBasicBlock* N); + void removeNodeFromList(MachineBasicBlock* N); template <class Iterator> void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) { @@ -96,7 +97,7 @@ template <> struct ilist_callback_traits<MachineBasicBlock> { struct MachineFunctionInfo { virtual ~MachineFunctionInfo(); - /// \brief Factory function: default behavior is to call new using the + /// Factory function: default behavior is to call new using the /// supplied allocator. /// /// This function can be overridden in a derive class. @@ -245,6 +246,10 @@ class MachineFunction { // Keep track of jump tables for switch instructions MachineJumpTableInfo *JumpTableInfo; + // Keeps track of Wasm exception handling related data. This will be null for + // functions that aren't using a wasm EH personality. + WasmEHFuncInfo *WasmEHInfo = nullptr; + // Keeps track of Windows exception handling related data. This will be null // for functions that aren't using a funclet-based EH personality. WinEHFuncInfo *WinEHInfo = nullptr; @@ -319,6 +324,7 @@ class MachineFunction { bool CallsEHReturn = false; bool CallsUnwindInit = false; + bool HasEHScopes = false; bool HasEHFunclets = false; /// List of C++ TypeInfo used. @@ -349,17 +355,18 @@ public: struct VariableDbgInfo { const DILocalVariable *Var; const DIExpression *Expr; - unsigned Slot; + // The Slot can be negative for fixed stack objects. + int Slot; const DILocation *Loc; VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, - unsigned Slot, const DILocation *Loc) + int Slot, const DILocation *Loc) : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {} }; using VariableDbgInfoMapTy = SmallVector<VariableDbgInfo, 4>; VariableDbgInfoMapTy VariableDbgInfos; - MachineFunction(const Function &F, const TargetMachine &TM, + MachineFunction(const Function &F, const TargetMachine &Target, const TargetSubtargetInfo &STI, unsigned FunctionNum, MachineModuleInfo &MMI); MachineFunction(const MachineFunction &) = delete; @@ -430,6 +437,12 @@ public: MachineConstantPool *getConstantPool() { return ConstantPool; } const MachineConstantPool *getConstantPool() const { return ConstantPool; } + /// getWasmEHFuncInfo - Return information about how the current function uses + /// Wasm exception handling. Returns null for functions that don't use wasm + /// exception handling. + const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; } + WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; } + /// getWinEHFuncInfo - Return information about how the current function uses /// Windows exception handling. Returns null for functions that don't use /// funclets for exception handling. @@ -609,7 +622,7 @@ public: //===--------------------------------------------------------------------===// // Internal functions used to automatically number MachineBasicBlocks - /// \brief Adds the MBB to the internal numbering. Returns the unique number + /// Adds the MBB to the internal numbering. Returns the unique number /// assigned to the MBB. unsigned addToMBBNumbering(MachineBasicBlock *MBB) { MBBNumbering.push_back(MBB); @@ -695,14 +708,8 @@ public: OperandRecycler.deallocate(Cap, Array); } - /// \brief Allocate and initialize a register mask with @p NumRegister bits. - uint32_t *allocateRegisterMask(unsigned NumRegister) { - unsigned Size = (NumRegister + 31) / 32; - uint32_t *Mask = Allocator.Allocate<uint32_t>(Size); - for (unsigned i = 0; i != Size; ++i) - Mask[i] = 0; - return Mask; - } + /// Allocate and initialize a register mask with @p NumRegister bits. + uint32_t *allocateRegMask(); /// allocateMemRefsArray - Allocate an array to hold MachineMemOperand /// pointers. This array is owned by the MachineFunction. @@ -759,6 +766,9 @@ public: bool callsUnwindInit() const { return CallsUnwindInit; } void setCallsUnwindInit(bool b) { CallsUnwindInit = b; } + bool hasEHScopes() const { return HasEHScopes; } + void setHasEHScopes(bool V) { HasEHScopes = V; } + bool hasEHFunclets() const { return HasEHFunclets; } void setHasEHFunclets(bool V) { HasEHFunclets = V; } @@ -793,7 +803,7 @@ public: void addCleanup(MachineBasicBlock *LandingPad); void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, - const BlockAddress *RecoverLabel); + const BlockAddress *RecoverBA); void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup); @@ -860,7 +870,7 @@ public: /// Collect information used to emit debugging information of a variable. void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, - unsigned Slot, const DILocation *Loc) { + int Slot, const DILocation *Loc) { VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc); } |