[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h MachineFunction.h

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 27 20:09:01 PST 2002


Changes in directory llvm/include/llvm/CodeGen:

MachineBasicBlock.h updated: 1.7 -> 1.8
MachineFunction.h updated: 1.12 -> 1.13

---
Log message:

Add BasicBlock list to MchineFunction that will eventually be the only
way to access MachineBasicBlocks.  For now, it is never filled.


---
Diffs of the changes:

Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.7 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.8
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.7	Sun Oct 27 19:55:26 2002
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h	Sun Oct 27 20:08:43 2002
@@ -11,11 +11,13 @@
 #include <vector>
 class BasicBlock;
 class MachineInstr;
+template <typename T> struct ilist_traits;
 
 extern AnnotationID MCFBB_AID;
 
 class MachineBasicBlock : public Annotation {
   std::vector<MachineInstr*> Insts;
+  MachineBasicBlock *Prev, *Next;
 public:
   MachineBasicBlock() : Annotation(MCFBB_AID) {}
   ~MachineBasicBlock() {}
@@ -70,6 +72,14 @@
     Insts.pop_back();
     return R;
   }
+
+private:   // Methods used to maintain doubly linked list of blocks...
+  friend class ilist_traits<MachineBasicBlock>;
+
+  MachineBasicBlock *getPrev() const { return Prev; }
+  MachineBasicBlock *getNext() const { return Next; }
+  void setPrev(MachineBasicBlock *P) { Prev = P; }
+  void setNext(MachineBasicBlock *N) { Next = N; }
 };
 
 


Index: llvm/include/llvm/CodeGen/MachineFunction.h
diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.12 llvm/include/llvm/CodeGen/MachineFunction.h:1.13
--- llvm/include/llvm/CodeGen/MachineFunction.h:1.12	Sun Oct 27 20:01:06 2002
+++ llvm/include/llvm/CodeGen/MachineFunction.h	Sun Oct 27 20:08:43 2002
@@ -12,7 +12,9 @@
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "Support/NonCopyable.h"
 #include "Support/HashExtras.h"
-#include <Support/hash_set>
+#include "Support/hash_set"
+#include "Support/ilist"
+
 class Value;
 class Function;
 class Constant;
@@ -24,11 +26,14 @@
 Pass *createMachineCodeDestructionPass();
 
 class MachineFunction : private Annotation {
-  hash_set<const Constant*> constantsForConstPool;
-  hash_map<const Value*, int> offsets;
-  const         Function* method;
+  const Function *method;
+
+  // List of machine basic blocks in function
+  iplist<MachineBasicBlock> BasicBlocks;
 
   // FIXME: State should be held elsewhere...
+  hash_set<const Constant*> constantsForConstPool;
+  hash_map<const Value*, int> offsets;
   unsigned	staticStackSize;
   unsigned	automaticVarsSize;
   unsigned	regSpillsSize;





More information about the llvm-commits mailing list