summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-17 21:10:25 +0000
committerReid Kleckner <rnk@google.com>2015-11-17 21:10:25 +0000
commitc20276d0b2da8bff1e3da2fd80fc4d17f861eddd (patch)
treeb9a45ab78fbb27616e40726209077d3acac213cc /llvm/include
parentc4e2bed73885b35ba82dd872cc20c9aa46ec774a (diff)
downloadbcm5719-llvm-c20276d0b2da8bff1e3da2fd80fc4d17f861eddd.tar.gz
bcm5719-llvm-c20276d0b2da8bff1e3da2fd80fc4d17f861eddd.zip
[WinEH] Move WinEHFuncInfo from MachineModuleInfo to MachineFunction
Summary: Now that there is a one-to-one mapping from MachineFunction to WinEHFuncInfo, we don't need to use a DenseMap to select the right WinEHFuncInfo for the current funclet. The main challenge here is that X86WinEHStatePass is an IR pass that doesn't have access to the MachineFunction. I gave it its own WinEHFuncInfo object that it uses to calculate state numbers, which it then throws away. As long as nobody creates or removes EH pads between this pass and SDAG construction, we will get the same state numbers. The other thing X86WinEHStatePass does is to mark the EH registration node. Instead of communicating which alloca was the registration through WinEHFuncInfo, I added the llvm.x86.seh.ehregnode intrinsic. This intrinsic generates no code and simply marks the alloca in use. Reviewers: JCTremoulet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14668 llvm-svn: 253378
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h11
-rw-r--r--llvm/include/llvm/CodeGen/MachineModuleInfo.h14
-rw-r--r--llvm/include/llvm/CodeGen/WinEHFuncInfo.h8
-rw-r--r--llvm/include/llvm/IR/IntrinsicsX86.td3
4 files changed, 17 insertions, 19 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index d163c971d4b..82c30d39afd 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -43,6 +43,7 @@ class TargetMachine;
class TargetSubtargetInfo;
class TargetRegisterClass;
struct MachinePointerInfo;
+struct WinEHFuncInfo;
template <>
struct ilist_traits<MachineBasicBlock>
@@ -107,6 +108,10 @@ class MachineFunction {
// Keep track of jump tables for switch instructions
MachineJumpTableInfo *JumpTableInfo;
+ // 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;
+
// Function-level unique numbering for MachineBasicBlocks. When a
// MachineBasicBlock is inserted into a MachineFunction is it automatically
// numbered and this vector keeps track of the mapping from ID's to MBB's.
@@ -221,6 +226,12 @@ public:
MachineConstantPool *getConstantPool() { return ConstantPool; }
const MachineConstantPool *getConstantPool() const { return ConstantPool; }
+ /// getWinEHFuncInfo - Return information about how the current function uses
+ /// Windows exception handling. Returns null for functions that don't use
+ /// funclets for exception handling.
+ const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
+ WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
+
/// getAlignment - Return the alignment (log2, not bytes) of the function.
///
unsigned getAlignment() const { return Alignment; }
diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
index 4df580f0dba..fd42b46476c 100644
--- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -59,7 +59,6 @@ class MachineFunction;
class Module;
class PointerType;
class StructType;
-struct WinEHFuncInfo;
struct SEHHandler {
// Filter or finally function. Null indicates a catch-all.
@@ -80,11 +79,9 @@ struct LandingPadInfo {
SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
std::vector<int> TypeIds; // List of type ids (filters negative).
- int WinEHState; // WinEH specific state number.
explicit LandingPadInfo(MachineBasicBlock *MBB)
- : LandingPadBlock(MBB), LandingPadLabel(nullptr),
- WinEHState(-1) {}
+ : LandingPadBlock(MBB), LandingPadLabel(nullptr) {}
};
//===----------------------------------------------------------------------===//
@@ -182,8 +179,6 @@ class MachineModuleInfo : public ImmutablePass {
EHPersonality PersonalityTypeCache;
- DenseMap<const Function *, std::unique_ptr<WinEHFuncInfo>> FuncInfoMap;
-
public:
static char ID; // Pass identification, replacement for typeid
@@ -220,11 +215,6 @@ public:
void setModule(const Module *M) { TheModule = M; }
const Module *getModule() const { return TheModule; }
- WinEHFuncInfo &getWinEHFuncInfo(const Function *F);
- bool hasWinEHFuncInfo(const Function *F) const {
- return FuncInfoMap.count(F) > 0;
- }
-
/// getInfo - Keep track of various per-function pieces of information for
/// backends that would like to do so.
///
@@ -327,8 +317,6 @@ public:
/// information.
void addPersonality(const Function *Personality);
- void addWinEHState(MachineBasicBlock *LandingPad, int State);
-
/// getPersonalities - Return array of personality functions ever seen.
const std::vector<const Function *>& getPersonalities() const {
return Personalities;
diff --git a/llvm/include/llvm/CodeGen/WinEHFuncInfo.h b/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
index 782119e84e2..5def70692ba 100644
--- a/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
+++ b/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
@@ -60,8 +60,8 @@ struct SEHUnwindMapEntry {
struct WinEHHandlerType {
int Adjectives;
- /// 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;
@@ -103,10 +103,6 @@ struct WinEHFuncInfo {
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;
diff --git a/llvm/include/llvm/IR/IntrinsicsX86.td b/llvm/include/llvm/IR/IntrinsicsX86.td
index 3d6fa1c0662..2b5577cdad9 100644
--- a/llvm/include/llvm/IR/IntrinsicsX86.td
+++ b/llvm/include/llvm/IR/IntrinsicsX86.td
@@ -22,6 +22,9 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
let TargetPrefix = "x86" in {
def int_x86_seh_lsda : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty], [IntrNoMem]>;
+ // Marks the EH registration node created in LLVM IR prior to code generation.
+ def int_x86_seh_ehregnode : Intrinsic<[], [llvm_ptr_ty], []>;
+
// Restores the frame, base, and stack pointers as necessary after recovering
// from an exception. Any block resuming control flow in the parent function
// should call this before accessing any stack memory.
OpenPOWER on IntegriCloud