X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FInstrTypes.cpp;h=954719aa95070aae6b73a402213c899122b10670;hb=227b86c5fbf8b6d92b2ccc457264c978f67a61ce;hp=9d3262cbda7209a70a66be854ce93ce75f63d56e;hpb=9f3d27654a9c60104c93cacc869709d5d30e5367;p=oota-llvm.git diff --git a/lib/VMCore/InstrTypes.cpp b/lib/VMCore/InstrTypes.cpp index 9d3262cbda7..954719aa950 100644 --- a/lib/VMCore/InstrTypes.cpp +++ b/lib/VMCore/InstrTypes.cpp @@ -5,40 +5,23 @@ //===----------------------------------------------------------------------===// #include "llvm/iOther.h" -#include "llvm/BasicBlock.h" -#include "llvm/Method.h" +#include "llvm/iPHINode.h" +#include "llvm/Function.h" #include "llvm/SymbolTable.h" #include "llvm/Type.h" #include // find -// TODO: Move to getUnaryOperator iUnary.cpp when and if it exists! -UnaryOperator *UnaryOperator::create(UnaryOps Op, Value *Source) { - switch (Op) { - default: - cerr << "Don't know how to GetUnaryOperator " << Op << endl; - return 0; - } -} - //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// -TerminatorInst::TerminatorInst(unsigned iType) +TerminatorInst::TerminatorInst(Instruction::TermOps iType) : Instruction(Type::VoidTy, iType, "") { } - -//===----------------------------------------------------------------------===// -// MethodArgument Class -//===----------------------------------------------------------------------===// - -// Specialize setName to take care of symbol table majik -void MethodArgument::setName(const string &name) { - Method *P; - if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this); - Value::setName(name); - if (P && hasName()) P->getSymbolTable()->insert(this); +TerminatorInst::TerminatorInst(const Type *Ty, Instruction::TermOps iType, + const std::string &Name) + : Instruction(Ty, iType, Name) { } @@ -46,7 +29,7 @@ void MethodArgument::setName(const string &name) { // PHINode Class //===----------------------------------------------------------------------===// -PHINode::PHINode(const Type *Ty, const string &name) +PHINode::PHINode(const Type *Ty, const std::string &name) : Instruction(Ty, Instruction::PHINode, name) { } @@ -60,6 +43,8 @@ PHINode::PHINode(const PHINode &PN) } void PHINode::addIncoming(Value *D, BasicBlock *BB) { + assert(getType() == D->getType() && + "All operands to PHI node must be the same type as the PHI node!"); Operands.push_back(Use(D, this)); Operands.push_back(Use(BB, this)); }