/**
- * 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;
* 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 */
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]);
* tail code:
* BREAK if !expr (child[1])
*/
- slang_ir_node *prevLoop, *loop, *cond;
+ slang_ir_node *prevLoop, *loop;
GLboolean isConst, constTrue;
/* type-check expression */
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);
}
}
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);