diff options
author | Francisco Jerez <[email protected]> | 2011-11-27 13:06:10 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-14 21:54:02 +0200 |
commit | 4ece0dbd2f595c376dc58252643e67bb63552e88 (patch) | |
tree | 374819a6a8ff44c1046daaa51a44657c4c6c88d9 | |
parent | 4a44f94caf8887f6dfc66c4193e95c6430c9de57 (diff) |
nv50/ir/ssa: Take into account function inputs and outputs.
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp index 38a37efdd4f..43cb74991f1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_ssa.cpp @@ -352,7 +352,7 @@ Function::convertToSSA() // gather blocks with assignments to lval in workList for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end(); ++d) { - bb = (*d)->getInsn()->bb; + bb = ((*d)->getInsn() ? (*d)->getInsn()->bb : NULL); if (!bb) continue; // instruction likely been removed but not XXX deleted @@ -436,10 +436,25 @@ bool RenamePass::run() void RenamePass::search(BasicBlock *bb) { - LValue *lval; + LValue *lval, *ssa; int d, s; const Target *targ = prog->getTarget(); + if (bb == BasicBlock::get(func->cfg.getRoot())) { + for (std::deque<ValueDef>::iterator it = func->ins.begin(); + it != func->ins.end(); ++it) { + lval = it->get()->asLValue(); + assert(lval); + + ssa = new_LValue(func, targ->nativeFile(lval->reg.file)); + ssa->reg.size = lval->reg.size; + ssa->reg.data.id = lval->reg.data.id; + + it->setSSA(ssa); + stack[lval->id].push(ssa); + } + } + for (Instruction *stmt = bb->getFirst(); stmt; stmt = stmt->next) { if (stmt->op != OP_PHI) { for (s = 0; stmt->srcExists(s); ++s) { @@ -487,6 +502,19 @@ void RenamePass::search(BasicBlock *bb) for (Graph::EdgeIterator ei = bb->dom.outgoing(); !ei.end(); ei.next()) search(BasicBlock::get(ei.getNode())); + if (bb == BasicBlock::get(func->cfgExit)) { + for (std::deque<ValueRef>::iterator it = func->outs.begin(); + it != func->outs.end(); ++it) { + lval = it->get()->asLValue(); + if (!lval) + continue; + lval = getStackTop(lval); + if (!lval) + lval = static_cast<LValue *>(undef->getDef(0)); + it->set(lval); + } + } + for (Instruction *stmt = bb->getFirst(); stmt; stmt = stmt->next) { for (d = 0; stmt->defExists(d); ++d) stack[stmt->def(d).preSSA()->id].pop(); |