From 898b0981b6c90d2f1e446a532b6ac3cbbb49747d Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 15 Nov 2011 02:07:21 +0100 Subject: [PATCH] nv50/ir: Add convenience method for calculating the live sets of a function. --- src/gallium/drivers/nv50/codegen/nv50_ir.h | 1 + src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp | 10 ++++++++++ src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp | 8 +------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index d4e7c945226..74692d8251a 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -938,6 +938,7 @@ public: inline LValue *getLValue(int id); + void buildLiveSets(); void buildDefSets(); bool convertToSSA(); diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp index 7c8f2e97fb5..54d8ef82bb3 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp @@ -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() { diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp index 21b6cba251c..f8ee4d53f53 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp @@ -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(bi.get())->liveSet.marker = false; + buildLiveSets(); // 1. create the dominator tree domTree = new DominatorTree(&cfg); -- 2.30.2