diff options
author | Brian <[email protected]> | 2007-02-06 21:33:29 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-02-06 21:33:29 -0700 |
commit | 5f7d4668c4b7de1c0d2269809d30aef6d0a089e9 (patch) | |
tree | 755ca17c1fcea293329702bb3034d78f516b7aa3 /src/mesa/shader/slang/slang_emit.c | |
parent | 7e73bc32f565b3d07e9a5cfbe0736d1d6bd6a2c1 (diff) |
replace IR_BEGIN_LOOP/IR_END_LOOP with IR_LOOP
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 82a8f0befb4..c18f1e364ce 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -317,11 +317,11 @@ slang_print_ir(const slang_ir_node *n, int indent) printf("CALL\n"); break; - case IR_BEGIN_LOOP: - printf("BEGIN_LOOP\n"); - break; - case IR_END_LOOP: - printf("END_LOOP\n"); + case IR_LOOP: + printf("LOOP\n"); + slang_print_ir(n->Children[0], indent+3); + spaces(indent); + printf("ENDLOOP\n"); break; case IR_CONT: printf("CONT\n"); @@ -1301,23 +1301,22 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog) case IR_IF: return emit_if(vt, n, prog); - case IR_BEGIN_LOOP: + case IR_LOOP: { + struct prog_instruction *beginInst; + /* save location of this instruction, used by OPCODE_ENDLOOP */ n->InstLocation = prog->NumInstructions; (void) new_instruction(prog, OPCODE_BGNLOOP); - } - break; - case IR_END_LOOP: - { - struct prog_instruction *inst, *beginInst; + + /* body */ + emit(vt, n->Children[0], prog); + inst = new_instruction(prog, OPCODE_ENDLOOP); - assert(n->BranchNode); - assert(n->BranchNode->InstLocation >= 0); /* The instruction BranchTarget points to top of loop */ - inst->BranchTarget = n->BranchNode->InstLocation; - /* Update BEGIN_LOOP's BranchTarget to point to this instruction */ - beginInst = prog->Instructions + n->BranchNode->InstLocation; + inst->BranchTarget = n->InstLocation; + /* Update BGNLOOP's BranchTarget to point to this instruction */ + beginInst = prog->Instructions + n->InstLocation; beginInst->BranchTarget = prog->NumInstructions - 1; return inst; } @@ -1336,6 +1335,7 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog) inst->BranchTarget = n->BranchNode->InstLocation; return inst; } + case IR_BEGIN_SUB: return new_instruction(prog, OPCODE_BGNSUB); case IR_END_SUB: @@ -1343,6 +1343,9 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog) case IR_RETURN: return new_instruction(prog, OPCODE_RET); + case IR_NOP: + return NULL; + default: _mesa_problem(NULL, "Unexpected IR opcode in emit()\n"); abort(); |