diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-09-28 20:29:45 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-09-28 20:29:45 +0000 |
commit | b18abd077e168f38acb1633c4101fbe3c8a18e41 (patch) | |
tree | 4b9333771fa2533bf9fe78dc9166ebc451ebd122 /lib | |
parent | 39689c81542df0f40bec72464429b21012708efa (diff) | |
download | llvm-b18abd077e168f38acb1633c4101fbe3c8a18e41.tar.gz llvm-b18abd077e168f38acb1633c4101fbe3c8a18e41.tar.bz2 llvm-b18abd077e168f38acb1633c4101fbe3c8a18e41.tar.xz |
Perform the lowering only if there are invokes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMSjLjLoweringPass.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Target/ARM/ARMSjLjLoweringPass.cpp b/lib/Target/ARM/ARMSjLjLoweringPass.cpp index a7dce3be4b..e082bc6dd2 100644 --- a/lib/Target/ARM/ARMSjLjLoweringPass.cpp +++ b/lib/Target/ARM/ARMSjLjLoweringPass.cpp @@ -35,14 +35,14 @@ class ARMSjLjLowering : public MachineFunctionPass { LLVMContext *Context; MachineFunction *MF; - const Function *Fn; + const Function *F; const TargetLowering *TLI; const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; - /// createFunctionContext - Create the function context on the stack. This - /// returns the nonnegative identifier representing it in the FrameInfo. - int createFunctionContext(); + /// setupFunctionContext - Setup the function context on the stack. Some of + /// the fields were set by the SjLj EH prepare pass. + int setupFunctionContext(); public: static char ID; @@ -67,19 +67,29 @@ bool ARMSjLjLowering::runOnMachineFunction(MachineFunction &mf) { if (!EnableNewSjLjEHPrepare) return false; MF = &mf; - Fn = MF->getFunction(); - Context = &Fn->getContext(); + F = MF->getFunction(); + Context = &F->getContext(); TLI = MF->getTarget().getTargetLowering(); TII = MF->getTarget().getInstrInfo(); TRI = MF->getTarget().getRegisterInfo(); - int FrameIdx = createFunctionContext(); (void)FrameIdx; + // Perform the lowering only if there are invokes. + bool HasInvokes = false; + for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + if (isa<InvokeInst>(BB->getTerminator())) { + HasInvokes = true; + break; + } + + if (!HasInvokes) return false; + + int FrameIdx = setupFunctionContext(); (void)FrameIdx; return true; } -/// createFunctionContext - Create the function context on the stack. -int ARMSjLjLowering::createFunctionContext() { +/// setupFunctionContext - Create the function context on the stack. +int ARMSjLjLowering::setupFunctionContext() { // struct _Unwind_FunctionContext { // // next function in stack of handlers. // struct _Unwind_FunctionContext *prev; |