diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-09-29 01:13:55 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-09-29 01:13:55 +0000 |
commit | 3511cedf36d0473292b8e8dca0b4eb7576e1064c (patch) | |
tree | e79f126e4ad4686ba9f90b517957c4d88d2e4d34 | |
parent | d57c1bc0b61417814ed9058a290091858d244c79 (diff) |
Move to ISelLowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARM.h | 1 | ||||
-rw-r--r-- | lib/Target/ARM/ARMSjLjLoweringPass.cpp | 128 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetMachine.cpp | 2 |
3 files changed, 0 insertions, 131 deletions
diff --git a/lib/Target/ARM/ARM.h b/lib/Target/ARM/ARM.h index 2e5b65cb78..5556dc5a4d 100644 --- a/lib/Target/ARM/ARM.h +++ b/lib/Target/ARM/ARM.h @@ -41,7 +41,6 @@ FunctionPass *createARMLoadStoreOptimizationPass(bool PreAlloc = false); FunctionPass *createARMExpandPseudoPass(); FunctionPass *createARMGlobalMergePass(const TargetLowering* tli); FunctionPass *createARMConstantIslandPass(); -FunctionPass *createARMSjLjLoweringPass(); FunctionPass *createNEONMoveFixPass(); FunctionPass *createMLxExpansionPass(); FunctionPass *createThumb2ITBlockPass(); diff --git a/lib/Target/ARM/ARMSjLjLoweringPass.cpp b/lib/Target/ARM/ARMSjLjLoweringPass.cpp deleted file mode 100644 index e082bc6dd2..0000000000 --- a/lib/Target/ARM/ARMSjLjLoweringPass.cpp +++ /dev/null @@ -1,128 +0,0 @@ -//===-- ARMSjLjLoweringPass.cpp - ARM SjLj Lowering Pass ------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains a pass that lowers the SjLj exception handling into -// machine instructions. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "arm-sjlj-lowering" -#include "ARM.h" -#include "llvm/Function.h" -#include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetLowering.h" -#include "llvm/Support/CommandLine.h" -using namespace llvm; - -// Hidden options for the new EH stuff. -static cl::opt<bool> -EnableNewSjLjEHPrepare("enable-new-sjlj-eh", cl::Hidden, - cl::desc("Use the new SjLj EH preparation pass")); - -namespace { - -class ARMSjLjLowering : public MachineFunctionPass { - Type *FunctionCtxTy; - LLVMContext *Context; - - MachineFunction *MF; - const Function *F; - const TargetLowering *TLI; - const TargetInstrInfo *TII; - const TargetRegisterInfo *TRI; - - /// 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; - ARMSjLjLowering() : MachineFunctionPass(ID) {} - - virtual bool runOnMachineFunction(MachineFunction &mf); - - virtual const char *getPassName() const { - return "ARM setjmp/longjmp exception handling lowering pass"; - } -}; - -char ARMSjLjLowering::ID = 0; - -} // end anonymous namespace - -FunctionPass *llvm::createARMSjLjLoweringPass() { - return new ARMSjLjLowering(); -} - -bool ARMSjLjLowering::runOnMachineFunction(MachineFunction &mf) { - if (!EnableNewSjLjEHPrepare) return false; - - MF = &mf; - F = MF->getFunction(); - Context = &F->getContext(); - TLI = MF->getTarget().getTargetLowering(); - TII = MF->getTarget().getInstrInfo(); - TRI = MF->getTarget().getRegisterInfo(); - - // 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; -} - -/// setupFunctionContext - Create the function context on the stack. -int ARMSjLjLowering::setupFunctionContext() { - // struct _Unwind_FunctionContext { - // // next function in stack of handlers. - // struct _Unwind_FunctionContext *prev; - // - // // set by calling function before registering to be the landing pad. - // uintptr_t resumeLocation; - // - // // set by personality handler to be parameters passed to landing pad - // // function. - // uintptr_t resumeParameters[4]; - // - // // set by calling function before registering - // __personality_routine personality; // arm offset=24 - // - // uintptr_t lsda // arm offset=28 - // - // // variable length array, contains registers to restore - // // 0 = r7, 1 = pc, 2 = sp - // void *jbuf[]; // 5 for GCC compatibility. - // }; - Type *VoidPtrTy = Type::getInt8PtrTy(*Context); - Type *Int32Ty = Type::getInt32Ty(*Context); - FunctionCtxTy = - StructType::get(VoidPtrTy, // prev - Int32Ty, // resumeLocation - ArrayType::get(Int32Ty, 4), // resumeParameters - VoidPtrTy, // personality - VoidPtrTy, // lsda - ArrayType::get(VoidPtrTy, 5), // jbuf - NULL); - - uint64_t TySize = TLI->getTargetData()->getTypeAllocSize(FunctionCtxTy); - unsigned Align = TLI->getTargetData()->getPrefTypeAlignment(FunctionCtxTy); - - return MF->getFrameInfo()->CreateStackObject(TySize, Align, false, false); -} diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 3010acae0c..2cd818abf3 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -108,8 +108,6 @@ bool ARMBaseTargetMachine::addPreRegAlloc(PassManagerBase &PM, PM.add(createARMLoadStoreOptimizationPass(true)); if (OptLevel != CodeGenOpt::None && Subtarget.isCortexA9()) PM.add(createMLxExpansionPass()); - if (getMCAsmInfo()->getExceptionHandlingType() == ExceptionHandling::SjLj) - PM.add(createARMSjLjLoweringPass()); return true; } |