const char *option; /**< name of the option */
int opt_len; /**< length of the option string */
a_byte *flag; /**< address of variable to set/reset */
- int set; /**< iff true, variable will be set, else reset */
+ a_byte set; /**< iff true, variable will be set, else reset */
const char *description; /**< description of this option */
} firm_options[] = {
/* this must be first */
}
/* statistic options do accumulate */
if (firm_options[i].flag == &firm_dump.statistic)
- *firm_options[i].flag |= firm_options[i].set;
+ *firm_options[i].flag = (a_byte) (*firm_options[i].flag | firm_options[i].set);
else
*firm_options[i].flag = firm_options[i].set;
firm_get_version(&version);
- fprintf(f, "Firm C-Compiler using libFirm (%d.%d", version.major, version.minor);
+ fprintf(f, "Firm C-Compiler using libFirm (%u.%u", version.major, version.minor);
if(version.revision[0] != 0) {
fputc(' ', f);
fputs(version.revision, f);
#include "firm_opt.h"
#include "firm_timing.h"
-extern void be_main(FILE *f, const char *asm_file_name);
-
/**
* Substitutes '.c' for '.s'.
*/
#define CHECK_ALL(cond) \
do { \
if (cond) { \
- int i; \
+ int ii; \
timer_push(TV_VERIFY); \
- for (i = get_irp_n_irgs() - 1; i >= 0; --i) \
- irg_verify(get_irp_irg(i), VRFY_ENFORCE_SSA); \
+ for (ii = get_irp_n_irgs() - 1; ii >= 0; --ii) \
+ irg_verify(get_irp_irg(ii), VRFY_ENFORCE_SSA); \
timer_pop(); \
} \
} while (0)
static create_intrinsic_fkt *arch_create_intrinsic = NULL;
static void *create_intrinsic_ctx = NULL;
static const ir_settings_if_conv_t *if_conv_info = NULL;
-static unsigned char be_support_inline_asm = FALSE;
/* entities of runtime functions */
ir_entity_ptr rts_entities[rts_max];
*/
static void do_firm_optimizations(const char *input_filename, int firm_const_exists)
{
- ir_entity **keep_methods;
- int i, arr_len;
+ int i;
ir_graph *irg;
unsigned aa_opt;
timer_start(TV_ALL_OPT);
if (firm_opt.remove_unused) {
+ ir_entity **keep_methods;
+ int arr_len;
+
/* Analysis that finds the free methods,
i.e. methods that are dereferenced.
Optimizes polymorphic calls :-). */
ir_node *upper = get_array_upper_bound(ty, i);
ir_graph *rem = current_ir_graph;
tarval *tv_lower, *tv_upper;
+ long val_lower, val_upper;
current_ir_graph = get_const_code_irg();
local_optimize_node(lower);
return 0;
}
- size *= get_tarval_long(tv_upper) - get_tarval_long(tv_lower);
+ val_upper = get_tarval_long(tv_upper);
+ val_lower = get_tarval_long(tv_lower);
+ size *= val_upper - val_lower;
}
restore_optimization_state(&state);
if (firm_be_opt.selection == BE_FIRM_BE) {
const backend_params *be_params = be_init();
- be_support_inline_asm = be_params->support_inline_asm;
-
- firm_opt.lower_ll = be_params->do_dw_lowering;
+ firm_opt.lower_ll = (a_byte) be_params->do_dw_lowering;
params.arch_op_settings = be_params->arch_op_settings;
arch_create_intrinsic = be_params->arch_create_intrinsic_fkt;
/* do not run architecture dependent optimizations in building phase */
arch_dep_set_opts(arch_dep_none);
- do_node_verification(firm_opt.vrfy);
+ do_node_verification((firm_verification_t) firm_opt.vrfy);
if (firm_dump.filter)
only_dump_method_with_name(new_id_from_str(firm_dump.filter));
int i;
/* the general for dumping option must be set, or the others will not work */
- firm_dump.ir_graph |= firm_dump.all_phases | firm_dump.extbb;
+ firm_dump.ir_graph
+ = (a_byte) (firm_dump.ir_graph | firm_dump.all_phases | firm_dump.extbb);
dump_keepalive_edges(1);
dump_consts_local(1);
#endif
/* enable architecture dependent optimizations */
- arch_dep_set_opts((firm_opt.muls ? arch_dep_mul_to_shift : arch_dep_none) |
+ arch_dep_set_opts((arch_dep_opts_t)
+ ((firm_opt.muls ? arch_dep_mul_to_shift : arch_dep_none) |
(firm_opt.divs ? arch_dep_div_by_const : arch_dep_none) |
- (firm_opt.mods ? arch_dep_mod_by_const : arch_dep_none) );
+ (firm_opt.mods ? arch_dep_mod_by_const : arch_dep_none) ));
if (firm_dump.statistic & STAT_FINAL_IR)
*/
static void name(FILE *f, const char *prefix, ir_node *n, const char *suffix)
{
- fprintf(f, "%s%s_%u%s",
- prefix ? prefix : "",
- get_op_name(get_irn_op(n)),
- get_irn_idx(n),
- suffix ? suffix : "");
+ const char *op_name = get_op_name(get_irn_op(n));
+ unsigned index = get_irn_idx(n);
+ if(prefix == NULL)
+ prefix = "";
+ if(suffix == NULL)
+ suffix = "";
+
+ fprintf(f, "%s%s_%u%s", prefix, op_name, index, suffix);
}
/**
else {
def_mode:
tarval_snprintf(buf, sizeof(buf), tv);
- fprintf(f, "new_tarval_from_str(\"%s\", %d, ", buf, strlen(buf));
+ fprintf(f, "new_tarval_from_str(\"%s\", %u, ", buf, strlen(buf));
fprintf(f, "mode_%s)", get_mode_name(mode));
}
}
ir_label_t label;
symconst_kind kind = get_SymConst_kind(n);
const char *k_name = "NULL";
+ const char *str;
switch (kind) {
case symconst_addr_ent:
break;
case symconst_addr_name:
id = get_SymConst_name(n);
- fprintf(f, " sym.ident_p = new_id_from_chars(\"%s\", %d);\n", get_id_str(id), get_id_strlen(id));
+ str = get_id_str(id);
+ fprintf(f, " sym.ident_p = new_id_from_chars(\"%s\", %d);\n", str, get_id_strlen(id));
k_name = "symconst_addr_name";
break;
case symconst_type_size:
break;
case symconst_enum_const:
id = get_SymConst_name(n);
- fprintf(f, " sym.ident_p = new_id_from_chars(\"%s\", %d);\n", get_id_str(id), get_id_strlen(id));
+ str = get_id_str(id);
+ fprintf(f, " sym.ident_p = new_id_from_chars(\"%s\", %d);\n", str, get_id_strlen(id));
k_name = "symconst_enum_const";
break;
case symconst_label:
case iro_Cond:
generate_code_Proj_Cond(f, n);
break;
- default:
+ default: {
+ const char *mode_name = get_mode_name(get_irn_mode(n));
name(f, " ", n, " = new_r_Proj(irg, ");
name(f, NULL, get_nodes_block(n), ", ");
name(f, NULL, get_Proj_pred(n), ", ");
- fprintf(f, "mode_%s, %ld);\n", get_mode_name(get_irn_mode(n)), get_Proj_proj(n));
+ fprintf(f, "mode_%s, %ld);\n", mode_name, get_Proj_proj(n));
+ }
}
}