Remove obsolete method
[oota-llvm.git] / lib / VMCore / iBranch.cpp
index 7a352eeb46eefe2f6628b57772da083cc0d8c3d7..78951b2965d09bec000ee0d1d96e57da4945ae2a 100644 (file)
@@ -1,4 +1,11 @@
-//===-- iBranch.cpp - Implement the Branch instruction -----------*- C++ -*--=//
+//===-- iBranch.cpp - Implement the Branch instruction --------------------===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file implements the 'br' instruction, which can represent either a 
 // conditional or unconditional branch.
 
 #include "llvm/iTerminators.h"
 #include "llvm/BasicBlock.h"
-#ifndef NDEBUG
-#include "llvm/Type.h"       // Only used for assertions...
-#include <iostream>
-#endif
+#include "llvm/Type.h"
+using namespace llvm;
+
+// Out-of-line ReturnInst method, put here so the C++ compiler can choose to
+// emit the vtable for the class in this translation unit.
+void ReturnInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
+  assert(0 && "ReturnInst has no successors!");
+}
 
-BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond) 
-  : TerminatorInst(Instruction::Br) {
+// Likewise for UnwindInst
+void UnwindInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
+  assert(0 && "UnwindInst has no successors!");
+}
+
+BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond,
+                       Instruction *InsertBefore) 
+  : TerminatorInst(Instruction::Br, InsertBefore) {
   assert(True != 0 && "True branch destination may not be null!!!");
   Operands.reserve(False ? 3 : 1);
   Operands.push_back(Use(True, this));
@@ -24,18 +41,41 @@ BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond)
 
   assert(!!False == !!Cond &&
         "Either both cond and false or neither can be specified!");
+  assert((Cond == 0 || Cond->getType() == Type::BoolTy) && 
+         "May only branch on boolean predicates!!!!");
+}
 
-#ifndef NDEBUG
-  if (Cond != 0 && Cond->getType() != Type::BoolTy) {
-    std::cerr << "Bad Condition: ";
-    Cond->dump();
-    std::cerr << "\n";
+BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond,
+                       BasicBlock *InsertAtEnd) 
+  : TerminatorInst(Instruction::Br, InsertAtEnd) {
+  assert(True != 0 && "True branch destination may not be null!!!");
+  Operands.reserve(False ? 3 : 1);
+  Operands.push_back(Use(True, this));
+  if (False) {
+    Operands.push_back(Use(False, this));
+    Operands.push_back(Use(Cond, this));
   }
-#endif
+
+  assert(!!False == !!Cond &&
+        "Either both cond and false or neither can be specified!");
   assert((Cond == 0 || Cond->getType() == Type::BoolTy) && 
          "May only branch on boolean predicates!!!!");
 }
 
+BranchInst::BranchInst(BasicBlock *True, Instruction *InsertBefore) 
+  : TerminatorInst(Instruction::Br, InsertBefore) {
+  assert(True != 0 && "True branch destination may not be null!!!");
+  Operands.reserve(1);
+  Operands.push_back(Use(True, this));
+}
+
+BranchInst::BranchInst(BasicBlock *True, BasicBlock *InsertAtEnd) 
+  : TerminatorInst(Instruction::Br, InsertAtEnd) {
+  assert(True != 0 && "True branch destination may not be null!!!");
+  Operands.reserve(1);
+  Operands.push_back(Use(True, this));
+}
+
 BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) {
   Operands.reserve(BI.Operands.size());
   Operands.push_back(Use(BI.Operands[0], this));