Added vector of machine instructions for the basic block.
authorVikram S. Adve <vadve@cs.uiuc.edu>
Mon, 30 Jul 2001 18:47:24 +0000 (18:47 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Mon, 30 Jul 2001 18:47:24 +0000 (18:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
lib/VMCore/BasicBlock.cpp

index c0922d6290596228da14e93b62460df18d522b22..aa201c3c84b7e5b08649d82c7f6ae4c26b1a099c 100644 (file)
 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(); }
index 04941075e3e7defa40fd3753128a6cb1bedb2ed8..cf8fc41bd747a0721dcbaff66f4e669ba33f1b46 100644 (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!  :(
 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