summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-28 14:14:00 -0600
committerBrian <brian@yutani.localnet.net>2007-03-28 14:14:00 -0600
commitf841b04601e469f3d4203733d12bb6415d12b9c8 (patch)
tree022aa38fe7f7f5bb4deca081b9b3a90e7ad4a16e /src/mesa/shader/slang
parentb463d521432c675c6336fde8b39870717e099be5 (diff)
simplify, clean-up break/cont code
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 22bcfe67d4..5e6c91b93c 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -539,15 +539,15 @@ new_break_if(slang_ir_node *loopNode, slang_ir_node *cond, GLboolean breakTrue)
/**
- * Make new IR_CONT_IF_TRUE or IR_CONT_IF_FALSE node.
+ * Make new IR_CONT_IF_TRUE node.
*/
static slang_ir_node *
-new_cont_if(slang_ir_node *loopNode, slang_ir_node *cond, GLboolean contTrue)
+new_cont_if_true(slang_ir_node *loopNode, slang_ir_node *cond)
{
slang_ir_node *n;
assert(loopNode);
assert(loopNode->Opcode == IR_LOOP);
- n = new_node1(contTrue ? IR_CONT_IF_TRUE : IR_CONT_IF_FALSE, cond);
+ n = new_node1(IR_CONT_IF_TRUE, cond);
if (n) {
/* insert this node at head of linked list */
n->List = loopNode->List;
@@ -1391,7 +1391,7 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper)
* BREAK if !expr (child[0])
* body code (child[1])
*/
- slang_ir_node *prevLoop, *loop, *cond, *breakIf, *body;
+ slang_ir_node *prevLoop, *loop, *breakIf, *body;
GLboolean isConst, constTrue;
/* type-check expression */
@@ -1414,12 +1414,13 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper)
prevLoop = A->CurLoop;
A->CurLoop = loop;
- cond = new_cond(_slang_gen_operation(A, &oper->children[0]));
if (isConst && constTrue) {
/* while(nonzero constant), no conditional break */
breakIf = NULL;
}
else {
+ slang_ir_node *cond
+ = new_cond(_slang_gen_operation(A, &oper->children[0]));
breakIf = new_break_if(A->CurLoop, cond, GL_FALSE);
}
body = _slang_gen_operation(A, &oper->children[1]);
@@ -1453,7 +1454,7 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper)
* tail code:
* BREAK if !expr (child[1])
*/
- slang_ir_node *prevLoop, *loop, *cond;
+ slang_ir_node *prevLoop, *loop;
GLboolean isConst, constTrue;
/* type-check expression */
@@ -1478,7 +1479,8 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper)
loop->Children[1] = NULL; /* no tail code */
}
else {
- cond = new_cond(_slang_gen_operation(A, &oper->children[1]));
+ slang_ir_node *cond
+ = new_cond(_slang_gen_operation(A, &oper->children[1]));
loop->Children[1] = new_break_if(A->CurLoop, cond, GL_FALSE);
}
@@ -1616,7 +1618,7 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper)
}
else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)) {
/* Special case: generate a conditional break */
- ifBody = new_cont_if(A->CurLoop, cond, GL_TRUE);
+ ifBody = new_cont_if_true(A->CurLoop, cond);
if (haveElseClause) {
elseBody = _slang_gen_operation(A, &oper->children[2]);
return new_seq(ifBody, elseBody);