1 //===-- Instruction.cpp - Implement the Instruction class --------*- C++ -*--=//
3 // This file implements the Instruction class for the VMCore library.
5 //===----------------------------------------------------------------------===//
7 #include "llvm/Instruction.h"
8 #include "llvm/Method.h"
9 #include "llvm/SymbolTable.h"
11 Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name)
12 : User(ty, Value::InstructionVal, Name) {
17 // Specialize setName to take care of symbol table majik
18 void Instruction::setName(const std::string &name, SymbolTable *ST) {
19 BasicBlock *P = 0; Method *PP = 0;
20 assert((ST == 0 || !getParent() || !getParent()->getParent() ||
21 ST == getParent()->getParent()->getSymbolTable()) &&
22 "Invalid symtab argument!");
23 if ((P = getParent()) && (PP = P->getParent()) && hasName())
24 PP->getSymbolTable()->remove(this);
26 if (PP && hasName()) PP->getSymbolTableSure()->insert(this);