X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FIR%2FInstruction.cpp;h=b5a30a4969b3e2bb3aa63d160ac4cbfb24cbb630;hp=c57ba16cf6cad9b1032dc1387abb0ea7b38026be;hb=32310b78d7799109e0e6d99a317b15aa8e8b6216;hpb=f79d253a3ea33ce7242d22c1e9965c13fde32340 diff --git a/lib/IR/Instruction.cpp b/lib/IR/Instruction.cpp index c57ba16cf6c..b5a30a4969b 100644 --- a/lib/IR/Instruction.cpp +++ b/lib/IR/Instruction.cpp @@ -28,7 +28,7 @@ Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps, if (InsertBefore) { BasicBlock *BB = InsertBefore->getParent(); assert(BB && "Instruction to insert before is not in a basic block!"); - BB->getInstList().insert(InsertBefore, this); + BB->getInstList().insert(InsertBefore->getIterator(), this); } } @@ -64,31 +64,32 @@ Module *Instruction::getModule() { void Instruction::removeFromParent() { - getParent()->getInstList().remove(this); + getParent()->getInstList().remove(getIterator()); } iplist::iterator Instruction::eraseFromParent() { - return getParent()->getInstList().erase(this); + return getParent()->getInstList().erase(getIterator()); } /// insertBefore - Insert an unlinked instructions into a basic block /// immediately before the specified instruction. void Instruction::insertBefore(Instruction *InsertPos) { - InsertPos->getParent()->getInstList().insert(InsertPos, this); + InsertPos->getParent()->getInstList().insert(InsertPos->getIterator(), this); } /// insertAfter - Insert an unlinked instructions into a basic block /// immediately after the specified instruction. void Instruction::insertAfter(Instruction *InsertPos) { - InsertPos->getParent()->getInstList().insertAfter(InsertPos, this); + InsertPos->getParent()->getInstList().insertAfter(InsertPos->getIterator(), + this); } /// moveBefore - Unlink this instruction from its current basic block and /// insert it into the basic block that MovePos lives in, right before /// MovePos. void Instruction::moveBefore(Instruction *MovePos) { - MovePos->getParent()->getInstList().splice(MovePos,getParent()->getInstList(), - this); + MovePos->getParent()->getInstList().splice( + MovePos->getIterator(), getParent()->getInstList(), getIterator()); } /// Set or clear the unsafe-algebra flag on this instruction, which must be an @@ -196,6 +197,12 @@ const char *Instruction::getOpcodeName(unsigned OpCode) { case Invoke: return "invoke"; case Resume: return "resume"; case Unreachable: return "unreachable"; + case CleanupEndPad: return "cleanupendpad"; + case CleanupRet: return "cleanupret"; + case CatchEndPad: return "catchendpad"; + case CatchRet: return "catchret"; + case CatchPad: return "catchpad"; + case TerminatePad: return "terminatepad"; // Standard binary operators... case Add: return "add"; @@ -256,6 +263,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) { case ExtractValue: return "extractvalue"; case InsertValue: return "insertvalue"; case LandingPad: return "landingpad"; + case CleanupPad: return "cleanuppad"; default: return " "; } @@ -407,6 +415,9 @@ bool Instruction::mayReadFromMemory() const { case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory case Instruction::AtomicCmpXchg: case Instruction::AtomicRMW: + case Instruction::CatchPad: + case Instruction::CatchRet: + case Instruction::TerminatePad: return true; case Instruction::Call: return !cast(this)->doesNotAccessMemory(); @@ -427,6 +438,9 @@ bool Instruction::mayWriteToMemory() const { case Instruction::VAArg: case Instruction::AtomicCmpXchg: case Instruction::AtomicRMW: + case Instruction::CatchPad: + case Instruction::CatchRet: + case Instruction::TerminatePad: return true; case Instruction::Call: return !cast(this)->onlyReadsMemory(); @@ -455,6 +469,14 @@ bool Instruction::isAtomic() const { bool Instruction::mayThrow() const { if (const CallInst *CI = dyn_cast(this)) return !CI->doesNotThrow(); + if (const auto *CRI = dyn_cast(this)) + return CRI->unwindsToCaller(); + if (const auto *CEPI = dyn_cast(this)) + return CEPI->unwindsToCaller(); + if (const auto *CEPI = dyn_cast(this)) + return CEPI->unwindsToCaller(); + if (const auto *TPI = dyn_cast(this)) + return TPI->unwindsToCaller(); return isa(this); }