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

Bill Wendling isanbard at gmail.com
Tue Oct 3 00:20:36 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

LiveVariables.h updated: 1.29 -> 1.30
---
Log message:

Fix for PR929: http://llvm.org/PR929 . The PHI nodes were being gone through for each instruction
in a successor block for every block...resulting in some O(N^k) algorithm
which wasn't very good for performance. Calculating this information up
front and keeping it in a map made it much faster.


---
Diffs of the changes:  (+11 -1)

 LiveVariables.h |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/CodeGen/LiveVariables.h
diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.29 llvm/include/llvm/CodeGen/LiveVariables.h:1.30
--- llvm/include/llvm/CodeGen/LiveVariables.h:1.29	Sat Sep  2 19:05:09 2006
+++ llvm/include/llvm/CodeGen/LiveVariables.h	Tue Oct  3 02:20:20 2006
@@ -39,7 +39,7 @@
 class LiveVariables : public MachineFunctionPass {
 public:
   /// VarInfo - This represents the regions where a virtual register is live in
-  /// the program.  We represent this with three difference pieces of
+  /// the program.  We represent this with three different pieces of
   /// information: the instruction that uniquely defines the value, the set of
   /// blocks the instruction is live into and live out of, and the set of 
   /// non-phi instructions that are the last users of the value.
@@ -136,9 +136,19 @@
   MachineInstr **PhysRegInfo;
   bool          *PhysRegUsed;
 
+  typedef std::map<const MachineBasicBlock*,
+                   std::vector<unsigned> > PHIVarInfoMap;
+
+  PHIVarInfoMap PHIVarInfo;
+
   void HandlePhysRegUse(unsigned Reg, MachineInstr *MI);
   void HandlePhysRegDef(unsigned Reg, MachineInstr *MI);
 
+  /// analyzePHINodes - Gather information about the PHI nodes in here. In
+  /// particular, we want to map the variable information of a virtual
+  /// register which is used in a PHI node. We map that to the BB the vreg
+  /// is coming from.
+  void analyzePHINodes(const MachineFunction& Fn);
 public:
 
   virtual bool runOnMachineFunction(MachineFunction &MF);






More information about the llvm-commits mailing list