From 54c4f9240c8ce3b556fb85954c0b507758380c22 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Fri, 2 Jun 2006 16:36:43 +0000 Subject: [PATCH] added the auto_create_sync flag to disable/enable the automatic Sync construction and fix the code (Syncs were not extended) [r7862] --- ir/ir/ircons.c | 76 +++++++++++++++++++++++++--------------------- ir/ir/irflag.h | 11 +++++++ ir/ir/irflag_t.def | 3 ++ 3 files changed, 55 insertions(+), 35 deletions(-) diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 6fe658928..02903caa7 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -16,29 +16,30 @@ #endif #ifdef HAVE_ALLOCA_H -#include +# include #endif #ifdef HAVE_MALLOC_H -#include +# include #endif #ifdef HAVE_STRING_H -#include +# include #endif -# include "irprog_t.h" -# include "irgraph_t.h" -# include "irnode_t.h" -# include "irmode_t.h" -# include "ircons_t.h" -# include "firm_common_t.h" -# include "irvrfy.h" -# include "irop_t.h" -# include "iropt_t.h" -# include "irgmod.h" -# include "array.h" -# include "irbackedge_t.h" -# include "irflag_t.h" -# include "iredges_t.h" +#include "irprog_t.h" +#include "irgraph_t.h" +#include "irnode_t.h" +#include "irmode_t.h" +#include "ircons_t.h" +#include "firm_common_t.h" +#include "irvrfy.h" +#include "irop_t.h" +#include "iropt_t.h" +#include "irgmod.h" +#include "array.h" +#include "irbackedge_t.h" +#include "irflag_t.h" +#include "iredges_t.h" +#include "irflag_t.h" #if USE_EXPLICIT_PHI_IN_STACK /* A stack needed for the automatic Phi node construction in constructor @@ -3084,25 +3085,30 @@ set_store (ir_node *store) assert(get_irg_phase_state (current_ir_graph) == phase_building); - /* handle non-volatile Load nodes by automatically creating Sync's */ - load = skip_Proj(store); - if (is_Load(load) && get_Load_volatility(load) == volatility_non_volatile) { - pred = get_Load_mem(load); + if (get_opt_auto_create_sync()) { + /* handle non-volatile Load nodes by automatically creating Sync's */ + load = skip_Proj(store); + if (is_Load(load) && get_Load_volatility(load) == volatility_non_volatile) { + pred = get_Load_mem(load); - if (is_Sync(pred)) { - /* a Load after a Sync: move it up */ - set_Load_mem(load, get_Sync_pred(pred, 0)); - store = pred; - } - else { - pload = skip_Proj(pred); - if (is_Load(pload) && get_Load_volatility(pload) == volatility_non_volatile) { - /* a Load after a Load: create a new Sync */ - set_Load_mem(load, get_Load_mem(pload)); - - in[0] = pred; - in[1] = store; - store = new_Sync(2, in); + if (is_Sync(pred)) { + /* a Load after a Sync: move it up */ + ir_node *mem = skip_Proj(get_Sync_pred(pred, 0)); + + set_Load_mem(load, get_memop_mem(mem)); + add_Sync_pred(pred, store); + store = pred; + } + else { + pload = skip_Proj(pred); + if (is_Load(pload) && get_Load_volatility(pload) == volatility_non_volatile) { + /* a Load after a Load: create a new Sync */ + set_Load_mem(load, get_Load_mem(pload)); + + in[0] = pred; + in[1] = store; + store = new_Sync(2, in); + } } } } diff --git a/ir/ir/irflag.h b/ir/ir/irflag.h index c1a0ad667..63ccef2f1 100644 --- a/ir/ir/irflag.h +++ b/ir/ir/irflag.h @@ -286,6 +286,17 @@ void set_opt_ldst_only_null_ptr_exceptions(int value); */ void set_opt_sel_based_null_check_elim(int value); +/** + * Enable/Disable Automatic construction of Sync nodes during + * Firm construction. + * + * If this flags is set, sequential non-volatile Loads are automatically + * rearranged so that they can be executed in parallel by creating Sync nodes. + * + * This flags should be set for Java style languages. + */ +void set_opt_auto_create_sync(int value); + /** Enable/Disable normalizations of the firm representation. * * This flag guards transformations that normalize the Firm representation diff --git a/ir/ir/irflag_t.def b/ir/ir/irflag_t.def index fd5846bef..3426e8591 100644 --- a/ir/ir/irflag_t.def +++ b/ir/ir/irflag_t.def @@ -96,5 +96,8 @@ I_FLAG(ldst_only_null_ptr_exceptions , 26, ON) /** Sel-based Null-pointer check elimination. */ I_FLAG(sel_based_null_check_elim , 27, OFF) +/** Automatically create Sync node during construction. */ +I_FLAG(auto_create_sync , 28, OFF) + /** Closed world assumption. */ I_FLAG(closed_world , 31, OFF) -- 2.20.1