X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ast2firm.c;h=a37206d10c6cc6ab19b0875a2e67b6340b3b406b;hb=02d9198a5f0b8133e882e5d764acab5c74701b58;hp=1c0a779341ac5fc98568468828a6ec8b8f2ebe4e;hpb=4c80c369e9645a04856db46ab0d8c1a0ef7c70b2;p=cparser diff --git a/ast2firm.c b/ast2firm.c index 1c0a779..a37206d 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -49,7 +49,6 @@ #include "printer.h" #include "entitymap_t.h" #include "driver/firm_opt.h" -#include "driver/firm_cmdline.h" typedef struct trampoline_region trampoline_region; struct trampoline_region { @@ -57,6 +56,8 @@ struct trampoline_region { ir_entity *region; /**< created region for the trampoline */ }; +fp_model_t firm_fp_model = fp_model_precise; + static const backend_params *be_params; static ir_type *ir_type_char; @@ -146,7 +147,7 @@ static const char *dbg_retrieve(const dbg_info *dbg, unsigned *line) if (pos == NULL) return NULL; if (line != NULL) - *line = pos->linenr; + *line = pos->lineno; return pos->input_name; } @@ -171,19 +172,15 @@ static type_dbg_info *get_type_dbg_info_(const type_t *type) } /* is the current block a reachable one? */ -static bool currently_reachable() +static bool currently_reachable(void) { - ir_node *block = get_cur_block(); - if (block == NULL || is_Bad(block)) - return false; - else - return true; + ir_node *const block = get_cur_block(); + return block != NULL && !is_Bad(block); } -static void set_unreachable_now() +static void set_unreachable_now(void) { - ir_node *bad = new_Bad(mode_BB); - set_cur_block(bad); + set_cur_block(NULL); } static ir_mode *atomic_modes[ATOMIC_TYPE_LAST+1]; @@ -439,9 +436,9 @@ static ir_type *create_pointer_type(pointer_type_t *type) type_dbg_info *dbgi = get_type_dbg_info_((const type_t*) type); type_t *points_to = type->points_to; ir_type *ir_points_to = get_ir_type_incomplete(points_to); - ir_type *ir_type = new_d_type_pointer(ir_points_to, dbgi); + ir_type *irtype = new_d_type_pointer(ir_points_to, dbgi); - return ir_type; + return irtype; } static ir_type *create_reference_type(reference_type_t *type) @@ -449,9 +446,9 @@ static ir_type *create_reference_type(reference_type_t *type) type_dbg_info *dbgi = get_type_dbg_info_((const type_t*) type); type_t *refers_to = type->refers_to; ir_type *ir_refers_to = get_ir_type_incomplete(refers_to); - ir_type *ir_type = new_d_type_pointer(ir_refers_to, dbgi); + ir_type *irtype = new_d_type_pointer(ir_refers_to, dbgi); - return ir_type; + return irtype; } static ir_type *create_array_type(array_type_t *type) @@ -459,27 +456,27 @@ static ir_type *create_array_type(array_type_t *type) type_dbg_info *dbgi = get_type_dbg_info_((const type_t*) type); type_t *element_type = type->element_type; ir_type *ir_element_type = get_ir_type(element_type); - ir_type *ir_type = new_d_type_array(1, ir_element_type, dbgi); + ir_type *irtype = new_d_type_array(1, ir_element_type, dbgi); const int align = get_type_alignment_bytes(ir_element_type); - set_type_alignment_bytes(ir_type, align); + set_type_alignment_bytes(irtype, align); if (type->size_constant) { int n_elements = type->size; - set_array_bounds_int(ir_type, 0, 0, n_elements); + set_array_bounds_int(irtype, 0, 0, n_elements); size_t elemsize = get_type_size_bytes(ir_element_type); if (elemsize % align > 0) { elemsize += align - (elemsize % align); } - set_type_size_bytes(ir_type, n_elements * elemsize); + set_type_size_bytes(irtype, n_elements * elemsize); } else { - set_array_lower_bound_int(ir_type, 0, 0); + set_array_lower_bound_int(irtype, 0, 0); } - set_type_state(ir_type, layout_fixed); + set_type_state(irtype, layout_fixed); - return ir_type; + return irtype; } /** @@ -4874,9 +4871,8 @@ static void if_statement_to_firm(if_statement_t *statement) * reachable. */ static void jump_if_reachable(ir_node *const target_block) { - if (currently_reachable()) { - add_immBlock_pred(target_block, new_Jmp()); - } + ir_node *const pred = currently_reachable() ? new_Jmp() : new_Bad(mode_X); + add_immBlock_pred(target_block, pred); } static void while_statement_to_firm(while_statement_t *statement) @@ -5108,7 +5104,7 @@ static void switch_statement_to_firm(switch_statement_t *statement) default_proj_nr = l->last_case; } - if (default_proj_nr == INT_MAX) { + if (default_proj_nr == LONG_MAX) { /* Bad: an overflow will occur, we cannot be sure that the * maximum + 1 is a free number. Scan the values a second * time to find a free number. @@ -5808,7 +5804,7 @@ static void create_function(entity_t *entity) ir_graph *old_current_function = current_function; current_function = irg; - set_irg_fp_model(irg, firm_opt.fp_model); + set_irg_fp_model(irg, firm_fp_model); tarval_enable_fp_ops(1); set_irn_dbg_info(get_irg_start_block(irg), get_entity_dbg_info(function_entity));