llvm-6502/lib/VMCore/Instruction.cpp
Chris Lattner 221d688a5e Method.h no longer includes BasicBlock.h
Method::inst_* is now in llvm/Support/InstIterator.h
GraphTraits specializations for BasicBlock and Methods are now in llvm/Support/CFG.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1746 91177308-0d34-0410-b5e6-96231b3b80d8
2002-02-12 21:07:25 +00:00

29 lines
1019 B
C++

//===-- Instruction.cpp - Implement the Instruction class --------*- C++ -*--=//
//
// This file implements the Instruction class for the VMCore library.
//
//===----------------------------------------------------------------------===//
#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/SymbolTable.h"
Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name)
: User(ty, Value::InstructionVal, Name) {
Parent = 0;
iType = it;
}
// Specialize setName to take care of symbol table majik
void Instruction::setName(const std::string &name, SymbolTable *ST) {
BasicBlock *P = 0; Method *PP = 0;
assert((ST == 0 || !getParent() || !getParent()->getParent() ||
ST == getParent()->getParent()->getSymbolTable()) &&
"Invalid symtab argument!");
if ((P = getParent()) && (PP = P->getParent()) && hasName())
PP->getSymbolTable()->remove(this);
Value::setName(name);
if (PP && hasName()) PP->getSymbolTableSure()->insert(this);
}