Module: Mesa Branch: main Commit: cd2c314ee008000c89e3200ff9062b9ca25bd533 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd2c314ee008000c89e3200ff9062b9ca25bd533
Author: M Henning <[email protected]> Date: Fri May 12 22:01:13 2023 -0400 nv50/ir: Remove ArgumentMovesPass We only use OP_CALL for builtins at this point, so no need for this. Reviewed-by: Karol Herbst <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23006> --- src/nouveau/codegen/nv50_ir_ra.cpp | 77 -------------------------------------- 1 file changed, 77 deletions(-) diff --git a/src/nouveau/codegen/nv50_ir_ra.cpp b/src/nouveau/codegen/nv50_ir_ra.cpp index bf7d850c72c..666e2202940 100644 --- a/src/nouveau/codegen/nv50_ir_ra.cpp +++ b/src/nouveau/codegen/nv50_ir_ra.cpp @@ -225,11 +225,6 @@ private: inline void splitEdges(BasicBlock *b); }; - class ArgumentMovesPass : public Pass { - private: - virtual bool visit(BasicBlock *); - }; - class BuildIntervalsPass : public Pass { private: virtual bool visit(BasicBlock *); @@ -517,73 +512,6 @@ RegAlloc::PhiMovesPass::visit(BasicBlock *bb) return true; } -bool -RegAlloc::ArgumentMovesPass::visit(BasicBlock *bb) -{ - // Bind function call inputs/outputs to the same physical register - // the callee uses, inserting moves as appropriate for the case a - // conflict arises. - for (Instruction *i = bb->getEntry(); i; i = i->next) { - FlowInstruction *cal = i->asFlow(); - // TODO: Handle indirect calls. - // Right now they should only be generated for builtins. - if (!cal || cal->op != OP_CALL || cal->builtin || cal->indirect) - continue; - RegisterSet clobberSet(prog->getTarget()); - - // Bind input values. - for (int s = cal->indirect ? 1 : 0; cal->srcExists(s); ++s) { - const int t = cal->indirect ? (s - 1) : s; - LValue *tmp = new_LValue(func, cal->getSrc(s)->asLValue()); - tmp->reg.data.id = cal->target.fn->ins[t].rep()->reg.data.id; - - Instruction *mov = - new_Instruction(func, OP_MOV, typeOfSize(tmp->reg.size)); - mov->setDef(0, tmp); - mov->setSrc(0, cal->getSrc(s)); - cal->setSrc(s, tmp); - - bb->insertBefore(cal, mov); - } - - // Bind output values. - for (int d = 0; cal->defExists(d); ++d) { - LValue *tmp = new_LValue(func, cal->getDef(d)->asLValue()); - tmp->reg.data.id = cal->target.fn->outs[d].rep()->reg.data.id; - - Instruction *mov = - new_Instruction(func, OP_MOV, typeOfSize(tmp->reg.size)); - mov->setSrc(0, tmp); - mov->setDef(0, cal->getDef(d)); - cal->setDef(d, tmp); - - bb->insertAfter(cal, mov); - clobberSet.occupy(tmp); - } - - // Bind clobbered values. - for (std::deque<Value *>::iterator it = cal->target.fn->clobbers.begin(); - it != cal->target.fn->clobbers.end(); - ++it) { - if (clobberSet.testOccupy(*it)) { - Value *tmp = new_LValue(func, (*it)->asLValue()); - tmp->reg.data.id = (*it)->reg.data.id; - cal->setDef(cal->defCount(), tmp); - } - } - } - - // Update the clobber set of the function. - if (BasicBlock::get(func->cfgExit) == bb) { - func->buildDefSets(); - for (unsigned int i = 0; i < bb->defSet.getSize(); ++i) - if (bb->defSet.test(i)) - func->clobbers.push_back(func->getLValue(i)); - } - - return true; -} - // Build the set of live-in variables of bb. bool RegAlloc::buildLiveSets(BasicBlock *bb) @@ -1913,7 +1841,6 @@ RegAlloc::execFunc() MergedDefs mergedDefs; InsertConstraintsPass insertConstr; PhiMovesPass insertPhiMoves; - ArgumentMovesPass insertArgMoves; BuildIntervalsPass buildIntervals; SpillCodeInserter insertSpills(func, mergedDefs); @@ -1937,10 +1864,6 @@ RegAlloc::execFunc() if (!ret) goto out; - ret = insertArgMoves.run(func); - if (!ret) - goto out; - // TODO: need to fix up spill slot usage ranges to support > 1 retry for (retries = 0; retries < 3; ++retries) { if (retries && (prog->dbgFlags & NV50_IR_DEBUG_REG_ALLOC))
