Ugh, the old sparc backend attaches MachineCodeForInstruction annotations on
[oota-llvm.git] / include / llvm / InstrTypes.h
index e3d3d61adb1f4327f6e706fa208e4534c7a29cf1..30ba130b892f68490fa820a263c2fe12c52509d0 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "llvm/Instruction.h"
 
+namespace llvm {
+
 //===----------------------------------------------------------------------===//
 //                            TerminatorInst Class
 //===----------------------------------------------------------------------===//
@@ -32,6 +34,7 @@ protected:
                  const std::string &Name = "", Instruction *InsertBefore = 0)
     : Instruction(Ty, iType, Name, InsertBefore) {
   }
+  TerminatorInst(Instruction::TermOps iType, BasicBlock *InsertAtEnd);
 public:
 
   /// Terminators must implement the methods required by Instruction...
@@ -48,7 +51,8 @@ public:
   virtual void setSuccessor(unsigned idx, BasicBlock *B) = 0;
 
   inline BasicBlock *getSuccessor(unsigned idx) {
-    return (BasicBlock*)((const TerminatorInst *)this)->getSuccessor(idx);
+    const TerminatorInst *TI = this;
+    return const_cast<BasicBlock*>(TI->getSuccessor(idx));
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -108,7 +112,7 @@ public:
   static       Value*    getNotArgument(      BinaryOperator* Bop);
 
   BinaryOps getOpcode() const { 
-    return (BinaryOps)Instruction::getOpcode();
+    return static_cast<BinaryOps>(Instruction::getOpcode());
   }
 
   virtual Instruction *clone() const {
@@ -134,4 +138,6 @@ public:
   }
 };
 
+} // End llvm namespace
+
 #endif