X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FInstruction.cpp;h=8b13e6e75b79951a3fbba946c0f9b13be82361d3;hb=25abb1dc094a08a3ba5cb426698b4780cbe438bb;hp=eeba47b52e9ef6398796684df7ba6611af320fc8;hpb=18221ed50707342bc4c655b33a3d3dc652463811;p=oota-llvm.git diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index eeba47b52e9..8b13e6e75b7 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -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. @@ -57,15 +57,6 @@ void Instruction::setParent(BasicBlock *P) { 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); } @@ -74,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 @@ -83,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"; @@ -103,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"; @@ -111,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"; @@ -119,12 +119,12 @@ 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"; default: return " "; } - + return 0; } @@ -148,8 +148,8 @@ bool Instruction::isIdenticalTo(Instruction *I) const { return LI->isVolatile() == cast(I)->isVolatile(); if (const StoreInst *SI = dyn_cast(this)) return SI->isVolatile() == cast(I)->isVolatile(); - if (const VANextInst *VAN = dyn_cast(this)) - return VAN->getArgType() == cast(I)->getArgType(); + if (const CallInst *CI = dyn_cast(this)) + return CI->isTailCall() == cast(I)->isTailCall(); return true; } @@ -181,7 +181,7 @@ bool Instruction::isCommutative(unsigned op) { switch (op) { case Add: case Mul: - case And: + case And: case Or: case Xor: case SetEQ: