aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-07-20 21:05:02 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-07-20 21:05:02 +0000
commit3344615555d57b2c16f36a3108b78ac89c7b4e7f (patch)
tree708530a1750aa91e2089dd960c4ca3b995c25686 /lib
parent369bbeb62cef986b6eb5213c9edab1a4c4f157af (diff)
downloadexternal_llvm-3344615555d57b2c16f36a3108b78ac89c7b4e7f.zip
external_llvm-3344615555d57b2c16f36a3108b78ac89c7b4e7f.tar.gz
external_llvm-3344615555d57b2c16f36a3108b78ac89c7b4e7f.tar.bz2
Added a representation of the machine instructions generated
for a VM instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Instruction.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index bd3596d..8b833cf 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/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();
+}