diff options
Diffstat (limited to 'src')
-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(); |