From 32b5d841bad8be0c2b9269629d70306b22c93895 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Mon, 30 Jul 2001 18:47:24 +0000 Subject: [PATCH] Added vector of machine instructions for the basic block. llvm-svn: 330 --- llvm/include/llvm/BasicBlock.h | 8 ++++++++ llvm/lib/VMCore/BasicBlock.cpp | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/BasicBlock.h b/llvm/include/llvm/BasicBlock.h index c0922d629059..aa201c3c84b7 100644 --- a/llvm/include/llvm/BasicBlock.h +++ b/llvm/include/llvm/BasicBlock.h @@ -29,12 +29,14 @@ class Instruction; class Method; class TerminatorInst; +class MachineCodeForBasicBlock; class BasicBlock : public Value { // Basic blocks are data objects also public: typedef ValueHolder InstListType; private : InstListType InstList; + MachineCodeForBasicBlock* machineInstrVec; friend class ValueHolder; void setParent(Method *parent); @@ -67,6 +69,12 @@ public: TerminatorInst *getTerminator(); const TerminatorInst *const getTerminator() const; + + // Machine code accessor... + inline MachineCodeForBasicBlock& getMachineInstrVec() const { + return *machineInstrVec; + } + //===--------------------------------------------------------------------===// // Instruction iterator methods inline iterator begin() { return InstList.begin(); } diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 04941075e3e7..cf8fc41bd747 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -13,6 +13,7 @@ #include "llvm/Type.h" #include "llvm/CFG.h" #include "llvm/iOther.h" +#include "llvm/CodeGen/MachineInstr.h" // Instantiate Templates - This ugliness is the price we have to pay // for having a ValueHolderImpl.h file seperate from ValueHolder.h! :( @@ -20,7 +21,10 @@ template class ValueHolder; BasicBlock::BasicBlock(const string &name, Method *Parent) - : Value(Type::LabelTy, Value::BasicBlockVal, name), InstList(this, 0) { + : Value(Type::LabelTy, Value::BasicBlockVal, name), + InstList(this, 0), + machineInstrVec(new MachineCodeForBasicBlock) +{ if (Parent) Parent->getBasicBlocks().push_back(this); } @@ -28,6 +32,7 @@ BasicBlock::BasicBlock(const string &name, Method *Parent) BasicBlock::~BasicBlock() { dropAllReferences(); InstList.delete_all(); + delete machineInstrVec; } // Specialize setName to take care of symbol table majik -- GitLab