mode_uint = atomic_modes[ATOMIC_TYPE_UINT];
/* there's no real void type in firm */
- atomic_modes[ATOMIC_TYPE_VOID] = mode_int;
+ atomic_modes[ATOMIC_TYPE_VOID] = atomic_modes[ATOMIC_TYPE_CHAR];
/* initialize pointer modes */
char name[64];
return _expression_to_firm(argument);
}
case T___builtin_va_end:
+ /* evaluate the argument of va_end for its side effects */
+ _expression_to_firm(call->arguments->expression);
return NULL;
default:
panic("Unsupported builtin found\n");
long val = fold_constant(expression->left);
expression_kind_t ekind = expression->base.kind;
assert(ekind == EXPR_BINARY_LOGICAL_AND || ekind == EXPR_BINARY_LOGICAL_OR);
- if ((ekind == EXPR_BINARY_LOGICAL_AND && val != 0) ||
- (ekind == EXPR_BINARY_LOGICAL_OR && val == 0)) {
- return produce_condition_result(expression->right, mode, dbgi);
+ if (ekind == EXPR_BINARY_LOGICAL_AND) {
+ if (val == 0) {
+ return new_Const(get_mode_null(mode));
+ }
} else {
- return new_Const(get_mode_one(mode));
+ if (val != 0) {
+ return new_Const(get_mode_one(mode));
+ }
+ }
+
+ if (is_constant_expression(expression->right)) {
+ long const valr = fold_constant(expression->left);
+ return valr != 0 ?
+ new_Const(get_mode_one(mode)) :
+ new_Const(get_mode_null(mode));
}
+
+ return produce_condition_result(expression->right, mode, dbgi);
}
return produce_condition_result((const expression_t*) expression, mode,
}
add_immBlock_pred(true_block, true_proj);
- if (false_block != NULL) {
- add_immBlock_pred(false_block, false_proj);
- }
+ add_immBlock_pred(false_block, false_proj);
set_cur_block(NULL);
return cond_expr;
create_condition_evaluation(statement->condition, body_block, false_block);
mature_immBlock(body_block);
mature_immBlock(header_block);
- if (false_block != NULL) {
- mature_immBlock(false_block);
- }
+ mature_immBlock(false_block);
set_cur_block(false_block);
}
ir_node *const false_block = new_immBlock();
/* the loop body */
- ir_node * body_block;
+ ir_node *body_block;
if (statement->body != NULL) {
ir_node *const old_continue_label = continue_label;
ir_node *const old_break_label = break_label;