aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
commit10c6d12a9fd4dab411091f64db4db69670b88850 (patch)
tree629a8bff765bcf0baa378c7367ab1d903f3910fc /lib/VMCore
parentefd7919618d59bd0e3fcf861cc0d1eacbbed0ac6 (diff)
downloadexternal_llvm-10c6d12a9fd4dab411091f64db4db69670b88850.zip
external_llvm-10c6d12a9fd4dab411091f64db4db69670b88850.tar.gz
external_llvm-10c6d12a9fd4dab411091f64db4db69670b88850.tar.bz2
Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp30
-rw-r--r--lib/VMCore/Core.cpp23
-rw-r--r--lib/VMCore/Instruction.cpp2
-rw-r--r--lib/VMCore/Instructions.cpp122
-rw-r--r--lib/VMCore/Verifier.cpp69
5 files changed, 13 insertions, 233 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index e3e2484..825a7c1 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1731,9 +1731,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
writeOperand(I.getOperand(i), true);
}
Out << ']';
- } else if (isa<ResumeInst>(I)) {
- Out << ' ';
- writeOperand(Operand, true);
} else if (const PHINode *PN = dyn_cast<PHINode>(&I)) {
Out << ' ';
TypePrinter.print(I.getType(), Out);
@@ -1756,33 +1753,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
writeOperand(I.getOperand(1), true);
for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i)
Out << ", " << *i;
- } else if (const LandingPadInst *LPI = dyn_cast<LandingPadInst>(&I)) {
- Out << ' ';
- TypePrinter.print(I.getType(), Out);
- Out << " personality ";
- writeOperand(LPI->getPersonalityFn(), true); Out << '\n';
-
- if (LPI->isCleanup())
- Out << " cleanup";
-
- for (unsigned i = 0, e = LPI->getNumClauses(); i != e; ) {
- if (i != 0 || LPI->isCleanup()) Out << "\n";
-
- SmallVector<const Value*, 8> Vals;
- LandingPadInst::ClauseType CT = LPI->getClauseType(i);
- for (; i != e && LPI->getClauseType(i) == CT; ++i)
- Vals.push_back(LPI->getClauseValue(i));
-
- if (CT == LandingPadInst::Catch)
- Out << " catch ";
- else
- Out << " filter ";
-
- for (unsigned II = 0, IE = Vals.size(); II != IE; ++II) {
- if (II != 0) Out << ", ";
- writeOperand(Vals[II], true);
- }
- }
} else if (isa<ReturnInst>(I) && !Operand) {
Out << " void";
} else if (const CallInst *CI = dyn_cast<CallInst>(&I)) {
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 318805b..3c93736 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -1683,22 +1683,10 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
Name));
}
-LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
- LLVMValueRef PersFn, unsigned NumClauses,
- const char *Name) {
- return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty),
- cast<Function>(unwrap(PersFn)),
- NumClauses, Name));
-}
-
LLVMValueRef LLVMBuildUnwind(LLVMBuilderRef B) {
return wrap(unwrap(B)->CreateUnwind());
}
-LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn) {
- return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
-}
-
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B) {
return wrap(unwrap(B)->CreateUnreachable());
}
@@ -1712,17 +1700,6 @@ void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest) {
unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
}
-void LLVMAddClause(LLVMValueRef LandingPad, LLVMLandingPadClauseTy ClauseTy,
- LLVMValueRef ClauseVal) {
- unwrap<LandingPadInst>(LandingPad)->
- addClause(static_cast<LandingPadInst::ClauseType>(ClauseTy),
- cast<Constant>(unwrap(ClauseVal)));
-}
-
-void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
- unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
-}
-
/*--.. Arithmetic ..........................................................--*/
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index eadcd09..c4365fc 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -101,7 +101,6 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
case Switch: return "switch";
case IndirectBr: return "indirectbr";
case Invoke: return "invoke";
- case Resume: return "resume";
case Unwind: return "unwind";
case Unreachable: return "unreachable";
@@ -162,7 +161,6 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
case ShuffleVector: return "shufflevector";
case ExtractValue: return "extractvalue";
case InsertValue: return "insertvalue";
- case LandingPad: return "landingpad";
default: return "<Invalid operator> ";
}
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index abee7b7..75458ba 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -166,77 +166,6 @@ Value *PHINode::hasConstantValue() const {
return ConstantValue;
}
-//===----------------------------------------------------------------------===//
-// LandingPadInst Implementation
-//===----------------------------------------------------------------------===//
-
-void LandingPadInst::init(Function *PersFn, unsigned NumReservedValues,
- const Twine &NameStr) {
- ReservedSpace = NumReservedValues;
- NumOperands = 1;
- OperandList = allocHungoffUses(ReservedSpace);
- OperandList[0] = (Value*)PersFn;
- setName(NameStr);
-}
-
-LandingPadInst::LandingPadInst(const LandingPadInst &LP)
- : Instruction(LP.getType(), Instruction::LandingPad,
- allocHungoffUses(LP.getNumOperands()), LP.getNumOperands()),
- ReservedSpace(LP.getNumOperands()) {
- Use *OL = OperandList, *InOL = LP.OperandList;
- for (unsigned I = 0, E = ReservedSpace; I != E; ++I)
- OL[I] = InOL[I];
-
- for (SmallVectorImpl<ClauseType>::const_iterator
- I = LP.ClauseIdxs.begin(), E = LP.ClauseIdxs.end(); I != E; ++I)
- ClauseIdxs.push_back(*I);
-
- IsCleanup = LP.IsCleanup;
- SubclassOptionalData = LP.SubclassOptionalData;
-}
-
-LandingPadInst::~LandingPadInst() {
- dropHungoffUses();
-}
-
-/// growOperands - grow operands - This grows the operand list in response to a
-/// push_back style of operation. This grows the number of ops by 2 times.
-void LandingPadInst::growOperands() {
- unsigned e = getNumOperands();
- ReservedSpace = e * 2;
-
- Use *NewOps = allocHungoffUses(ReservedSpace);
- Use *OldOps = OperandList;
- for (unsigned i = 0; i != e; ++i)
- NewOps[i] = OldOps[i];
-
- OperandList = NewOps;
- Use::zap(OldOps, OldOps + e, true);
-}
-
-void LandingPadInst::reserveClauses(unsigned Size) {
- unsigned e = getNumOperands();
- if (ReservedSpace >= e + Size) return;
- ReservedSpace = e + Size;
-
- Use *NewOps = allocHungoffUses(ReservedSpace);
- Use *OldOps = OperandList;
- for (unsigned i = 0; i != e; ++i)
- NewOps[i] = OldOps[i];
-
- OperandList = NewOps;
- Use::zap(OldOps, OldOps + e, true);
-}
-
-void LandingPadInst::addClause(ClauseType CT, Constant *ClauseVal) {
- unsigned OpNo = getNumOperands();
- if (OpNo + 1 > ReservedSpace)
- growOperands();
- assert(OpNo < ReservedSpace && "Growing didn't work!");
- ClauseIdxs.push_back(CT);
- ++NumOperands;
- OperandList[OpNo] = (Value*)ClauseVal;
-}
//===----------------------------------------------------------------------===//
// CallInst Implementation
@@ -565,9 +494,6 @@ void InvokeInst::removeAttribute(unsigned i, Attributes attr) {
setAttributes(PAL);
}
-LandingPadInst *InvokeInst::getLandingPad() const {
- return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
-}
//===----------------------------------------------------------------------===//
// ReturnInst Implementation
@@ -648,42 +574,6 @@ BasicBlock *UnwindInst::getSuccessorV(unsigned idx) const {
}
//===----------------------------------------------------------------------===//
-// ResumeInst Implementation
-//===----------------------------------------------------------------------===//
-
-ResumeInst::ResumeInst(const ResumeInst &RI)
- : TerminatorInst(Type::getVoidTy(RI.getContext()), Instruction::Resume,
- OperandTraits<ResumeInst>::op_begin(this), 1) {
- Op<0>() = RI.Op<0>();
- SubclassOptionalData = RI.SubclassOptionalData;
-}
-
-ResumeInst::ResumeInst(LLVMContext &C, Value *Exn, Instruction *InsertBefore)
- : TerminatorInst(Type::getVoidTy(C), Instruction::Resume,
- OperandTraits<ResumeInst>::op_begin(this), 1, InsertBefore) {
- Op<0>() = Exn;
-}
-
-ResumeInst::ResumeInst(LLVMContext &C, Value *Exn, BasicBlock *InsertAtEnd)
- : TerminatorInst(Type::getVoidTy(C), Instruction::Resume,
- OperandTraits<ResumeInst>::op_begin(this), 1, InsertAtEnd) {
- Op<0>() = Exn;
-}
-
-unsigned ResumeInst::getNumSuccessorsV() const {
- return getNumSuccessors();
-}
-
-void ResumeInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) {
- llvm_unreachable("ResumeInst has no successors!");
-}
-
-BasicBlock *ResumeInst::getSuccessorV(unsigned idx) const {
- llvm_unreachable("ResumeInst has no successors!");
- return 0;
-}
-
-//===----------------------------------------------------------------------===//
// UnreachableInst Implementation
//===----------------------------------------------------------------------===//
@@ -702,11 +592,11 @@ unsigned UnreachableInst::getNumSuccessorsV() const {
}
void UnreachableInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) {
- llvm_unreachable("UnreachableInst has no successors!");
+ llvm_unreachable("UnwindInst has no successors!");
}
BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const {
- llvm_unreachable("UnreachableInst has no successors!");
+ llvm_unreachable("UnwindInst has no successors!");
return 0;
}
@@ -3343,10 +3233,6 @@ PHINode *PHINode::clone_impl() const {
return new PHINode(*this);
}
-LandingPadInst *LandingPadInst::clone_impl() const {
- return new LandingPadInst(*this);
-}
-
ReturnInst *ReturnInst::clone_impl() const {
return new(getNumOperands()) ReturnInst(*this);
}
@@ -3368,10 +3254,6 @@ InvokeInst *InvokeInst::clone_impl() const {
return new(getNumOperands()) InvokeInst(*this);
}
-ResumeInst *ResumeInst::clone_impl() const {
- return new(1) ResumeInst(*this);
-}
-
UnwindInst *UnwindInst::clone_impl() const {
LLVMContext &Context = getContext();
return new UnwindInst(Context);
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index d405baa..d81e8ec 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -35,12 +35,6 @@
// * It is illegal to have a ret instruction that returns a value that does not
// agree with the function return value type.
// * Function call argument types match the function prototype
-// * A landing pad is defined by a landingpad instruction, and can be jumped to
-// only by the unwind edge of an invoke instruction.
-// * A landingpad instruction must be the first non-PHI instruction in the
-// block.
-// * All landingpad instructions must use the same personality function with
-// the same function.
// * All other things that are tested by asserts spread about the code...
//
//===----------------------------------------------------------------------===//
@@ -137,22 +131,18 @@ namespace {
/// already.
SmallPtrSet<MDNode *, 32> MDNodes;
- /// PersonalityFn - The personality function referenced by the
- /// LandingPadInsts. All LandingPadInsts within the same function must use
- /// the same personality function.
- const Value *PersonalityFn;
-
Verifier()
- : FunctionPass(ID), Broken(false), RealPass(true),
- action(AbortProcessAction), Mod(0), Context(0), DT(0),
- MessagesStr(Messages), PersonalityFn(0) {
- initializeVerifierPass(*PassRegistry::getPassRegistry());
- }
+ : FunctionPass(ID),
+ Broken(false), RealPass(true), action(AbortProcessAction),
+ Mod(0), Context(0), DT(0), MessagesStr(Messages) {
+ initializeVerifierPass(*PassRegistry::getPassRegistry());
+ }
explicit Verifier(VerifierFailureAction ctn)
- : FunctionPass(ID), Broken(false), RealPass(true), action(ctn), Mod(0),
- Context(0), DT(0), MessagesStr(Messages), PersonalityFn(0) {
- initializeVerifierPass(*PassRegistry::getPassRegistry());
- }
+ : FunctionPass(ID),
+ Broken(false), RealPass(true), action(ctn), Mod(0), Context(0), DT(0),
+ MessagesStr(Messages) {
+ initializeVerifierPass(*PassRegistry::getPassRegistry());
+ }
bool doInitialization(Module &M) {
Mod = &M;
@@ -294,7 +284,6 @@ namespace {
void visitAllocaInst(AllocaInst &AI);
void visitExtractValueInst(ExtractValueInst &EVI);
void visitInsertValueInst(InsertValueInst &IVI);
- void visitLandingPadInst(LandingPadInst &LPI);
void VerifyCallSite(CallSite CS);
bool PerformTypeCheck(Intrinsic::ID ID, Function *F, Type *Ty,
@@ -1372,7 +1361,7 @@ void Verifier::visitFenceInst(FenceInst &FI) {
Assert1(Ordering == Acquire || Ordering == Release ||
Ordering == AcquireRelease || Ordering == SequentiallyConsistent,
"fence instructions may only have "
- "acquire, release, acq_rel, or seq_cst ordering.", &FI);
+ " acquire, release, acq_rel, or seq_cst ordering.", &FI);
visitInstruction(FI);
}
@@ -1394,42 +1383,6 @@ void Verifier::visitInsertValueInst(InsertValueInst &IVI) {
visitInstruction(IVI);
}
-void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
- BasicBlock *BB = LPI.getParent();
-
- // The landingpad instruction is ill-formed if it doesn't have any clauses and
- // isn't a cleanup.
- Assert1(LPI.getNumClauses() > 0 || LPI.isCleanup(),
- "LandingPadInst needs at least one clause or to be a cleanup.", &LPI);
-
- // The landingpad instruction defines its parent as a landing pad block. The
- // landing pad block may be branched to only by the unwind edge of an invoke.
- for (pred_iterator I = pred_begin(BB), E = pred_end(BB); I != E; ++I) {
- const InvokeInst *II = dyn_cast<InvokeInst>((*I)->getTerminator());
- Assert1(II && II->getUnwindDest() == BB,
- "Block containing LandingPadInst must be jumped to "
- "only by the unwind edge of an invoke.", &LPI);
- }
-
- // The landingpad instruction must be the first non-PHI instruction in the
- // block.
- BasicBlock::iterator I = BB->begin(), E = BB->end();
- while (I != E && isa<PHINode>(I))
- ++I;
- Assert1(I != E && isa<LandingPadInst>(I) && I == LPI,
- "LandingPadInst not the first non-PHI instruction in the block.",
- &LPI);
-
- // The personality functions for all landingpad instructions within the same
- // function should match.
- if (PersonalityFn)
- Assert1(LPI.getPersonalityFn() == PersonalityFn,
- "Personality function doesn't match others in function", &LPI);
- PersonalityFn = LPI.getPersonalityFn();
-
- visitInstruction(LPI);
-}
-
/// verifyInstruction - Verify that an instruction is well formed.
///
void Verifier::visitInstruction(Instruction &I) {