nv50/ir: Add convenience method for calculating the live sets of a function.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 15 Nov 2011 01:07:21 +0000 (02:07 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 14 Apr 2012 19:54:01 +0000 (21:54 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir.h
src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp
src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp

index d4e7c94..74692d8 100644 (file)
@@ -938,6 +938,7 @@ public:
 
    inline LValue *getLValue(int id);
 
+   void buildLiveSets();
    void buildDefSets();
    bool convertToSSA();
 
index 7c8f2e9..54d8ef8 100644 (file)
@@ -416,6 +416,16 @@ Function::orderInstructions(ArrayList &result)
 }
 
 void
+Function::buildLiveSets()
+{
+   for (unsigned i = 0; i <= loopNestingBound; ++i)
+      buildLiveSetsPreSSA(BasicBlock::get(cfg.getRoot()), cfg.nextSequence());
+
+   for (ArrayList::Iterator bi = allBBlocks.iterator(); !bi.end(); bi.next())
+      BasicBlock::get(bi)->liveSet.marker = false;
+}
+
+void
 Function::buildDefSets()
 {
    for (unsigned i = 0; i <= loopNestingBound; ++i)
index 21b6cba..f8ee4d5 100644 (file)
@@ -315,13 +315,7 @@ bool
 Function::convertToSSA()
 {
    // 0. calculate live in variables (for pruned SSA)
-   int seq = cfg.nextSequence();
-   for (unsigned i = 0; i <= loopNestingBound; seq = cfg.nextSequence(), ++i)
-      buildLiveSetsPreSSA(BasicBlock::get(cfg.getRoot()), seq);
-
-   // reset liveSet marker for use in regalloc
-   for (ArrayList::Iterator bi = allBBlocks.iterator(); !bi.end(); bi.next())
-      reinterpret_cast<BasicBlock *>(bi.get())->liveSet.marker = false;
+   buildLiveSets();
 
    // 1. create the dominator tree
    domTree = new DominatorTree(&cfg);