X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=lib%2FVMCore%2FInstrTypes.cpp;h=b53f480b14861580f28236a94d55ca7e410f1288;hb=4d7a75a9e31a1b45e68b9cd3f50f18bd90dd0850;hp=9e49805d315b23a10aa09f8c29f604675086a9cd;hpb=b1726accb24ad13419dcbc88beae11dec4733c5a;p=oota-llvm.git diff --git a/lib/VMCore/InstrTypes.cpp b/lib/VMCore/InstrTypes.cpp index 9e49805d315..b53f480b148 100644 --- a/lib/VMCore/InstrTypes.cpp +++ b/lib/VMCore/InstrTypes.cpp @@ -1,12 +1,12 @@ -//===-- InstrTypes.cpp - Implement Instruction subclasses --------*- C++ -*--=// +//===-- InstrTypes.cpp - Implement Instruction subclasses -------*- C++ -*-===// // // This file implements // //===----------------------------------------------------------------------===// #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 @@ -15,40 +15,15 @@ // TerminatorInst Class //===----------------------------------------------------------------------===// -TerminatorInst::TerminatorInst(Instruction::TermOps iType) - : Instruction(Type::VoidTy, iType, "") { +TerminatorInst::TerminatorInst(Instruction::TermOps iType, Instruction *IB) + : Instruction(Type::VoidTy, iType, "", IB) { } -TerminatorInst::TerminatorInst(const Type *Ty, Instruction::TermOps iType, - const string &Name = "") - : Instruction(Ty, iType, Name) { -} - - -//===----------------------------------------------------------------------===// -// MethodArgument Class -//===----------------------------------------------------------------------===// - -// Specialize setName to take care of symbol table majik -void MethodArgument::setName(const string &name, SymbolTable *ST) { - Method *P; - assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && - "Invalid symtab argument!"); - if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this); - Value::setName(name); - if (P && hasName()) P->getSymbolTable()->insert(this); -} - - //===----------------------------------------------------------------------===// // PHINode Class //===----------------------------------------------------------------------===// -PHINode::PHINode(const Type *Ty, const string &name) - : Instruction(Ty, Instruction::PHINode, name) { -} - -PHINode::PHINode(const PHINode &PN) +PHINode::PHINode(const PHINode &PN) : Instruction(PN.getType(), Instruction::PHINode) { Operands.reserve(PN.Operands.size()); for (unsigned i = 0; i < PN.Operands.size(); i+=2) { @@ -58,6 +33,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)); }