bool changed = false;
if (GET_CODE (pat) == SET)
- changed = change_zero_ext (pat);
+ {
+ /* For an unrecognized single set of a constant, try placing it in
+ the constant pool, if this function already uses one. */
+ rtx src = SET_SRC (pat);
+ if (CONSTANT_P (src)
+ && !CONST_INT_P (src)
+ && crtl->uses_const_pool)
+ {
+ machine_mode mode = GET_MODE (src);
+ if (mode == VOIDmode)
+ mode = GET_MODE (SET_DEST (pat));
+ src = force_const_mem (mode, src);
+ if (src)
+ {
+ SUBST (SET_SRC (pat), src);
+ changed = true;
+ }
+ }
+ else
+ changed = change_zero_ext (pat);
+ }
else if (GET_CODE (pat) == PARALLEL)
{
int i;
static struct table_elt *free_element_chain;
-/* Set to the cost of a constant pool reference if one was found for a
- symbolic constant. If this was found, it means we should try to
- convert constants into constant pool entries if they don't fit in
- the insn. */
-
-static int constant_pool_entries_cost;
-static int constant_pool_entries_regcost;
-
/* Trace a patch through the CFG. */
struct branch_path
int src_folded_regcost = MAX_COST;
int src_related_regcost = MAX_COST;
int src_elt_regcost = MAX_COST;
- /* Set nonzero if we need to call force_const_mem on with the
- contents of src_folded before using it. */
- int src_folded_force_flag = 0;
scalar_int_mode int_mode;
dest = SET_DEST (sets[i].rtl);
src_related_cost, src_related_regcost) <= 0
&& preferable (src_folded_cost, src_folded_regcost,
src_elt_cost, src_elt_regcost) <= 0)
- {
- trial = src_folded, src_folded_cost = MAX_COST;
- if (src_folded_force_flag)
- {
- rtx forced = force_const_mem (mode, trial);
- if (forced)
- trial = forced;
- }
- }
+ trial = src_folded, src_folded_cost = MAX_COST;
else if (src
&& preferable (src_cost, src_regcost,
src_eqv_cost, src_eqv_regcost) <= 0
break;
}
- /* If we previously found constant pool entries for
- constants and this is a constant, try making a
- pool entry. Put it in src_folded unless we already have done
- this since that is where it likely came from. */
+ /* If the current function uses a constant pool and this is a
+ constant, try making a pool entry. Put it in src_folded
+ unless we already have done this since that is where it
+ likely came from. */
- else if (constant_pool_entries_cost
+ else if (crtl->uses_const_pool
&& CONSTANT_P (trial)
- && (src_folded == 0
- || (!MEM_P (src_folded)
- && ! src_folded_force_flag))
+ && !CONST_INT_P (trial)
+ && (src_folded == 0 || !MEM_P (src_folded))
&& GET_MODE_CLASS (mode) != MODE_CC
&& mode != VOIDmode)
{
- src_folded_force_flag = 1;
- src_folded = trial;
- src_folded_cost = constant_pool_entries_cost;
- src_folded_regcost = constant_pool_entries_regcost;
+ src_folded = force_const_mem (mode, trial);
+ if (src_folded)
+ {
+ src_folded_cost = COST (src_folded, mode);
+ src_folded_regcost = approx_reg_cost (src_folded);
+ }
}
}
cse_cfg_altered = false;
cse_jumps_altered = false;
recorded_label_ref = false;
- constant_pool_entries_cost = 0;
- constant_pool_entries_regcost = 0;
ebb_data.path_size = 0;
ebb_data.nsets = 0;
rtl_hooks = cse_rtl_hooks;