Mesa (master): nv50/ir/tgsi: fix handling of early RET

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun Apr 29 16:06:51 UTC 2012


Module: Mesa
Branch: master
Commit: 163b290f886c69a233c71799613eb74fb2668085
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=163b290f886c69a233c71799613eb74fb2668085

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sun Apr 29 17:36:34 2012 +0200

nv50/ir/tgsi: fix handling of early RET

We have to actually emit RET, too, of course, not just the PRERET.

---

 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp     |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index 8bd784f..82e2360 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -2196,12 +2196,13 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
       if (!isEndOfSubroutine(ip + 1)) {
          // insert a PRERET at the entry if this is an early return
          // (only needed for sharing code in the epilogue)
+         BasicBlock *pos = getBB();
+         setPosition(BasicBlock::get(func->cfg.getRoot()), false);
          mkFlow(OP_PRERET, leave, CC_ALWAYS, NULL)->fixed = 1;
-         bb->cfg.attach(&leave->cfg, Graph::Edge::CROSS);
-      } else {
-         mkFlow(OP_RET, NULL, CC_ALWAYS, NULL)->fixed = 1;
-         bb->cfg.attach(&leave->cfg, Graph::Edge::TREE);
+         setPosition(pos, true);
       }
+      mkFlow(OP_RET, NULL, CC_ALWAYS, NULL)->fixed = 1;
+      bb->cfg.attach(&leave->cfg, Graph::Edge::CROSS);
    }
       break;
    case TGSI_OPCODE_END:




More information about the mesa-commit mailing list