X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=lib%2FVMCore%2FInstruction.cpp;h=7fc6245f6da5b526251e837c7a760f317467e08c;hb=afba8fe662d65b25b4baf46bb26cc18e1f9cc0a5;hp=48c73a08400c076316c5247ac002c6ca8fd396fe;hpb=fadb3f773e5ab171315761d151c1416921d25614;p=oota-llvm.git diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 48c73a08400..7fc6245f6da 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -13,13 +13,14 @@ #include "llvm/Type.h" #include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" +#include "llvm/IntrinsicInst.h" // FIXME: remove #include "llvm/Function.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/LeakDetector.h" using namespace llvm; Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, - const std::string &Name, Instruction *InsertBefore) + Instruction *InsertBefore) : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) { // Make sure that we get added to a basicblock LeakDetector::addGarbageObject(this); @@ -30,11 +31,10 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, "Instruction to insert before is not in a basic block!"); InsertBefore->getParent()->getInstList().insert(InsertBefore, this); } - setName(Name); } Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, - const std::string &Name, BasicBlock *InsertAtEnd) + BasicBlock *InsertAtEnd) : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) { // Make sure that we get added to a basicblock LeakDetector::addGarbageObject(this); @@ -42,34 +42,6 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, // append this instruction into the basic block assert(InsertAtEnd && "Basic block to append to may not be NULL!"); InsertAtEnd->getInstList().push_back(this); - setName(Name); -} - -Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, - const char *Name, Instruction *InsertBefore) - : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) { - // Make sure that we get added to a basicblock - LeakDetector::addGarbageObject(this); - - // If requested, insert this instruction into a basic block... - if (InsertBefore) { - assert(InsertBefore->getParent() && - "Instruction to insert before is not in a basic block!"); - InsertBefore->getParent()->getInstList().insert(InsertBefore, this); - } - if (Name && *Name) setName(Name); -} - -Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, - const char *Name, BasicBlock *InsertAtEnd) - : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) { - // Make sure that we get added to a basicblock - LeakDetector::addGarbageObject(this); - - // append this instruction into the basic block - assert(InsertAtEnd && "Basic block to append to may not be NULL!"); - InsertAtEnd->getInstList().push_back(this); - if (Name && *Name) setName(Name); } @@ -232,15 +204,14 @@ bool Instruction::mayWriteToMemory() const { switch (getOpcode()) { default: return false; case Instruction::Free: - case Instruction::Store: case Instruction::Invoke: + case Instruction::Store: case Instruction::VAArg: return true; case Instruction::Call: - if (const IntrinsicInst *II = dyn_cast(this)) { - // If the intrinsic doesn't write memory, it is safe. - } - return true; + if (!isa(this)) + return true; // FIXME: workaround gcc bootstrap breakage + return !cast(this)->onlyReadsMemory(); case Instruction::Load: return cast(this)->isVolatile(); }