Added vector of machine instructions for the basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-07-30 18:47:24 +00:00
parent 877fbcd8d7
commit b63933975f
2 changed files with 14 additions and 1 deletions

View File

@ -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<Instruction, BasicBlock, Method> InstListType;
private :
InstListType InstList;
MachineCodeForBasicBlock* machineInstrVec;
friend class ValueHolder<BasicBlock,Method,Method>;
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(); }

View File

@ -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<Instruction, BasicBlock, Method>;
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