llvm.org GIT mirror llvm / eabae1d
s/SjLjEHPass/SjLjEHPrepare/ No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152658 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
3 changed file(s) with 21 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
422422 /// adapted to code generation. Required if using dwarf exception handling.
423423 FunctionPass *createDwarfEHPass(const TargetMachine *tm);
424424
425 /// createSjLjEHPass - This pass adapts exception handling code to use
425 /// createSjLjEHPreparePass - This pass adapts exception handling code to use
426426 /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
427427 ///
428 FunctionPass *createSjLjEHPass(const TargetLowering *tli);
428 FunctionPass *createSjLjEHPreparePass(const TargetLowering *tli);
429429
430430 /// LocalStackSlotAllocation - This pass assigns local frame indices to stack
431431 /// slots relative to one another and allocates base registers to access them
8989 // removed from the parent invoke(s). This could happen when a landing
9090 // pad is shared by multiple invokes and is also a target of a normal
9191 // edge from elsewhere.
92 PM.add(createSjLjEHPass(TM->getTargetLowering()));
92 PM.add(createSjLjEHPreparePass(TM->getTargetLowering()));
9393 // FALLTHROUGH
9494 case ExceptionHandling::DwarfCFI:
9595 case ExceptionHandling::ARM:
None //===- SjLjEHPass.cpp - Eliminate Invoke & Unwind instructions -----------===//
0 //===- SjLjEHPrepare.cpp - Eliminate Invoke & Unwind instructions ---------===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
4141 STATISTIC(NumSpilled, "Number of registers live across unwind edges");
4242
4343 namespace {
44 class SjLjEHPass : public FunctionPass {
44 class SjLjEHPrepare : public FunctionPass {
4545 const TargetLowering *TLI;
4646 Type *FunctionContextTy;
4747 Constant *RegisterFn;
5757 AllocaInst *FuncCtx;
5858 public:
5959 static char ID; // Pass identification, replacement for typeid
60 explicit SjLjEHPass(const TargetLowering *tli = NULL)
60 explicit SjLjEHPrepare(const TargetLowering *tli = NULL)
6161 : FunctionPass(ID), TLI(tli) { }
6262 bool doInitialization(Module &M);
6363 bool runOnFunction(Function &F);
7878 };
7979 } // end anonymous namespace
8080
81 char SjLjEHPass::ID = 0;
82
83 // Public Interface To the SjLjEHPass pass.
84 FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) {
85 return new SjLjEHPass(TLI);
81 char SjLjEHPrepare::ID = 0;
82
83 // Public Interface To the SjLjEHPrepare pass.
84 FunctionPass *llvm::createSjLjEHPreparePass(const TargetLowering *TLI) {
85 return new SjLjEHPrepare(TLI);
8686 }
8787 // doInitialization - Set up decalarations and types needed to process
8888 // exceptions.
89 bool SjLjEHPass::doInitialization(Module &M) {
89 bool SjLjEHPrepare::doInitialization(Module &M) {
9090 // Build the function context structure.
9191 // builtin_setjmp uses a five word jbuf
9292 Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
122122
123123 /// insertCallSiteStore - Insert a store of the call-site value to the
124124 /// function context
125 void SjLjEHPass::insertCallSiteStore(Instruction *I, int Number) {
125 void SjLjEHPrepare::insertCallSiteStore(Instruction *I, int Number) {
126126 IRBuilder<> Builder(I);
127127
128128 // Get a reference to the call_site field.
150150
151151 /// substituteLPadValues - Substitute the values returned by the landingpad
152152 /// instruction with those returned by the personality function.
153 void SjLjEHPass::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal,
154 Value *SelVal) {
153 void SjLjEHPrepare::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal,
154 Value *SelVal) {
155155 SmallVector UseWorkList(LPI->use_begin(), LPI->use_end());
156156 while (!UseWorkList.empty()) {
157157 Value *Val = UseWorkList.pop_back_val();
182182
183183 /// setupFunctionContext - Allocate the function context on the stack and fill
184184 /// it with all of the data that we know at this point.
185 Value *SjLjEHPass::
185 Value *SjLjEHPrepare::
186186 setupFunctionContext(Function &F, ArrayRef LPads) {
187187 BasicBlock *EntryBB = F.begin();
188188
250250 /// specially, we lower each arg to a copy instruction in the entry block. This
251251 /// ensures that the argument value itself cannot be live out of the entry
252252 /// block.
253 void SjLjEHPass::lowerIncomingArguments(Function &F) {
253 void SjLjEHPrepare::lowerIncomingArguments(Function &F) {
254254 BasicBlock::iterator AfterAllocaInsPt = F.begin()->begin();
255255 while (isa(AfterAllocaInsPt) &&
256256 isa(cast(AfterAllocaInsPt)->getArraySize()))
294294
295295 /// lowerAcrossUnwindEdges - Find all variables which are alive across an unwind
296296 /// edge and spill them.
297 void SjLjEHPass::lowerAcrossUnwindEdges(Function &F,
298 ArrayRef Invokes) {
297 void SjLjEHPrepare::lowerAcrossUnwindEdges(Function &F,
298 ArrayRef Invokes) {
299299 // Finally, scan the code looking for instructions with bad live ranges.
300300 for (Function::iterator
301301 BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) {
392392 /// setupEntryBlockAndCallSites - Setup the entry block by creating and filling
393393 /// the function context and marking the call sites with the appropriate
394394 /// values. These values are used by the DWARF EH emitter.
395 bool SjLjEHPass::setupEntryBlockAndCallSites(Function &F) {
395 bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) {
396396 SmallVector Returns;
397397 SmallVector Invokes;
398398 SmallSetVector LPads;
518518 return true;
519519 }
520520
521 bool SjLjEHPass::runOnFunction(Function &F) {
521 bool SjLjEHPrepare::runOnFunction(Function &F) {
522522 bool Res = setupEntryBlockAndCallSites(F);
523523 return Res;
524524 }