//===-- 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.
Parent = P;
}
-// Specialize setName to take care of symbol table majik
-void Instruction::setName(const std::string &name) {
- BasicBlock *P = 0; Function *PP = 0;
- if ((P = getParent()) && (PP = P->getParent()) && hasName())
- PP->getSymbolTable().remove(this);
- Value::setName(name);
- if (PP && hasName()) PP->getSymbolTable().insert(this);
-}
-
void Instruction::removeFromParent() {
getParent()->getInstList().remove(this);
}
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
case Invoke: return "invoke";
case Unwind: return "unwind";
case Unreachable: return "unreachable";
-
+
// Standard binary operators...
case Add: return "add";
case Sub: return "sub";
case SetGT: return "setgt";
case SetEQ: return "seteq";
case SetNE: return "setne";
-
+
// Memory instructions...
case Malloc: return "malloc";
case Free: return "free";
case Load: return "load";
case Store: return "store";
case GetElementPtr: return "getelementptr";
-
+
// Other instructions...
case PHI: return "phi";
case Cast: return "cast";
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";
default: return "<Invalid operator> ";
}
-
+
return 0;
}
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;
}
switch (op) {
case Add:
case Mul:
- case And:
+ case And:
case Or:
case Xor:
case SetEQ: