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 d4e7c945226ef78cef7189b822320d04b494c49d..74692d8251a4226a54b9ca8b6523030a9e3174ec 100644 (file)
@@ -938,6 +938,7 @@ public:
 
    inline LValue *getLValue(int id);
 
+   void buildLiveSets();
    void buildDefSets();
    bool convertToSSA();
 
index 7c8f2e97fb5b6720478a8c9056d4d0ed10e637e3..54d8ef82bb3d533adef8a1b46abcf23afb968166 100644 (file)
@@ -415,6 +415,16 @@ Function::orderInstructions(ArrayList &result)
    return result.getSize();
 }
 
+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()
 {
index 21b6cba251cd7d0dc5bbe4071dc80518ee1ff263..f8ee4d53f53c7cb8070f7db5737e49cb56e9c6fc 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);