#include "llvm/Type.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/LeakDetector.h"
-#include "llvm/Support/Visibility.h"
+#include "llvm/Support/Compiler.h"
#include "SymbolTableListTraitsImpl.h"
#include <algorithm>
using namespace llvm;
BasicBlock::BasicBlock(const std::string &Name, Function *Parent,
BasicBlock *InsertBefore)
- : Value(Type::LabelTy, Value::BasicBlockVal, Name) {
+ : Value(Type::LabelTy, Value::BasicBlockVal) {
// Initialize the instlist...
InstList.setItemParent(this);
} else if (Parent) {
Parent->getBasicBlockList().push_back(this);
}
+
+ setName(Name);
}
getParent()->getBasicBlockList().erase(this);
}
-/// moveBefore - Unlink this instruction from its current function and
-/// insert it into the function that MovePos lives in, right before
-/// MovePos.
+/// 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) {
MovePos->getParent()->getBasicBlockList().splice(MovePos,
getParent()->getBasicBlockList(), this);
}
+/// moveAfter - Unlink this basic block from its current function and
+/// insert it into the function that MovePos lives in, right after MovePos.
+void BasicBlock::moveAfter(BasicBlock *MovePos) {
+ Function::iterator I = MovePos;
+ MovePos->getParent()->getBasicBlockList().splice(++I,
+ getParent()->getBasicBlockList(), this);
+}
+
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return 0;