inline BasicBlock *getNormalDest() {
return cast<BasicBlock>(Operands[1].get());
}
- inline const BasicBlock *getExceptionalDest() const {
+ inline const BasicBlock *getUnwindDest() const {
return cast<BasicBlock>(Operands[2].get());
}
- inline BasicBlock *getExceptionalDest() {
+ inline BasicBlock *getUnwindDest() {
return cast<BasicBlock>(Operands[2].get());
}
Operands[1] = reinterpret_cast<Value*>(B);
}
- inline void setExceptionalDest(BasicBlock *B){
+ inline void setUnwindDest(BasicBlock *B){
Operands[2] = reinterpret_cast<Value*>(B);
}
virtual const BasicBlock *getSuccessor(unsigned i) const {
assert(i < 2 && "Successor # out of range for invoke!");
- return i == 0 ? getNormalDest() : getExceptionalDest();
+ return i == 0 ? getNormalDest() : getUnwindDest();
}
inline BasicBlock *getSuccessor(unsigned i) {
assert(i < 2 && "Successor # out of range for invoke!");
- return i == 0 ? getNormalDest() : getExceptionalDest();
+ return i == 0 ? getNormalDest() : getUnwindDest();
}
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
InvokingSF.Caller = CallSite ();
// Go to exceptional destination BB of invoke instruction
- SwitchToNewBasicBlock (cast<InvokeInst> (Inst)->getExceptionalDest (),
- InvokingSF);
+ SwitchToNewBasicBlock(cast<InvokeInst>(Inst)->getUnwindDest(), InvokingSF);
}
void Interpreter::visitBranchInst(BranchInst &I) {
<< " Entry.next = __llvm_jmpbuf_list;\n"
<< " if (setjmp(Entry.buf)) {\n"
<< " __llvm_jmpbuf_list = Entry.next;\n";
- printBranchToBlock(II.getParent(), II.getExceptionalDest(), 4);
+ printBranchToBlock(II.getParent(), II.getUnwindDest(), 4);
Out << " }\n"
<< " __llvm_jmpbuf_list = &Entry;\n"
<< " ";
<< " Entry.next = __llvm_jmpbuf_list;\n"
<< " if (setjmp(Entry.buf)) {\n"
<< " __llvm_jmpbuf_list = Entry.next;\n";
- printBranchToBlock(II.getParent(), II.getExceptionalDest(), 4);
+ printBranchToBlock(II.getParent(), II.getUnwindDest(), 4);
Out << " }\n"
<< " __llvm_jmpbuf_list = &Entry;\n"
<< " ";
Instruction *New;
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
- New = new InvokeInst(NF, II->getNormalDest(), II->getExceptionalDest(),
+ New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
Args, "", Call);
} else {
New = new CallInst(NF, Args, "", Call);
if (!DFSBlocks.count(BB)) return;
BasicBlock* NormalBB = II.getNormalDest();
- BasicBlock* ExceptBB = II.getExceptionalDest();
+ BasicBlock* ExceptBB = II.getUnwindDest();
Function* Func = BB->getParent();
BasicBlock* NewExceptBB = new BasicBlock("InvokeExcept", Func);
new BranchInst(PrelimBBMap[Func], ExceptBB, IsLJExcept, NewExceptBB);
- II.setExceptionalDest(NewExceptBB);
+ II.setUnwindDest(NewExceptBB);
++InvokesTransformed;
}
// Anything that used the value produced by the invoke instruction
// now uses the value produced by the call instruction.
II->replaceAllUsesWith(Call);
- II->getExceptionalDest()->removePredecessor(II->getParent());
+ II->getUnwindDest()->removePredecessor(II->getParent());
// Insert a branch to the normal destination right before the
// invoke.
UI != E; ++UI)
if (PHINode *PN = dyn_cast<PHINode>(*UI))
if (PN->getParent() == II->getNormalDest() ||
- PN->getParent() == II->getExceptionalDest())
+ PN->getParent() == II->getUnwindDest())
return false;
}
Instruction *NC;
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
- NC = new InvokeInst(Callee, II->getNormalDest(), II->getExceptionalDest(),
+ NC = new InvokeInst(Callee, II->getNormalDest(), II->getUnwindDest(),
Args, Caller->getName(), Caller);
} else {
NC = new CallInst(Callee, Args, Caller->getName(), Caller);
// any inlined 'unwind' instructions into branches to the invoke exception
// destination, and call instructions into invoke instructions.
if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
- BasicBlock *InvokeDest = II->getExceptionalDest();
+ BasicBlock *InvokeDest = II->getUnwindDest();
std::vector<Value*> InvokeDestPHIValues;
// If there are PHI nodes in the exceptional destination block, we need to
new BranchInst(II->getNormalDest(), II);
// Remove any PHI node entries from the exception destination.
- II->getExceptionalDest()->removePredecessor(BB);
+ II->getUnwindDest()->removePredecessor(BB);
// Remove the invoke instruction now.
BB->getInstList().erase(II);
new StoreInst(OldEntry, JBListHead, InsertLoc);
// Now we change the invoke into a branch instruction.
- new BranchInst(II->getNormalDest(), II->getExceptionalDest(), IsNormal, II);
+ new BranchInst(II->getNormalDest(), II->getUnwindDest(), IsNormal, II);
// Remove the InvokeInst now.
BB->getInstList().erase(II);
while (!Preds.empty()) {
BasicBlock *Pred = Preds.back();
if (InvokeInst *II = dyn_cast<InvokeInst>(Pred->getTerminator()))
- if (II->getExceptionalDest() == BB) {
+ if (II->getUnwindDest() == BB) {
// Insert a new branch instruction before the invoke, because this
// is now a fall through...
BranchInst *BI = new BranchInst(II->getNormalDest(), II);
Out << " )\n\t\t\tto";
writeOperand(II->getNormalDest(), true);
Out << " except";
- writeOperand(II->getExceptionalDest(), true);
+ writeOperand(II->getUnwindDest(), true);
} else if (const AllocationInst *AI = dyn_cast<AllocationInst>(&I)) {
Out << " ";