From 77132820cdb48c0f2e2b4e79f95adc551ad8e18f Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 6 Oct 2007 19:31:27 +0000 Subject: [PATCH] add an option to disable calling convention optimisation [r16108] --- ir/be/ia32/bearch_ia32.c | 15 ++++----------- ir/be/ia32/bearch_ia32_t.h | 8 ++------ ir/be/ia32/ia32_optimize.c | 4 +--- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index a545e4fd4..8fa721237 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -1615,11 +1615,7 @@ static ia32_isa_t ia32_isa_template = { NULL, /* tv_ents */ (0 | IA32_OPT_INCDEC | /* optimize add 1, sub 1 into inc/dec default: on */ - IA32_OPT_DOAM | /* optimize address mode default: on */ - IA32_OPT_LEA | /* optimize for LEAs default: on */ - IA32_OPT_PLACECNST | /* place constants immediately before instructions, default: on */ - IA32_OPT_IMMOPS | /* operations can use immediates, default: on */ - IA32_OPT_PUSHARGS), /* create pushs for function argument passing, default: on */ + IA32_OPT_CC), /* create pushs for function argument passing, default: on */ arch_pentium_4, /* instruction architecture */ arch_pentium_4, /* optimize for architecture */ fp_x87, /* floating point mode */ @@ -1797,7 +1793,8 @@ static void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_cal cc = cc_cdecl_set; } else { cc = get_method_calling_convention(method_type); - if (get_method_additional_properties(method_type) & mtp_property_private) { + if (get_method_additional_properties(method_type) & mtp_property_private + && (ia32_isa_template.opt & IA32_OPT_CC)) { /* set the calling conventions to register parameter */ cc = (cc & ~cc_bits) | cc_reg_param; } @@ -2309,11 +2306,7 @@ static const lc_opt_table_entry_t ia32_options[] = { LC_OPT_ENT_ENUM_INT("arch", "select the instruction architecture", &arch_var), LC_OPT_ENT_ENUM_INT("opt", "optimize for instruction architecture", &opt_arch_var), LC_OPT_ENT_ENUM_INT("fpunit", "select the floating point unit", &fp_unit_var), - LC_OPT_ENT_NEGBIT("noaddrmode", "do not use address mode", &ia32_isa_template.opt, IA32_OPT_DOAM), - LC_OPT_ENT_NEGBIT("nolea", "do not optimize for LEAs", &ia32_isa_template.opt, IA32_OPT_LEA), - LC_OPT_ENT_NEGBIT("noplacecnst", "do not place constants", &ia32_isa_template.opt, IA32_OPT_PLACECNST), - LC_OPT_ENT_NEGBIT("noimmop", "no operations with immediates", &ia32_isa_template.opt, IA32_OPT_IMMOPS), - LC_OPT_ENT_NEGBIT("nopushargs", "do not create pushs for function arguments", &ia32_isa_template.opt, IA32_OPT_PUSHARGS), + LC_OPT_ENT_NEGBIT("nooptcc", "do not optimize calling convention", &ia32_isa_template.opt, IA32_OPT_CC), LC_OPT_ENT_ENUM_INT("gasmode", "set the GAS compatibility mode", &gas_var), LC_OPT_LAST }; diff --git a/ir/be/ia32/bearch_ia32_t.h b/ir/be/ia32/bearch_ia32_t.h index eb3206e4e..98852b60d 100644 --- a/ir/be/ia32/bearch_ia32_t.h +++ b/ir/be/ia32/bearch_ia32_t.h @@ -53,12 +53,8 @@ typedef enum fp_support fp_support; * Bitmask for the backend optimization settings. */ enum ia32_optimize_t { - IA32_OPT_INCDEC = 1, /**< optimize add/sub 1/-1 to inc/dec */ - IA32_OPT_DOAM = 2, /**< do address mode optimizations */ - IA32_OPT_LEA = 4, /**< optimize address calculations into LEAs */ - IA32_OPT_PLACECNST = 8, /**< place constants in the blocks where they are used */ - IA32_OPT_IMMOPS = 16, /**< create operations with immediate operands */ - IA32_OPT_PUSHARGS = 32, /**< create pushs for function argument passing */ + IA32_OPT_INCDEC = 1 << 0, /**< optimize add/sub 1/-1 to inc/dec */ + IA32_OPT_CC = 1 << 1, }; /** diff --git a/ir/be/ia32/ia32_optimize.c b/ir/be/ia32/ia32_optimize.c index 616110664..6d3cd57e3 100644 --- a/ir/be/ia32/ia32_optimize.c +++ b/ir/be/ia32/ia32_optimize.c @@ -274,9 +274,7 @@ static void ia32_peephole_optimize_node(ir_node *node, void *env) (void) env; if (be_is_IncSP(node)) { ia32_optimize_IncSP(node); - - if (cg->opt & IA32_OPT_PUSHARGS) - ia32_create_Pushs(node); + ia32_create_Pushs(node); } } -- 2.20.1