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);
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(); }
#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! :(
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);
}
BasicBlock::~BasicBlock() {
dropAllReferences();
InstList.delete_all();
+ delete machineInstrVec;
}
// Specialize setName to take care of symbol table majik