diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-26 16:56:45 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-26 16:56:45 -0600 |
commit | c042a91b8b202e4c0623e647bda035c715f7c308 (patch) | |
tree | 5a3db377e5c55625397757dc56a72d31a93d3754 /src/mesa/shader/slang/slang_emit.c | |
parent | 813a0e11f1eb903883aef18c5cb5c4702dcb6213 (diff) |
Get rid of SLANG_OPER_GOTO, start rewrite of 'return' handling.
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 109b2df7aa..92bfb54d80 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -727,6 +727,23 @@ emit_jump(slang_emit_info *emitInfo, slang_ir_node *n) static struct prog_instruction * +emit_return(slang_emit_info *emitInfo, slang_ir_node *n) +{ + struct prog_instruction *inst; + assert(n); + assert(n->Opcode == IR_RETURN); + assert(n->Label); + inst = new_instruction(emitInfo, OPCODE_BRA /*RET*/); /*XXX TEMPORARY*/ + inst->DstReg.CondMask = COND_TR; /* always branch */ + inst->BranchTarget = _slang_label_get_location(n->Label); + if (inst->BranchTarget < 0) { + _slang_label_add_reference(n->Label, emitInfo->prog->NumInstructions - 1); + } + return inst; +} + + +static struct prog_instruction * emit_kill(slang_emit_info *emitInfo) { struct prog_instruction *inst; @@ -1528,7 +1545,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) case IR_END_SUB: return new_instruction(emitInfo, OPCODE_ENDSUB); case IR_RETURN: - return new_instruction(emitInfo, OPCODE_RET); + return emit_return(emitInfo, n); case IR_NOP: return NULL; |