From: Michael Beck Date: Tue, 14 Oct 2008 01:40:12 +0000 (+0000) Subject: - let the compiler optimize the transformer selection IF there is nothing to select X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;ds=sidebyside;h=f1c64cce6209a56ea0ed44201b51c16c910ead07;p=libfirm - let the compiler optimize the transformer selection IF there is nothing to select [r22865] --- diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 5e5eb721f..579fecf57 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -89,6 +89,8 @@ #ifdef FIRM_GRGEN_BE #include "ia32_pbqp_transform.h" + +transformer_t be_transformer = TRANSFORMER_DEFAULT; #endif DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;) @@ -957,8 +959,6 @@ static void ia32_before_abi(void *self) { } } -transformer_t be_transformer = TRANSFORMER_DEFAULT; - /** * Transforms the standard firm graph into * an ia32 firm graph @@ -981,20 +981,21 @@ static void ia32_prepare_graph(void *self) { be_dump(cg->irg, "-pre_transform", dump_ir_block_graph_sched); switch (be_transformer) { - case TRANSFORMER_DEFAULT: - /* transform remaining nodes into assembler instructions */ - ia32_transform_graph(cg); - break; + case TRANSFORMER_DEFAULT: + /* transform remaining nodes into assembler instructions */ + ia32_transform_graph(cg); + break; #ifdef FIRM_GRGEN_BE - case TRANSFORMER_PBQP: - case TRANSFORMER_RAND: - /* transform nodes into assembler instructions by PBQP magic */ - ia32_transform_graph_by_pbqp(cg); - break; + case TRANSFORMER_PBQP: + case TRANSFORMER_RAND: + /* transform nodes into assembler instructions by PBQP magic */ + ia32_transform_graph_by_pbqp(cg); + break; #endif - default: panic("invalid transformer"); + default: + panic("invalid transformer"); } /* do local optimizations (mainly CSE) */ @@ -2354,22 +2355,24 @@ static lc_opt_enum_int_var_t gas_var = { (int*) &be_gas_flavour, gas_items }; +#ifdef FIRM_GRGEN_BE static const lc_opt_enum_int_items_t transformer_items[] = { { "default", TRANSFORMER_DEFAULT }, -#ifdef FIRM_GRGEN_BE { "pbqp", TRANSFORMER_PBQP }, { "random", TRANSFORMER_RAND }, -#endif { NULL, 0 } }; static lc_opt_enum_int_var_t transformer_var = { (int*)&be_transformer, transformer_items }; +#endif static const lc_opt_table_entry_t ia32_options[] = { LC_OPT_ENT_ENUM_INT("gasmode", "set the GAS compatibility mode", &gas_var), +#ifdef FIRM_GRGEN_BE LC_OPT_ENT_ENUM_INT("transformer", "the transformer used for code selection", &transformer_var), +#endif LC_OPT_ENT_INT("stackalign", "set power of two stack alignment for calls", &ia32_isa_template.arch_env.stack_alignment), LC_OPT_LAST diff --git a/ir/be/ia32/bearch_ia32_t.h b/ir/be/ia32/bearch_ia32_t.h index 5d8e03da8..4f8889dcb 100644 --- a/ir/be/ia32/bearch_ia32_t.h +++ b/ir/be/ia32/bearch_ia32_t.h @@ -26,6 +26,7 @@ #ifndef FIRM_BE_IA32_BEARCH_IA32_T_H #define FIRM_BE_IA32_BEARCH_IA32_T_H +#include "config.h" #include "pmap.h" #include "debug.h" #include "ia32_nodes_attr.h" @@ -120,9 +121,14 @@ typedef enum transformer_t { #endif } transformer_t; +#ifdef FIRM_GRGEN_BE /** The selected transformer. */ extern transformer_t be_transformer; +#else +#define be_transformer TRANSFORMER_DEFAULT +#endif + /** The mode for the floating point control word. */ extern ir_mode *mode_fpcw;