diff options
| author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-07-20 21:05:02 +0000 |
|---|---|---|
| committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-07-20 21:05:02 +0000 |
| commit | 3e2394cdad0545f4c165815103992bc2c2eb6fb3 (patch) | |
| tree | c65b9d75b1f2ec3fdf065e1245671df6d349df3e /llvm/lib/VMCore | |
| parent | 85090922f49cbfb42dda69548879d71fb04c66d4 (diff) | |
| download | bcm5719-llvm-3e2394cdad0545f4c165815103992bc2c2eb6fb3.tar.gz bcm5719-llvm-3e2394cdad0545f4c165815103992bc2c2eb6fb3.zip | |
Added a representation of the machine instructions generated
for a VM instruction.
llvm-svn: 220
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Instruction.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp index bd3596debfa..8b833cf4bb7 100644 --- a/llvm/lib/VMCore/Instruction.cpp +++ b/llvm/lib/VMCore/Instruction.cpp @@ -8,15 +8,19 @@ #include "llvm/BasicBlock.h" #include "llvm/Method.h" #include "llvm/SymbolTable.h" +#include "llvm/Codegen/MachineInstr.h" Instruction::Instruction(const Type *ty, unsigned it, const string &Name) - : User(ty, Value::InstructionVal, Name) { + : User(ty, Value::InstructionVal, Name), + machineInstrVec(new MachineCodeForVMInstr) +{ Parent = 0; iType = it; } Instruction::~Instruction() { - assert(getParent() == 0 && "Instruction still embeded in basic block!"); + assert(getParent() == 0 && "Instruction still embedded in basic block!"); + delete machineInstrVec; } // Specialize setName to take care of symbol table majik @@ -27,3 +31,26 @@ void Instruction::setName(const string &name) { Value::setName(name); if (PP && hasName()) PP->getSymbolTableSure()->insert(this); } + +void +Instruction::addMachineInstruction(MachineInstr* minstr) +{ + machineInstrVec->push_back(minstr); +} + +// Dont make this inline because you would need to include +// MachineInstr.h in Instruction.h, which creates a circular +// sequence of forward declarations. Trying to fix that will +// cause a serious circularity in link order. +// +const vector<Value*>& +Instruction::getTempValuesForMachineCode() const +{ + return machineInstrVec->getTempValues(); +} + +void +Instruction::dropAllReferences() { + machineInstrVec->dropAllReferences(); + User::dropAllReferences(); +} |

