projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed set_opt_overflow_unsafe_transform(), not needed anymore
[cparser]
/
driver
/
firm_opt.c
diff --git
a/driver/firm_opt.c
b/driver/firm_opt.c
index
5844b1d
..
f0cddeb
100644
(file)
--- a/
driver/firm_opt.c
+++ b/
driver/firm_opt.c
@@
-20,6
+20,10
@@
#include "firm_cmdline.h"
#include "firm_timing.h"
#include "firm_cmdline.h"
#include "firm_timing.h"
+#ifdef _WIN32
+#define snprintf _snprintf
+#endif
+
#if defined(_DEBUG) || defined(FIRM_DEBUG)
#define DBG(x) dbg_printf x
#else
#if defined(_DEBUG) || defined(FIRM_DEBUG)
#define DBG(x) dbg_printf x
#else
@@
-56,10
+60,10
@@
#define CHECK_ALL(cond) \
do { \
if (cond) { \
#define CHECK_ALL(cond) \
do { \
if (cond) { \
- int i
;
\
+ int i
i;
\
timer_push(TV_VERIFY); \
timer_push(TV_VERIFY); \
- for (i
= get_irp_n_irgs() - 1; i >= 0; --i)
\
- irg_verify(get_irp_irg(i
), VRFY_ENFORCE_SSA);
\
+ for (i
i = get_irp_n_irgs() - 1; ii >= 0; --ii)
\
+ irg_verify(get_irp_irg(i
i), VRFY_ENFORCE_SSA);
\
timer_pop(); \
} \
} while (0)
timer_pop(); \
} \
} while (0)
@@
-107,7
+111,6
@@
static const ir_settings_arch_dep_t *ad_param = NULL;
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 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];
/* entities of runtime functions */
ir_entity_ptr rts_entities[rts_max];
@@
-285,11
+288,11
@@
static void dump_all_count(const char *const suffix)
*/
static void do_firm_optimizations(const char *input_filename, int firm_const_exists)
{
*/
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;
ir_graph *irg;
unsigned aa_opt;
+ /* FIXME: cloning might ADD new graphs. */
irg_dump_no = calloc(get_irp_last_idx(), sizeof(*irg_dump_no));
set_opt_strength_red(firm_opt.strength_red);
irg_dump_no = calloc(get_irp_last_idx(), sizeof(*irg_dump_no));
set_opt_strength_red(firm_opt.strength_red);
@@
-308,6
+311,9
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
timer_start(TV_ALL_OPT);
if (firm_opt.remove_unused) {
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 :-). */
/* Analysis that finds the free methods,
i.e. methods that are dereferenced.
Optimizes polymorphic calls :-). */
@@
-336,7
+342,7
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
if (firm_opt.func_calls) {
timer_push(TV_REAL_FUNC_CALL);
if (firm_opt.func_calls) {
timer_push(TV_REAL_FUNC_CALL);
- optimize_funccalls(firm_const_exists);
+ optimize_funccalls(firm_const_exists
, NULL
);
timer_pop();
DUMP_ALL_C(firm_dump.ir_graph && firm_dump.all_phases, "func_call");
CHECK_ALL(firm_opt.check_all);
timer_pop();
DUMP_ALL_C(firm_dump.ir_graph && firm_dump.all_phases, "func_call");
CHECK_ALL(firm_opt.check_all);
@@
-350,6
+356,9
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
CHECK_ALL(firm_opt.check_all);
}
CHECK_ALL(firm_opt.check_all);
}
+ /* do lowering on the const code irg */
+ lower_const_code();
+
for (i = 0; i < get_irp_n_irgs(); i++) {
irg = current_ir_graph = get_irp_irg(i);
for (i = 0; i < get_irp_n_irgs(); i++) {
irg = current_ir_graph = get_irp_irg(i);
@@
-424,6
+433,7
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
if (firm_opt.luffig) {
opt_ldst2(irg);
DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, irg, "ldst2");
if (firm_opt.luffig) {
opt_ldst2(irg);
DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, irg, "ldst2");
+ CHECK_ONE(firm_opt.check_all, irg);
}
timer_push(TV_CF_OPT);
}
timer_push(TV_CF_OPT);
@@
-463,7
+473,7
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
CHECK_ONE(firm_opt.check_all, irg);
}
CHECK_ONE(firm_opt.check_all, irg);
}
- lower_highlevel_graph(irg);
+ lower_highlevel_graph(irg
, firm_opt.lower_bitfields
);
if (firm_opt.deconv) {
timer_push(TV_DECONV);
if (firm_opt.deconv) {
timer_push(TV_DECONV);
@@
-518,7
+528,7
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
}
timer_push(TV_OSR);
}
timer_push(TV_OSR);
- opt_osr(current_ir_graph, osr_flag_default
/*| osr_flag_ignore_x86_shift*/
);
+ opt_osr(current_ir_graph, osr_flag_default
| osr_flag_keep_reg_pressure | osr_flag_ignore_x86_shift
);
timer_pop();
DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, irg, "stred");
CHECK_ONE(firm_opt.check_all, irg);
timer_pop();
DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, irg, "stred");
CHECK_ONE(firm_opt.check_all, irg);
@@
-540,6
+550,7
@@
static void do_firm_optimizations(const char *input_filename, int firm_const_exi
if (firm_opt.cloning) {
proc_cloning((float)firm_opt.clone_threshold);
DUMP_ALL_C(firm_dump.ir_graph && firm_dump.all_phases, "clone");
if (firm_opt.cloning) {
proc_cloning((float)firm_opt.clone_threshold);
DUMP_ALL_C(firm_dump.ir_graph && firm_dump.all_phases, "clone");
+ CHECK_ALL(firm_opt.check_all);
}
if (firm_dump.ir_graph) {
}
if (firm_dump.ir_graph) {
@@
-664,6
+675,7
@@
static int compute_type_size(ir_type *ty)
ir_node *upper = get_array_upper_bound(ty, i);
ir_graph *rem = current_ir_graph;
tarval *tv_lower, *tv_upper;
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);
current_ir_graph = get_const_code_irg();
local_optimize_node(lower);
@@
-682,7
+694,9
@@
static int compute_type_size(ir_type *ty)
return 0;
}
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);
}
restore_optimization_state(&state);
@@
-914,9
+928,7
@@
void gen_firm_init(void)
if (firm_be_opt.selection == BE_FIRM_BE) {
const backend_params *be_params = be_init();
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;
params.arch_op_settings = be_params->arch_op_settings;
arch_create_intrinsic = be_params->arch_create_intrinsic_fkt;
@@
-950,7
+962,7
@@
void gen_firm_init(void)
/* do not run architecture dependent optimizations in building phase */
arch_dep_set_opts(arch_dep_none);
/* 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));
if (firm_dump.filter)
only_dump_method_with_name(new_id_from_str(firm_dump.filter));
@@
-995,7
+1007,8
@@
void gen_firm_finish(FILE *out, const char *input_filename, int c_mode, int firm
int i;
/* the general for dumping option must be set, or the others will not work */
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);
dump_keepalive_edges(1);
dump_consts_local(1);
@@
-1078,9
+1091,10
@@
void gen_firm_finish(FILE *out, const char *input_filename, int c_mode, int firm
#endif
/* enable architecture dependent optimizations */
#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.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)
if (firm_dump.statistic & STAT_FINAL_IR)