aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp15
-rw-r--r--lib/VMCore/BasicBlock.cpp38
-rw-r--r--lib/VMCore/Verifier.cpp6
3 files changed, 9 insertions, 50 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 11586b5..7af26d0 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1163,18 +1163,9 @@ void AssemblyWriter::printArgument(const Argument *Arg,
/// printBasicBlock - This member is called for each basic block in a method.
///
void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
- if (BB->hasName()) // Print out the label if it exists...
- Out << '\n' << getLLVMName(BB->getName(), LabelPrefix) << ':';
-
- if (const BasicBlock* unwindDest = BB->getUnwindDest()) {
- if (BB->hasName())
- Out << ' ';
-
- Out << "unwinds to";
- writeOperand(unwindDest, false);
- }
-
- if (!BB->hasName() && !BB->use_empty()) { // Don't print block # of no uses...
+ if (BB->hasName()) { // Print out the label if it exists...
+ Out << "\n" << getLLVMName(BB->getName(), LabelPrefix) << ':';
+ } else if (!BB->use_empty()) { // Don't print block # of no uses...
Out << "\n; <label>:";
int Slot = Machine.getLocalSlot(BB);
if (Slot != -1)
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 16aa7fa..17469d6 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -74,8 +74,8 @@ template class SymbolTableListTraits<Instruction, BasicBlock>;
BasicBlock::BasicBlock(const std::string &Name, Function *NewParent,
- BasicBlock *InsertBefore, BasicBlock *Dest)
- : User(Type::LabelTy, Value::BasicBlockVal, &unwindDest, 0/*FIXME*/), Parent(0) {
+ BasicBlock *InsertBefore)
+ : Value(Type::LabelTy, Value::BasicBlockVal), Parent(0) {
// Make sure that we get added to a function
LeakDetector::addGarbageObject(this);
@@ -89,8 +89,6 @@ BasicBlock::BasicBlock(const std::string &Name, Function *NewParent,
}
setName(Name);
- unwindDest.init(NULL, this);
- setUnwindDest(Dest);
}
@@ -119,19 +117,6 @@ void BasicBlock::eraseFromParent() {
getParent()->getBasicBlockList().erase(this);
}
-const BasicBlock *BasicBlock::getUnwindDest() const {
- return cast_or_null<const BasicBlock>(unwindDest.get());
-}
-
-BasicBlock *BasicBlock::getUnwindDest() {
- return cast_or_null<BasicBlock>(unwindDest.get());
-}
-
-void BasicBlock::setUnwindDest(BasicBlock *dest) {
- NumOperands = unwindDest ? 1 : 0;
- unwindDest.set(dest);
-}
-
/// moveBefore - Unlink this basic block from its current function and
/// insert it into the function that MovePos lives in, right before MovePos.
void BasicBlock::moveBefore(BasicBlock *MovePos) {
@@ -170,7 +155,6 @@ Instruction* BasicBlock::getFirstNonPHI()
}
void BasicBlock::dropAllReferences() {
- setUnwindDest(NULL);
for(iterator I = begin(), E = end(); I != E; ++I)
I->dropAllReferences();
}
@@ -192,8 +176,7 @@ BasicBlock *BasicBlock::getSinglePredecessor() {
/// called while the predecessor still refers to this block.
///
void BasicBlock::removePredecessor(BasicBlock *Pred,
- bool DontDeleteUselessPHIs,
- bool OnlyDeleteOne) {
+ bool DontDeleteUselessPHIs) {
assert((hasNUsesOrMore(16)||// Reduce cost of this assertion for complex CFGs.
find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) &&
"removePredecessor: BB is not a predecessor!");
@@ -228,11 +211,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
// Yup, loop through and nuke the PHI nodes
while (PHINode *PN = dyn_cast<PHINode>(&front())) {
// Remove the predecessor first.
- if (OnlyDeleteOne) {
- int idx = PN->getBasicBlockIndex(Pred);
- PN->removeIncomingValue(idx, !DontDeleteUselessPHIs);
- } else
- PN->removeIncomingValue(Pred, !DontDeleteUselessPHIs);
+ PN->removeIncomingValue(Pred, !DontDeleteUselessPHIs);
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
if (max_idx == 2) {
@@ -253,12 +232,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
PHINode *PN;
for (iterator II = begin(); (PN = dyn_cast<PHINode>(II)); ) {
++II;
- if (OnlyDeleteOne) {
- int idx = PN->getBasicBlockIndex(Pred);
- PN->removeIncomingValue(idx, false);
- } else
- PN->removeIncomingValue(Pred, false);
-
+ PN->removeIncomingValue(Pred, false);
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
Value* PNV = 0;
@@ -287,7 +261,7 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) {
assert(I != InstList.end() &&
"Trying to get me to create degenerate basic block!");
- BasicBlock *New = new(0/*FIXME*/) BasicBlock(BBName, getParent(), getNext());
+ BasicBlock *New = BasicBlock::Create(BBName, getParent(), getNext());
// Move all of the specified instructions from the original basic block into
// the new basic block.
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index a0d7d0f..7449fe7 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -530,12 +530,6 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
// Ensure that basic blocks have terminators!
Assert1(BB.getTerminator(), "Basic Block does not have terminator!", &BB);
- // Ensure that the BB doesn't point out of its Function for unwinding.
- Assert2(!BB.getUnwindDest() ||
- BB.getUnwindDest()->getParent() == BB.getParent(),
- "Basic Block unwinds to block in different function!",
- &BB, BB.getUnwindDest());
-
// Check constraints that this basic block imposes on all of the PHI nodes in
// it.
if (isa<PHINode>(BB.front())) {