Make iostream #inclusion explicit
[oota-llvm.git] / lib / VMCore / Instruction.cpp
index 4ccbd74dfdd4f3c2e37cc00849a853c098d2ca8b..a44b5e4b11ae410e338c5493c6b98fddcd64cacc 100644 (file)
@@ -1,10 +1,10 @@
 //===-- Instruction.cpp - Implement the Instruction class -----------------===//
-// 
+//
 //                     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 Instruction class for the VMCore library.
@@ -65,6 +65,15 @@ void Instruction::eraseFromParent() {
   getParent()->getInstList().erase(this);
 }
 
+/// moveBefore - Unlink this instruction from its current basic block and
+/// insert it into the basic block that MovePos lives in, right before
+/// MovePos.
+void Instruction::moveBefore(Instruction *MovePos) {
+  MovePos->getParent()->getInstList().splice(MovePos,getParent()->getInstList(),
+                                             this);
+}
+
+
 const char *Instruction::getOpcodeName(unsigned OpCode) {
   switch (OpCode) {
   // Terminators
@@ -74,7 +83,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
   case Invoke: return "invoke";
   case Unwind: return "unwind";
   case Unreachable: return "unreachable";
-    
+
   // Standard binary operators...
   case Add: return "add";
   case Sub: return "sub";
@@ -94,7 +103,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
   case SetGT:  return "setgt";
   case SetEQ:  return "seteq";
   case SetNE:  return "setne";
-    
+
   // Memory instructions...
   case Malloc:        return "malloc";
   case Free:          return "free";
@@ -102,7 +111,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
   case Load:          return "load";
   case Store:         return "store";
   case GetElementPtr: return "getelementptr";
-    
+
   // Other instructions...
   case PHI:     return "phi";
   case Cast:    return "cast";
@@ -110,12 +119,13 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
   case Call:    return "call";
   case Shl:     return "shl";
   case Shr:     return "shr";
-  case VANext:  return "vanext";
-  case VAArg:   return "vaarg";
+  case VAArg:   return "va_arg";
+  case ExtractElement: return "extractelement";
+  case InsertElement: return "insertelement";
 
   default: return "<Invalid operator> ";
   }
-  
+
   return 0;
 }
 
@@ -139,8 +149,8 @@ bool Instruction::isIdenticalTo(Instruction *I) const {
     return LI->isVolatile() == cast<LoadInst>(I)->isVolatile();
   if (const StoreInst *SI = dyn_cast<StoreInst>(this))
     return SI->isVolatile() == cast<StoreInst>(I)->isVolatile();
-  if (const VANextInst *VAN = dyn_cast<VANextInst>(this))
-    return VAN->getArgType() == cast<VANextInst>(I)->getArgType();
+  if (const CallInst *CI = dyn_cast<CallInst>(this))
+    return CI->isTailCall() == cast<CallInst>(I)->isTailCall();
   return true;
 }
 
@@ -172,7 +182,7 @@ bool Instruction::isCommutative(unsigned op) {
   switch (op) {
   case Add:
   case Mul:
-  case And: 
+  case And:
   case Or:
   case Xor:
   case SetEQ: