1991-12-01 06:13:56 +01:00
|
|
|
|
/* Analyze RTL for C-Compiler
|
2000-02-26 15:26:24 +01:00
|
|
|
|
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
|
|
|
|
1999, 2000 Free Software Foundation, Inc.
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
1995-06-15 14:04:37 +02:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
Major cutover to using system.h:
* Makefile.in (alias.o, bitmap.o, c-aux-info.o, c-common.o,
c-decl.o, c-iterate.o, c-lang.o, c-lex.o, c-pragma.o, c-typeck.o,
caller-save.o, calls.o, collect2.o, combine.o, cse.o, dbxout.o,
dwarf2out.o, dwarfout.o, emit-rtl.o, except.o, explow.o, expmed.o,
expr.o, final.o, flow.o, function.o, getpwd.o, global.o,
integrate.o, jump.o, local-alloc.o, loop.o, optabs.o, pexecute.o,
prefix.o, print-rtl.o, print-tree.o, profile.o, real.o, recog.o,
reg-stack.o, regclass.o, regmove.o, reload.o, reload1.o, reorg.o,
rtl.o, rtlanal.o, sdbout.o, stmt.o, stor-layout.o, stupid.o,
tlink.o, toplev.o, tree.o, unroll.o, varasm.o, xcoffout.o): Depend
on system.h.
* alias.c, bitmap.c, c-aux-info.c, c-common.c, c-decl.c,
c-iterate.c, c-lang.c, c-lex.c, c-pragma.c, c-typeck.c,
caller-save.c, calls.c, collect2.c, combine.c, cse.c, dbxout.c,
dwarf2out.c, dwarfout.c, emit-rtl.c, except.c, explow.c, expmed.c,
expr.c, final.c, flow.c, function.c, gcc.c, getpwd.c, global.c,
integrate.c, jump.c, local-alloc.c, loop.c, optabs.c, pexecute.c,
prefix.c, print-rtl.c, print-tree.c, profile.c, real.c, recog.c,
reg-stack.c, regclass.c, regmove.c, reload.c, reload1.c, reorg.c,
rtl.c, rtlanal.c, sched.c, sdbout.c, stmt.c, stor-layout.c,
stupid.c, tlink.c, toplev.c, tree.c, unroll.c, varasm.c,
xcoffout.c: Include system.h. Organize include ordering so
that stdarg/varargs comes before other system headers. Remove
spurious casts of functions assured of a prototype in system.h.
From-SVN: r18726
1998-03-20 15:58:42 +01:00
|
|
|
|
#include "system.h"
|
1991-12-01 06:13:56 +01:00
|
|
|
|
#include "rtl.h"
|
|
|
|
|
|
2000-01-17 16:47:29 +01:00
|
|
|
|
static int rtx_addr_can_trap_p PARAMS ((rtx));
|
|
|
|
|
static void reg_set_p_1 PARAMS ((rtx, rtx, void *));
|
|
|
|
|
static void reg_set_last_1 PARAMS ((rtx, rtx, void *));
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
1997-09-22 02:49:32 +02:00
|
|
|
|
|
|
|
|
|
/* Forward declarations */
|
2000-01-17 16:47:29 +01:00
|
|
|
|
static int jmp_uses_reg_or_mem PARAMS ((rtx));
|
1997-09-22 02:49:32 +02:00
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* Bit flags that specify the machine subtype we are compiling for.
|
|
|
|
|
Bits are tested using macros TARGET_... defined in the tm.h file
|
|
|
|
|
and set by `-m...' switches. Must be defined in rtlanal.c. */
|
|
|
|
|
|
|
|
|
|
int target_flags;
|
|
|
|
|
|
|
|
|
|
/* Return 1 if the value of X is unstable
|
|
|
|
|
(would be different at a different point in the program).
|
|
|
|
|
The frame pointer, arg pointer, etc. are considered stable
|
|
|
|
|
(within one function) and so is anything marked `unchanging'. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rtx_unstable_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code = GET_CODE (x);
|
|
|
|
|
register int i;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
if (code == MEM)
|
|
|
|
|
return ! RTX_UNCHANGING_P (x);
|
|
|
|
|
|
|
|
|
|
if (code == QUEUED)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (code == CONST || code == CONST_INT)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (code == REG)
|
|
|
|
|
return ! (REGNO (x) == FRAME_POINTER_REGNUM
|
1993-09-24 21:54:09 +02:00
|
|
|
|
|| REGNO (x) == HARD_FRAME_POINTER_REGNUM
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|| REGNO (x) == ARG_POINTER_REGNUM
|
|
|
|
|
|| RTX_UNCHANGING_P (x));
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
if (rtx_unstable_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 1 if X has a value that can vary even between two
|
|
|
|
|
executions of the program. 0 means X can be compared reliably
|
|
|
|
|
against certain constants or near-constants.
|
|
|
|
|
The frame pointer and the arg pointer are considered constant. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rtx_varies_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code = GET_CODE (x);
|
|
|
|
|
register int i;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case MEM:
|
|
|
|
|
case QUEUED:
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case CONST:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
/* Note that we have to test for the actual rtx used for the frame
|
|
|
|
|
and arg pointers and not just the register number in case we have
|
|
|
|
|
eliminated the frame and/or arg pointer and are using it
|
|
|
|
|
for pseudos. */
|
1993-09-24 21:54:09 +02:00
|
|
|
|
return ! (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
|
1998-04-04 15:32:39 +02:00
|
|
|
|
|| x == arg_pointer_rtx || x == pic_offset_table_rtx);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
case LO_SUM:
|
|
|
|
|
/* The operand 0 of a LO_SUM is considered constant
|
|
|
|
|
(in fact is it related specifically to operand 1). */
|
|
|
|
|
return rtx_varies_p (XEXP (x, 1));
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
if (rtx_varies_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 0 if the use of X as an address in a MEM can cause a trap. */
|
|
|
|
|
|
1997-11-02 22:19:36 +01:00
|
|
|
|
static int
|
1991-12-01 06:13:56 +01:00
|
|
|
|
rtx_addr_can_trap_p (x)
|
|
|
|
|
register rtx x;
|
|
|
|
|
{
|
|
|
|
|
register enum rtx_code code = GET_CODE (x);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
/* SYMBOL_REF is problematic due to the possible presence of
|
|
|
|
|
a #pragma weak, but to say that loads from symbols can trap is
|
|
|
|
|
*very* costly. It's not at all clear what's best here. For
|
|
|
|
|
now, we ignore the impact of #pragma weak. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
/* As in rtx_varies_p, we have to use the actual rtx, not reg number. */
|
1993-09-24 21:54:09 +02:00
|
|
|
|
return ! (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
|
|
|
|
|
|| x == stack_pointer_rtx || x == arg_pointer_rtx);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
case CONST:
|
|
|
|
|
return rtx_addr_can_trap_p (XEXP (x, 0));
|
|
|
|
|
|
|
|
|
|
case PLUS:
|
|
|
|
|
/* An address is assumed not to trap if it is an address that can't
|
|
|
|
|
trap plus a constant integer. */
|
|
|
|
|
return (rtx_addr_can_trap_p (XEXP (x, 0))
|
|
|
|
|
|| GET_CODE (XEXP (x, 1)) != CONST_INT);
|
|
|
|
|
|
|
|
|
|
case LO_SUM:
|
|
|
|
|
return rtx_addr_can_trap_p (XEXP (x, 1));
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If it isn't one of the case above, it can cause a trap. */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 1 if X refers to a memory location whose address
|
|
|
|
|
cannot be compared reliably with constant addresses,
|
|
|
|
|
or if X refers to a BLKmode memory object. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rtx_addr_varies_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register enum rtx_code code;
|
|
|
|
|
register int i;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
if (code == MEM)
|
|
|
|
|
return GET_MODE (x) == BLKmode || rtx_varies_p (XEXP (x, 0));
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
if (fmt[i] == 'e')
|
1996-05-06 15:43:48 +02:00
|
|
|
|
{
|
|
|
|
|
if (rtx_addr_varies_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
if (rtx_addr_varies_p (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the value of the integer term in X, if one is apparent;
|
|
|
|
|
otherwise return 0.
|
|
|
|
|
Only obvious integer terms are detected.
|
|
|
|
|
This is used in cse.c with the `related_value' field.*/
|
|
|
|
|
|
1992-07-06 22:15:06 +02:00
|
|
|
|
HOST_WIDE_INT
|
1991-12-01 06:13:56 +01:00
|
|
|
|
get_integer_term (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (x) == CONST)
|
|
|
|
|
x = XEXP (x, 0);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (x) == MINUS
|
|
|
|
|
&& GET_CODE (XEXP (x, 1)) == CONST_INT)
|
|
|
|
|
return - INTVAL (XEXP (x, 1));
|
|
|
|
|
if (GET_CODE (x) == PLUS
|
|
|
|
|
&& GET_CODE (XEXP (x, 1)) == CONST_INT)
|
|
|
|
|
return INTVAL (XEXP (x, 1));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If X is a constant, return the value sans apparent integer term;
|
|
|
|
|
otherwise return 0.
|
|
|
|
|
Only obvious integer terms are detected. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
get_related_value (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (x) != CONST)
|
|
|
|
|
return 0;
|
|
|
|
|
x = XEXP (x, 0);
|
|
|
|
|
if (GET_CODE (x) == PLUS
|
|
|
|
|
&& GET_CODE (XEXP (x, 1)) == CONST_INT)
|
|
|
|
|
return XEXP (x, 0);
|
|
|
|
|
else if (GET_CODE (x) == MINUS
|
|
|
|
|
&& GET_CODE (XEXP (x, 1)) == CONST_INT)
|
|
|
|
|
return XEXP (x, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if register REG appears somewhere within IN.
|
|
|
|
|
Also works if REG is not a register; in this case it checks
|
|
|
|
|
for a subexpression of IN that is Lisp "equal" to REG. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_mentioned_p (reg, in)
|
|
|
|
|
register rtx reg, in;
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
register int i;
|
|
|
|
|
register enum rtx_code code;
|
|
|
|
|
|
|
|
|
|
if (in == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (reg == in)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (in) == LABEL_REF)
|
|
|
|
|
return reg == XEXP (in, 0);
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (in);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
/* Compare registers by number. */
|
|
|
|
|
case REG:
|
|
|
|
|
return GET_CODE (reg) == REG && REGNO (in) == REGNO (reg);
|
|
|
|
|
|
|
|
|
|
/* These codes have no constituent expressions
|
|
|
|
|
and are unique. */
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case CC0:
|
|
|
|
|
case PC:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
return GET_CODE (reg) == CONST_INT && INTVAL (in) == INTVAL (reg);
|
|
|
|
|
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
/* These are kept unique for a given value. */
|
|
|
|
|
return 0;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (reg) == code && rtx_equal_p (reg, in))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = XVECLEN (in, i) - 1; j >= 0; j--)
|
|
|
|
|
if (reg_mentioned_p (reg, XVECEXP (in, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'e'
|
|
|
|
|
&& reg_mentioned_p (reg, XEXP (in, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 1 if in between BEG and END, exclusive of BEG and END, there is
|
|
|
|
|
no CODE_LABEL insn. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
no_labels_between_p (beg, end)
|
|
|
|
|
rtx beg, end;
|
|
|
|
|
{
|
|
|
|
|
register rtx p;
|
|
|
|
|
for (p = NEXT_INSN (beg); p != end; p = NEXT_INSN (p))
|
|
|
|
|
if (GET_CODE (p) == CODE_LABEL)
|
|
|
|
|
return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
rtl.h (insn_first_p): Declare.
* rtl.h (insn_first_p): Declare.
* rtlanal.c (insn_first_p): New function.
* loop.h (varray.h): Include.
(struct induction): Change combined_with to unsigned.
New members derived, ix and last_use.
(reg_iv_type, reg_iv_info): Now varray_type. All references changed.
(REG_IV_TYPE, REG_IV_INFO): Define.
(first_increment_giv, last_increment_giv): Declare.
* loop.c (loop_number_loop_cont): New static variable.
(loop_number_cont_dominator): Likewise.
(reg_iv_type, reg_iv_info): Now varray_type.
(first_increment_giv, last_increment_giv): New variables.
(compute_luids, verify_dominator, find_life_end): New functions.
(cmp_recombine_givs_stats, recombine_givs): Likewise.
(loop_optimize): Allocate loop_number_loop_cont and
loop_number_cont_dominator. Use compute_luids.
(find_and_verify_loops): Initialize loop_number_loop_cont and
loop_number_cont_dominator.
(strength_reduce): Try to find bivs that can be expressed as givs
of another biv, and to convert biv increments into givs.
Call recombine_givs. Handle derived givs.
(record_biv): New argument location. All callers changed.
(record_giv): Initialize derived and last_use fields.
(basic_induction_var): New argument location. All callers changed.
(combine_givs): Don't combine a DEST_REG giv with a DEST_ADDR giv.
Increment combined_with instead of setting to 1.
* unroll.c (derived_regs): New static variable.
(unroll_loop): Initialize it.
Allocate local_regno according to max_reg_num.
(copy_loop_body): Cope with derived givs.
(find_splittable_givs): Check for Givs made from biv increments.
Set derived_regs for givs.
* Makefile.in (stmt.o, loop.o, unroll.o): Depend on loop.h .
From-SVN: r24889
1999-01-27 16:45:50 +01:00
|
|
|
|
/* Return 1 if in between BEG and END, exclusive of BEG and END, there is
|
|
|
|
|
no JUMP_INSN insn. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
no_jumps_between_p (beg, end)
|
|
|
|
|
rtx beg, end;
|
|
|
|
|
{
|
|
|
|
|
register rtx p;
|
|
|
|
|
for (p = NEXT_INSN (beg); p != end; p = NEXT_INSN (p))
|
|
|
|
|
if (GET_CODE (p) == JUMP_INSN)
|
|
|
|
|
return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* Nonzero if register REG is used in an insn between
|
|
|
|
|
FROM_INSN and TO_INSN (exclusive of those two). */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_used_between_p (reg, from_insn, to_insn)
|
|
|
|
|
rtx reg, from_insn, to_insn;
|
|
|
|
|
{
|
|
|
|
|
register rtx insn;
|
|
|
|
|
|
|
|
|
|
if (from_insn == to_insn)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
|
1994-05-06 23:43:38 +02:00
|
|
|
|
&& (reg_overlap_mentioned_p (reg, PATTERN (insn))
|
|
|
|
|
|| (GET_CODE (insn) == CALL_INSN
|
|
|
|
|
&& (find_reg_fusage (insn, USE, reg)
|
|
|
|
|
|| find_reg_fusage (insn, CLOBBER, reg)))))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if the old value of X, a register, is referenced in BODY. If X
|
|
|
|
|
is entirely replaced by a new value and the only use is as a SET_DEST,
|
|
|
|
|
we do not consider it a reference. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_referenced_p (x, body)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx body;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
switch (GET_CODE (body))
|
|
|
|
|
{
|
|
|
|
|
case SET:
|
|
|
|
|
if (reg_overlap_mentioned_p (x, SET_SRC (body)))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* If the destination is anything other than CC0, PC, a REG or a SUBREG
|
|
|
|
|
of a REG that occupies all of the REG, the insn references X if
|
|
|
|
|
it is mentioned in the destination. */
|
|
|
|
|
if (GET_CODE (SET_DEST (body)) != CC0
|
|
|
|
|
&& GET_CODE (SET_DEST (body)) != PC
|
|
|
|
|
&& GET_CODE (SET_DEST (body)) != REG
|
|
|
|
|
&& ! (GET_CODE (SET_DEST (body)) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (SET_DEST (body))) == REG
|
|
|
|
|
&& (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (body))))
|
|
|
|
|
+ (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
|
|
|
|
|
== ((GET_MODE_SIZE (GET_MODE (SET_DEST (body)))
|
|
|
|
|
+ (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)))
|
|
|
|
|
&& reg_overlap_mentioned_p (x, SET_DEST (body)))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
return 0;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
case ASM_OPERANDS:
|
|
|
|
|
for (i = ASM_OPERANDS_INPUT_LENGTH (body) - 1; i >= 0; i--)
|
|
|
|
|
if (reg_overlap_mentioned_p (x, ASM_OPERANDS_INPUT (body, i)))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
return 0;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
case CALL:
|
|
|
|
|
case USE:
|
[multiple changes]
Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR>
* gcov.c (DIR_SEPARATOR): Provide default.
(output_data): Add test for MS-DOS format absolute filename.
(fancy_abort): Correct program name.
(open_files): Open all files in binary mode.
* libgcc2.c (__bb_exit_func): Likewise.
* profile.c (init_branch_prob): Specify binary when opening files.
* flags.h (flag_unwind_tables): New decl.
* toplev.c (flag_unwind_table): New definition.
(f_options): Add -funwind-tables.
(decode_g_option): Clarify warning when unknown -g option is given.
(rest_of_compilation): If inside an inlined external function,
pretend we are just being declared.
* dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables.
(dwarf2out_frame_finish): Likewise.
Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com>
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.
Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt>
* fold-const.c (merge_ranges): In not in0, but in1, handle
upper bounds equal like subset case.
Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com>
* dbxout.c (dbxout_parms): Generate a second stabs line for parameters
passed in a register but moved to the stack.
Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr>
* gcc.c (pass_exit_codes, greatest_status): New variables.
(struct option_map): Add entry for "--pass-exit-codes".
(execute): Update greatest_status if error.
(display_help): Add documentation for -pass-exit-codes.
(process_command): Handle -pass-exit-codes.
(main): Look at pass_exit_codes and greatest_status on call to exit.
Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* reload.c (find_reloads): Refine test for no input reload
case to not includes reloads emitted after insn.
* function.c (find_temp_slots_from_address): Handle sum involving
a register that points to a temp slot.
(update_temp_slot_address): Make recursive call if both old and
new are PLUS with a common operand.
* calls.c (expand_call): Mark temp slot for result as having
address taken.
* rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case.
* gcc.c (process_command): Add standard_exec_prefix with "GCC"
component as well as "BINUTILS".
* integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS.
* integrate.c (copy_rtx_and_substitute): Likewise.
(expand_inline_function, integrate_parm_decls, integrate_decl_tree):
All callers changed.
* unroll.c (inital_reg_note_copy, copy_loop_body): Likewise.
* dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use
gdb extensions, write size of type; also be more consistent
in using references when this is a subtype.
* pa.md (extv, extzv, insv): Use define_expand to reject constant
that is out of range.
* loop.c (unknown_constant_address_altered): New variable.
(prescan_loop): Initialize it.
(note_addr_stored): Set it for RTX_UNCHANGING_P MEM.
(invariant_p, case MEM): Remove handling for volatile and readony;
check new variable if readonly.
(check_dbra_loop): Chdeck unknown_constant_address_altered.
* cse.c (canon_hash, case MEM): Do not record if BLKmode.
(addr_affects_sp_p): Removed from note_mem_written and only
define #ifdef AUTO_INC_DEC.
* alpha.c (input_operand, case ADDRESSOF): Treat as REG.
* regclass.c (record_reg_classes): Properly handle register move
directions.
* varasm.c (initializer_constant_valid_p, case MINUS_EXPR):
Don't think valid if both operands are invalid.
(struct constant_descriptor): New field RTL.
(mark_const_hash_entry): Mark it.
(record_constant{,_rtx}): Initialize it.
(output_constant_def): Allocate RTL in permanent obstack and
save in table.
({record,compare}_constant_1): Modes must match for
CONSTRUCTOR of ARRAY_TYPE.
* c-common.h (initializer_constant_valid_p): Delete decl from here.
* output.h (initializer_constant_valid_p): Move decl to here.
* c-common.c (initializer_constant_valid_p): Delete function from here.
* varasm.c (initializer_constant_valid_p): Move function to here.
* tree.h (STRIP_SIGN_NOPS): New macro.
* fold-const.c (optimize_minmax_comparison): New function.
(invert_truthvalue, case WITH_RECORD_EXPR): New case.
(fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS.
(fold, case EQ_EXPR): Call optimize_minmax_comparison and add
cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and
widening conversions.
(fold, case LE_EXPR): Rework changing unsigned to signed comparisons
to look at size of mode, not precision of type; also add missing cases.
(optimize_bit_field_compare, decode_field_reference): Don't try to
optimize COMPONENT_REF of a PLACEHOLDER_EXPR.
* dwarf2out.c (ctype.h): Include.
(dwarf2out_set_demangle_name_func): New function.
(size_of_line_info): Deleted.
(output_line_info): Compute size of line info table from difference
of labels.
(base_type_die, add_name_attribute): Call demangle function, if any.
(field_byte_offset): Use bits per word for variable length fields.
(gen_array_type_die): Add array name.
(gen_subprogram_die): Ignore DECL_INLINE if -fno-inline.
(dwarf2out_add_library_unit_info): New function.
* explow.c (set_stack_check_libfunc): New function.
(stack_check_libfunc): New static variable.
(probe_stack_range): Allow front-end to set up a libfunc to call.
* combine.c (simplify_comparison): When making comparison in wider
mode, check for having commuted an AND and a SUBREG.
(contains_muldiv): New function.
(try_combine): Call it when dividing a PARALLEL.
(simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart.
(simplify_comparison, case ASHIFTRT): Recognize sign-extension of
a PLUS.
(record_value_for_reg): If TEM is a binary operation with two CLOBBERs,
use one of the CLOBBERs instead.
(if_then_else_cond): If comparing against zero, just return thing
being compared.
* optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x).
Don't generate shifts and subtract if have conditional arithmetic.
* rtl.h (delete_barrier): New declaration.
* jump.c (jump_optimize): Set up to handle conditional call.
In conditional arithmetic case, handle CALL_INSN followed by a BARRIER.
(delete_barrier): New function.
* rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode.
* recog.c (nonmemory_operand): Accept ADDRESSOF.
* tree.c (build_type_attribute_variant): Push to obstack of
ttype around type_hash_canon call.
* expr.c (placeholder_list): Move decl to file scope.
(expand_expr): Don't force access to volatile just because its
address is taken.
If ignoring reference operations, just expand the operands.
(expand_expr, case COMPONENT_REF): Propagate
EXPAND_CONST_ADDRESS to recursive call when expanding inner.
Refine test for using bitfield operations vs pointer punning.
(expand_expr, case CONVERT_EXPR): If converting to
BLKmode UNION_TYPE from BLKmode, just return inner object.
Use proper mode in store_field call.
Properly set sizes of object to store and total size in store_field
call for convert to union.
(expand_expr, case ARRAY_REF): If OP0 is in a register, put it in
memory (like for ADDR_EXPR). Also, don't put constant in register if
we'll want it in memory.
(readonly_fields_p): New function.
(expand_expr, case INDIRECT_REF): Call it if LHS.
(expand_assignment): Handle a RESULT_DECL where
DECL_RTL is a PARALLEL.
(do_jump, case WITH_RECORD_EXPR): New case.
(get_inner_reference): Always go inside a CONVERT_EXPR
and NOP_EXPR if both modes are the same.
(store_field): Use bitfield operations if size of bitsize is not same
as size of RHS's type.
Check for bitpos not a multiple of alignment in BLKmode case.
Do block move in largest possible alignment.
(store_constructor): Set BITSIZE to -1 for variable size and properly
in case of array of BLKmode.
(expand_expr_unaligned): New function.
(do_compare_and_jump): Call it.
* mips/iris5.h (SWITCHES_NEED_SPACES): New macro.
* collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES
does not include 'o'.
* function.c (instantiate_virtual_regs_1, case SET): Handle case where
both SET_DEST and SET_SRC reference a virtual register.
(gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG.
* integrate.c (expand_inline_function): Handle case of setting
virtual stack vars register (from built in setjmp); when parameter
lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early.
(subst_constant): Add new parm, MEMONLY.
(expand_inline_function, integrate_parm_decls): Pass new parm.
(integrate_decl_tree): Likewise.
(copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P.
(try_constants): Call subst_constants twice, with MEMONLY 0 and 1.
(copy_rtx_and_substitute, case SET): Add explicit calls to
copy_rtx_and_substitute for both sides.
* stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for
constraints.
(pushcase{,_range}): Convert to NOMINAL_TYPE after checking for
within INDEX_TYPE, instead of before.
(fixup_gotos): Use f->target_rtl, not the next insn,
since latter may be from a later fixup.
(expand_value_return): Correctly convert VAL when promoting function
return; support RETURN_REG being a PARALLEL.
(expand_return): When checking for result in regs and having
cleanup, consider PARALLEL in DECL_RTL as being in regs.
From-SVN: r30299
1999-11-01 02:11:22 +01:00
|
|
|
|
case IF_THEN_ELSE:
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return reg_overlap_mentioned_p (x, body);
|
|
|
|
|
|
|
|
|
|
case TRAP_IF:
|
|
|
|
|
return reg_overlap_mentioned_p (x, TRAP_CONDITION (body));
|
|
|
|
|
|
1992-01-28 20:31:58 +01:00
|
|
|
|
case UNSPEC:
|
|
|
|
|
case UNSPEC_VOLATILE:
|
1999-06-23 17:05:18 +02:00
|
|
|
|
for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
|
|
|
|
|
if (reg_overlap_mentioned_p (x, XVECEXP (body, 0, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
case PARALLEL:
|
|
|
|
|
for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
|
|
|
|
|
if (reg_referenced_p (x, XVECEXP (body, 0, i)))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
2000-01-19 21:21:08 +01:00
|
|
|
|
case CLOBBER:
|
|
|
|
|
if (GET_CODE (XEXP (body, 0)) == MEM)
|
|
|
|
|
if (reg_overlap_mentioned_p (x, XEXP (XEXP (body, 0), 0)))
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
|
1997-11-02 22:19:36 +01:00
|
|
|
|
default:
|
|
|
|
|
return 0;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if register REG is referenced in an insn between
|
|
|
|
|
FROM_INSN and TO_INSN (exclusive of those two). Sets of REG do
|
1996-07-04 00:07:53 +02:00
|
|
|
|
not count. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_referenced_between_p (reg, from_insn, to_insn)
|
|
|
|
|
rtx reg, from_insn, to_insn;
|
|
|
|
|
{
|
|
|
|
|
register rtx insn;
|
|
|
|
|
|
|
|
|
|
if (from_insn == to_insn)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
|
1994-05-06 23:43:38 +02:00
|
|
|
|
&& (reg_referenced_p (reg, PATTERN (insn))
|
|
|
|
|
|| (GET_CODE (insn) == CALL_INSN
|
|
|
|
|
&& find_reg_fusage (insn, USE, reg))))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if register REG is set or clobbered in an insn between
|
|
|
|
|
FROM_INSN and TO_INSN (exclusive of those two). */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_set_between_p (reg, from_insn, to_insn)
|
|
|
|
|
rtx reg, from_insn, to_insn;
|
|
|
|
|
{
|
|
|
|
|
register rtx insn;
|
|
|
|
|
|
|
|
|
|
if (from_insn == to_insn)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
|
1992-01-18 01:05:16 +01:00
|
|
|
|
&& reg_set_p (reg, insn))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Internals of reg_set_between_p. */
|
|
|
|
|
|
|
|
|
|
static rtx reg_set_reg;
|
|
|
|
|
static int reg_set_flag;
|
|
|
|
|
|
1995-06-28 22:08:29 +02:00
|
|
|
|
static void
|
1999-10-27 21:27:41 +02:00
|
|
|
|
reg_set_p_1 (x, pat, data)
|
Warning fixes:
* Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h.
(c-lex.o): Depend on output.h.
(c-common.o): Likewise.
(stmt.o): Likewise.
(calls.o): Likewise.
(integrate.o): Depend on toplev.h.
(regclass.o): Depend on output.h.
(final.o): Depend on reload.h.
* c-common.c: Include output.h.
(check_format_info): Remove unused variable `integral_format'.
* c-decl.c (print_lang_decl): Mark parameters `file', `node' and
`indent' with ATTRIBUTE_UNUSED.
(print_lang_type): Likewise.
(maybe_build_cleanup): Likewise for parameter `decl'.
(copy_lang_decl): Likewise for parameter `node'.
* c-lang.c: Include c-tree.h, c-lex.h and toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(lookup_interface): Likewise for parameter `arg'.
(is_class_name): Likewise.
(maybe_objc_check_decl): Likewise for parameter `decl'.
(maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and
`reflexive'.
(maybe_objc_method_name): Likewise for parameter `decl'.
(build_objc_string): Likewise for parameters `len' and `str'.
* c-lex.c: Include output.h.
* c-lex.h (position_after_white_space): Correct typo in prototype.
* c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else,
c_expand_end_cond, init_iterators): Add prototypes.
* caller-save.c (set_reg_live): Mark parameters `reg' and `setter'
with ATTRIBUTE_UNUSED.
* calls.c: Include output.h.
* cccp.c (pipe_closed): Mark parameter `signo' with
ATTRIBUTE_UNUSED.
* combine.c: Move inclusion of expr.h to after insn-config.h.
* iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define
as empty, rather define as ((void)0).
* sparc.c (sparc_check_64): Add braces around ambiguous `else'.
Add parentheses around assignment used as truth value.
* cplus-dem.c (squangle_mop_up): Change return type to void.
(internal_cplus_demangle): Remove unused parameter `options'.
All callers changed.
(cplus_demangle_opname): Remove function wide variable `int i' and
replace with `size_t i' at each location where it is used.
(cplus_demangle_opname): change type of `i' from int to size_t.
* cppexp.c (right_shift): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
* cpphash.c (cpp_lookup): Likewise.
(cpp_hash_cleanup): Likewise.
* cpplib.c (parse_name): Add a prototype and make it static.
(null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED.
(null_cleanup): Likewise for parameters `pbuf' and `pfile'.
(macro_cleanup): Likewise for parameter `pfile'.
(file_cleanup): Likewise.
* cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read,
cpp_read_check_assertion, skip_rest_of_line): Add prototypes.
* crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data,
__DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED.
* cse.c (cse_check_loop_start): Mark parameter `set' with
ATTRIBUTE_UNUSED.
* dbxout.c (flag_minimal_debug, have_used_extensions,
source_label_number): Move inside macro wrapper check against
defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO).
* dwarf2out.c (gen_entry_point_die): Hide prototype and definition.
* except.h (doing_eh): Provide prototype.
* expr.c: Move inclusion of expr.h to after insn-config.h.
* final.c: Include reload.h.
(shorten_branches): Cast the first argument of bzero to char *.
* fix-header.c (cpp_print_containing_files): Mark parameter
`pfile' with ATTRIBUTE_UNUSED.
(cpp_fatal): Likewise.
* flow.c (find_basic_blocks_1): Cast the first argument of bzero
to char *.
* genattrtab.c (make_length_attrs): Change the type of variable
`i' from int to size_t.
(zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED.
(one_fn): Likewise.
* genextract.c (main): When generating insn-extract.c, mark
variable `junk' with ATTRIBUTE_UNUSED.
* gengenrtl.c (gencode): When generating genrtl.c, cast the first
argument of bzero to char*.
* integrate.c: Include toplev.h.
* libgcc2.c: Wrap `struct exception_table' and
`find_exception_handler' in macro DWARF2_UNWIND_INFO.
* objc/Make-lang.in (objc-act.o): Depend on toplev.h.
* objc/objc-act.c: Include toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(finish_protocol): Likewise for parameter `protocol'.
* output.h (declare_weak): Add prototype.
(decode_reg_name): Don't wrap with TREE_CODE macro.
(assemble_alias): Add prototype.
* regclass.c: Include output.h.
* reload.h (reloads_conflict): Add prototype.
* rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p,
output_func_start_profiler): Add prototypes.
* rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with
ATTRIBUTE_UNUSED.
* scan-decls.c: Include scan.h.
* scan.h (recognized_function, recognized_extern): Add prototypes.
* stmt.c: Include output.h.
* toplev.c (error_for_asm, warning_for_asm): Remove prototypes.
(output_lang_identify): Hide prototype and definition.
(float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED.
(pipe_closed): Likewise.
* toplev.h (count_error, strip_off_ending, error_for_asm,
warning_for_asm): Add prototypes.
From-SVN: r19712
1998-05-13 14:40:39 +02:00
|
|
|
|
rtx x;
|
|
|
|
|
rtx pat ATTRIBUTE_UNUSED;
|
1999-10-27 21:27:41 +02:00
|
|
|
|
void *data ATTRIBUTE_UNUSED;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
/* We don't want to return 1 if X is a MEM that contains a register
|
|
|
|
|
within REG_SET_REG. */
|
|
|
|
|
|
|
|
|
|
if ((GET_CODE (x) != MEM)
|
|
|
|
|
&& reg_overlap_mentioned_p (reg_set_reg, x))
|
|
|
|
|
reg_set_flag = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_set_p (reg, insn)
|
|
|
|
|
rtx reg, insn;
|
|
|
|
|
{
|
|
|
|
|
rtx body = insn;
|
|
|
|
|
|
|
|
|
|
/* We can be passed an insn or part of one. If we are passed an insn,
|
|
|
|
|
check if a side-effect of the insn clobbers REG. */
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
|
|
|
|
|
{
|
|
|
|
|
if (FIND_REG_INC_NOTE (insn, reg)
|
|
|
|
|
|| (GET_CODE (insn) == CALL_INSN
|
|
|
|
|
/* We'd like to test call_used_regs here, but rtlanal.c can't
|
|
|
|
|
reference that variable due to its use in genattrtab. So
|
1994-05-06 23:43:38 +02:00
|
|
|
|
we'll just be more conservative.
|
|
|
|
|
|
|
|
|
|
??? Unless we could ensure that the CALL_INSN_FUNCTION_USAGE
|
|
|
|
|
information holds all clobbered registers. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
&& ((GET_CODE (reg) == REG
|
|
|
|
|
&& REGNO (reg) < FIRST_PSEUDO_REGISTER)
|
1994-05-06 23:43:38 +02:00
|
|
|
|
|| GET_CODE (reg) == MEM
|
|
|
|
|
|| find_reg_fusage (insn, CLOBBER, reg))))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
body = PATTERN (insn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reg_set_reg = reg;
|
|
|
|
|
reg_set_flag = 0;
|
1999-10-27 21:27:41 +02:00
|
|
|
|
note_stores (body, reg_set_p_1, NULL);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return reg_set_flag;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-26 01:21:27 +01:00
|
|
|
|
/* Similar to reg_set_between_p, but check all registers in X. Return 0
|
|
|
|
|
only if none of them are modified between START and END. Do not
|
|
|
|
|
consider non-registers one way or the other. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
regs_set_between_p (x, start, end)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx start, end;
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1998-11-26 01:21:27 +01:00
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CONST:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
return reg_set_between_p (x, start, end);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' && regs_set_between_p (XEXP (x, i), start, end))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
if (regs_set_between_p (XVECEXP (x, i, j), start, end))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* Similar to reg_set_between_p, but check all registers in X. Return 0
|
|
|
|
|
only if none of them are modified between START and END. Return 1 if
|
|
|
|
|
X contains a MEM; this routine does not perform any memory aliasing. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
modified_between_p (x, start, end)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx start, end;
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1993-09-06 19:27:22 +02:00
|
|
|
|
int i, j;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CONST:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case MEM:
|
|
|
|
|
/* If the memory is not constant, assume it is modified. If it is
|
|
|
|
|
constant, we still have to check the address. */
|
|
|
|
|
if (! RTX_UNCHANGING_P (x))
|
|
|
|
|
return 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
return reg_set_between_p (x, start, end);
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
1993-09-06 19:27:22 +02:00
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' && modified_between_p (XEXP (x, i), start, end))
|
|
|
|
|
return 1;
|
|
|
|
|
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1993-09-06 19:27:22 +02:00
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
if (modified_between_p (XVECEXP (x, i, j), start, end))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Similar to reg_set_p, but check all registers in X. Return 0 only if none
|
|
|
|
|
of them are modified in INSN. Return 1 if X contains a MEM; this routine
|
|
|
|
|
does not perform any memory aliasing. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
modified_in_p (x, insn)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1993-09-06 19:27:22 +02:00
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CONST:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
|
1993-09-06 19:27:22 +02:00
|
|
|
|
case MEM:
|
|
|
|
|
/* If the memory is not constant, assume it is modified. If it is
|
|
|
|
|
constant, we still have to check the address. */
|
|
|
|
|
if (! RTX_UNCHANGING_P (x))
|
|
|
|
|
return 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
return reg_set_p (x, insn);
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1993-09-06 19:27:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' && modified_in_p (XEXP (x, i), insn))
|
|
|
|
|
return 1;
|
|
|
|
|
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1993-09-06 19:27:22 +02:00
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
if (modified_in_p (XVECEXP (x, i, j), insn))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given an INSN, return a SET expression if this insn has only a single SET.
|
|
|
|
|
It may also have CLOBBERs, USEs, or SET whose output
|
|
|
|
|
will not be used, which we ignore. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
single_set (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx set;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (PATTERN (insn)) == SET)
|
|
|
|
|
return PATTERN (insn);
|
|
|
|
|
|
|
|
|
|
else if (GET_CODE (PATTERN (insn)) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0, set = 0; i < XVECLEN (PATTERN (insn), 0); i++)
|
|
|
|
|
if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET
|
1992-10-14 05:02:16 +01:00
|
|
|
|
&& (! find_reg_note (insn, REG_UNUSED,
|
|
|
|
|
SET_DEST (XVECEXP (PATTERN (insn), 0, i)))
|
|
|
|
|
|| side_effects_p (XVECEXP (PATTERN (insn), 0, i))))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
if (set)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
set = XVECEXP (PATTERN (insn), 0, i);
|
|
|
|
|
}
|
|
|
|
|
return set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1998-12-13 00:03:54 +01:00
|
|
|
|
|
|
|
|
|
/* Given an INSN, return nonzero if it has more than one SET, else return
|
|
|
|
|
zero. */
|
|
|
|
|
|
1998-12-14 01:42:39 +01:00
|
|
|
|
int
|
1998-12-13 00:03:54 +01:00
|
|
|
|
multiple_sets (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
1998-12-22 16:17:13 +01:00
|
|
|
|
int found;
|
1998-12-13 00:03:54 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* INSN must be an insn. */
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Only a PARALLEL can have multiple SETs. */
|
|
|
|
|
if (GET_CODE (PATTERN (insn)) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0, found = 0; i < XVECLEN (PATTERN (insn), 0); i++)
|
|
|
|
|
if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
|
|
|
|
|
{
|
|
|
|
|
/* If we have already found a SET, then return now. */
|
|
|
|
|
if (found)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
found = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Either zero or one SET. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
2000-02-26 03:58:08 +01:00
|
|
|
|
/* Return the last thing that X was assigned from before *PINSN. If VALID_TO
|
|
|
|
|
is not NULL_RTX then verify that the object is not modified up to VALID_TO.
|
|
|
|
|
If the object was modified, if we hit a partial assignment to X, or hit a
|
|
|
|
|
CODE_LABEL first, return X. If we found an assignment, update *PINSN to
|
|
|
|
|
point to it. ALLOW_HWREG is set to 1 if hardware registers are allowed to
|
|
|
|
|
be the src. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
rtx
|
1999-02-22 15:11:58 +01:00
|
|
|
|
find_last_value (x, pinsn, valid_to, allow_hwreg)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
rtx x;
|
|
|
|
|
rtx *pinsn;
|
|
|
|
|
rtx valid_to;
|
1999-02-22 15:11:58 +01:00
|
|
|
|
int allow_hwreg;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
rtx p;
|
|
|
|
|
|
|
|
|
|
for (p = PREV_INSN (*pinsn); p && GET_CODE (p) != CODE_LABEL;
|
|
|
|
|
p = PREV_INSN (p))
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
|
|
|
|
|
{
|
|
|
|
|
rtx set = single_set (p);
|
1992-07-06 22:15:06 +02:00
|
|
|
|
rtx note = find_reg_note (p, REG_EQUAL, NULL_RTX);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
if (set && rtx_equal_p (x, SET_DEST (set)))
|
|
|
|
|
{
|
|
|
|
|
rtx src = SET_SRC (set);
|
|
|
|
|
|
|
|
|
|
if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
|
|
|
|
|
src = XEXP (note, 0);
|
|
|
|
|
|
2000-02-26 03:58:08 +01:00
|
|
|
|
if ((valid_to == NULL_RTX
|
|
|
|
|
|| ! modified_between_p (src, PREV_INSN (p), valid_to))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* Reject hard registers because we don't usually want
|
|
|
|
|
to use them; we'd rather use a pseudo. */
|
1999-02-22 15:11:58 +01:00
|
|
|
|
&& (! (GET_CODE (src) == REG
|
|
|
|
|
&& REGNO (src) < FIRST_PSEUDO_REGISTER) || allow_hwreg))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
*pinsn = p;
|
|
|
|
|
return src;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If set in non-simple way, we don't have a value. */
|
|
|
|
|
if (reg_set_p (x, p))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if register in range [REGNO, ENDREGNO)
|
|
|
|
|
appears either explicitly or implicitly in X
|
|
|
|
|
other than being stored into.
|
|
|
|
|
|
|
|
|
|
References contained within the substructure at LOC do not count.
|
|
|
|
|
LOC may be zero, meaning don't ignore anything. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
refers_to_regno_p (regno, endregno, x, loc)
|
|
|
|
|
int regno, endregno;
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx *loc;
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
register RTX_CODE code;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
repeat:
|
|
|
|
|
/* The contents of a REG_NONNEG note is always zero, so we must come here
|
|
|
|
|
upon repeat in case the last REG_NOTE is a REG_NONNEG note. */
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case REG:
|
|
|
|
|
i = REGNO (x);
|
1993-09-06 19:27:22 +02:00
|
|
|
|
|
|
|
|
|
/* If we modifying the stack, frame, or argument pointer, it will
|
|
|
|
|
clobber a virtual register. In fact, we could be more precise,
|
|
|
|
|
but it isn't worth it. */
|
|
|
|
|
if ((i == STACK_POINTER_REGNUM
|
|
|
|
|
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
|
|
|
|
|
|| i == ARG_POINTER_REGNUM
|
|
|
|
|
#endif
|
|
|
|
|
|| i == FRAME_POINTER_REGNUM)
|
|
|
|
|
&& regno >= FIRST_VIRTUAL_REGISTER && regno <= LAST_VIRTUAL_REGISTER)
|
|
|
|
|
return 1;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return (endregno > i
|
|
|
|
|
&& regno < i + (i < FIRST_PSEUDO_REGISTER
|
|
|
|
|
? HARD_REGNO_NREGS (i, GET_MODE (x))
|
|
|
|
|
: 1));
|
|
|
|
|
|
|
|
|
|
case SUBREG:
|
|
|
|
|
/* If this is a SUBREG of a hard reg, we can see exactly which
|
|
|
|
|
registers are being modified. Otherwise, handle normally. */
|
|
|
|
|
if (GET_CODE (SUBREG_REG (x)) == REG
|
|
|
|
|
&& REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
int inner_regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
|
|
|
|
|
int inner_endregno
|
|
|
|
|
= inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
|
|
|
|
|
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
|
|
|
|
|
|
|
|
|
|
return endregno > inner_regno && regno < inner_endregno;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CLOBBER:
|
|
|
|
|
case SET:
|
|
|
|
|
if (&SET_DEST (x) != loc
|
|
|
|
|
/* Note setting a SUBREG counts as referring to the REG it is in for
|
|
|
|
|
a pseudo but not for hard registers since we can
|
|
|
|
|
treat each word individually. */
|
|
|
|
|
&& ((GET_CODE (SET_DEST (x)) == SUBREG
|
|
|
|
|
&& loc != &SUBREG_REG (SET_DEST (x))
|
|
|
|
|
&& GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
|
|
|
|
|
&& REGNO (SUBREG_REG (SET_DEST (x))) >= FIRST_PSEUDO_REGISTER
|
|
|
|
|
&& refers_to_regno_p (regno, endregno,
|
|
|
|
|
SUBREG_REG (SET_DEST (x)), loc))
|
|
|
|
|
|| (GET_CODE (SET_DEST (x)) != REG
|
|
|
|
|
&& refers_to_regno_p (regno, endregno, SET_DEST (x), loc))))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (code == CLOBBER || loc == &SET_SRC (x))
|
|
|
|
|
return 0;
|
|
|
|
|
x = SET_SRC (x);
|
|
|
|
|
goto repeat;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* X does not match, so try its subexpressions. */
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' && loc != &XEXP (x, i))
|
|
|
|
|
{
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
x = XEXP (x, 0);
|
|
|
|
|
goto repeat;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (refers_to_regno_p (regno, endregno, XEXP (x, i), loc))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >=0; j--)
|
|
|
|
|
if (loc != &XVECEXP (x, i, j)
|
|
|
|
|
&& refers_to_regno_p (regno, endregno, XVECEXP (x, i, j), loc))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if modifying X will affect IN. If X is a register or a SUBREG,
|
|
|
|
|
we check if any register number in X conflicts with the relevant register
|
|
|
|
|
numbers. If X is a constant, return 0. If X is a MEM, return 1 iff IN
|
|
|
|
|
contains a MEM (we don't bother checking for memory addresses that can't
|
|
|
|
|
conflict because we expect this to be a rare case. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
reg_overlap_mentioned_p (x, in)
|
|
|
|
|
rtx x, in;
|
|
|
|
|
{
|
|
|
|
|
int regno, endregno;
|
|
|
|
|
|
1998-07-08 03:58:58 +02:00
|
|
|
|
/* Overly conservative. */
|
|
|
|
|
if (GET_CODE (x) == STRICT_LOW_PART)
|
|
|
|
|
x = XEXP (x, 0);
|
|
|
|
|
|
|
|
|
|
/* If either argument is a constant, then modifying X can not affect IN. */
|
|
|
|
|
if (CONSTANT_P (x) || CONSTANT_P (in))
|
|
|
|
|
return 0;
|
|
|
|
|
else if (GET_CODE (x) == SUBREG)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
regno = REGNO (SUBREG_REG (x));
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
regno += SUBREG_WORD (x);
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (x) == REG)
|
|
|
|
|
regno = REGNO (x);
|
|
|
|
|
else if (GET_CODE (x) == MEM)
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (in) == MEM)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (GET_CODE (in));
|
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (GET_CODE (in)) - 1; i >= 0; i--)
|
|
|
|
|
if (fmt[i] == 'e' && reg_overlap_mentioned_p (x, XEXP (in, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
|
|
|
|
|
|| GET_CODE (x) == CC0)
|
|
|
|
|
return reg_mentioned_p (x, in);
|
1998-09-12 05:45:22 +02:00
|
|
|
|
else if (GET_CODE (x) == PARALLEL
|
|
|
|
|
&& GET_MODE (x) == BLKmode)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
/* If any register in here refers to it
|
|
|
|
|
we return true. */
|
|
|
|
|
for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
|
|
|
|
|
if (reg_overlap_mentioned_p (SET_DEST (XVECEXP (x, 0, i)), in))
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
else
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
endregno = regno + (regno < FIRST_PSEUDO_REGISTER
|
|
|
|
|
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
|
|
|
|
|
|
1992-07-06 22:15:06 +02:00
|
|
|
|
return refers_to_regno_p (regno, endregno, in, NULL_PTR);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used for communications between the next few functions. */
|
|
|
|
|
|
|
|
|
|
static int reg_set_last_unknown;
|
|
|
|
|
static rtx reg_set_last_value;
|
|
|
|
|
static int reg_set_last_first_regno, reg_set_last_last_regno;
|
|
|
|
|
|
|
|
|
|
/* Called via note_stores from reg_set_last. */
|
|
|
|
|
|
|
|
|
|
static void
|
1999-10-27 21:27:41 +02:00
|
|
|
|
reg_set_last_1 (x, pat, data)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
rtx x;
|
|
|
|
|
rtx pat;
|
1999-10-27 21:27:41 +02:00
|
|
|
|
void *data ATTRIBUTE_UNUSED;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
int first, last;
|
|
|
|
|
|
|
|
|
|
/* If X is not a register, or is not one in the range we care
|
|
|
|
|
about, ignore. */
|
|
|
|
|
if (GET_CODE (x) != REG)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
first = REGNO (x);
|
|
|
|
|
last = first + (first < FIRST_PSEUDO_REGISTER
|
|
|
|
|
? HARD_REGNO_NREGS (first, GET_MODE (x)) : 1);
|
|
|
|
|
|
|
|
|
|
if (first >= reg_set_last_last_regno
|
|
|
|
|
|| last <= reg_set_last_first_regno)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If this is a CLOBBER or is some complex LHS, or doesn't modify
|
|
|
|
|
exactly the registers we care about, show we don't know the value. */
|
|
|
|
|
if (GET_CODE (pat) == CLOBBER || SET_DEST (pat) != x
|
|
|
|
|
|| first != reg_set_last_first_regno
|
|
|
|
|
|| last != reg_set_last_last_regno)
|
|
|
|
|
reg_set_last_unknown = 1;
|
|
|
|
|
else
|
|
|
|
|
reg_set_last_value = SET_SRC (pat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the last value to which REG was set prior to INSN. If we can't
|
|
|
|
|
find it easily, return 0.
|
|
|
|
|
|
1992-09-19 21:42:53 +02:00
|
|
|
|
We only return a REG, SUBREG, or constant because it is too hard to
|
|
|
|
|
check if a MEM remains unchanged. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
reg_set_last (x, insn)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx orig_insn = insn;
|
|
|
|
|
|
|
|
|
|
reg_set_last_first_regno = REGNO (x);
|
|
|
|
|
|
|
|
|
|
reg_set_last_last_regno
|
|
|
|
|
= reg_set_last_first_regno
|
|
|
|
|
+ (reg_set_last_first_regno < FIRST_PSEUDO_REGISTER
|
|
|
|
|
? HARD_REGNO_NREGS (reg_set_last_first_regno, GET_MODE (x)) : 1);
|
|
|
|
|
|
|
|
|
|
reg_set_last_unknown = 0;
|
|
|
|
|
reg_set_last_value = 0;
|
|
|
|
|
|
|
|
|
|
/* Scan backwards until reg_set_last_1 changed one of the above flags.
|
|
|
|
|
Stop when we reach a label or X is a hard reg and we reach a
|
|
|
|
|
CALL_INSN (if reg_set_last_last_regno is a hard reg).
|
|
|
|
|
|
|
|
|
|
If we find a set of X, ensure that its SET_SRC remains unchanged. */
|
|
|
|
|
|
1993-01-24 00:03:57 +01:00
|
|
|
|
/* We compare with <= here, because reg_set_last_last_regno
|
|
|
|
|
is actually the number of the first reg *not* in X. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
for (;
|
|
|
|
|
insn && GET_CODE (insn) != CODE_LABEL
|
|
|
|
|
&& ! (GET_CODE (insn) == CALL_INSN
|
|
|
|
|
&& reg_set_last_last_regno <= FIRST_PSEUDO_REGISTER);
|
|
|
|
|
insn = PREV_INSN (insn))
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
|
|
|
|
|
{
|
1999-10-27 21:27:41 +02:00
|
|
|
|
note_stores (PATTERN (insn), reg_set_last_1, NULL);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
if (reg_set_last_unknown)
|
|
|
|
|
return 0;
|
|
|
|
|
else if (reg_set_last_value)
|
|
|
|
|
{
|
|
|
|
|
if (CONSTANT_P (reg_set_last_value)
|
1992-09-19 21:42:53 +02:00
|
|
|
|
|| ((GET_CODE (reg_set_last_value) == REG
|
|
|
|
|
|| GET_CODE (reg_set_last_value) == SUBREG)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
&& ! reg_set_between_p (reg_set_last_value,
|
1995-10-06 18:14:37 +01:00
|
|
|
|
insn, orig_insn)))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return reg_set_last_value;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Call FUN on each register or MEM that is stored into or clobbered by X.
|
|
|
|
|
(X would be the pattern of an insn).
|
|
|
|
|
FUN receives two arguments:
|
|
|
|
|
the REG, MEM, CC0 or PC being stored in or clobbered,
|
|
|
|
|
the SET or CLOBBER rtx that does the store.
|
|
|
|
|
|
|
|
|
|
If the item being stored in or clobbered is a SUBREG of a hard register,
|
|
|
|
|
the SUBREG will be passed. */
|
|
|
|
|
|
|
|
|
|
void
|
1999-10-27 21:27:41 +02:00
|
|
|
|
note_stores (x, fun, data)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
register rtx x;
|
2000-01-17 16:47:29 +01:00
|
|
|
|
void (*fun) PARAMS ((rtx, rtx, void *));
|
1999-10-27 21:27:41 +02:00
|
|
|
|
void *data;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
if ((GET_CODE (x) == SET || GET_CODE (x) == CLOBBER))
|
|
|
|
|
{
|
|
|
|
|
register rtx dest = SET_DEST (x);
|
|
|
|
|
while ((GET_CODE (dest) == SUBREG
|
|
|
|
|
&& (GET_CODE (SUBREG_REG (dest)) != REG
|
|
|
|
|
|| REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER))
|
|
|
|
|
|| GET_CODE (dest) == ZERO_EXTRACT
|
|
|
|
|
|| GET_CODE (dest) == SIGN_EXTRACT
|
|
|
|
|
|| GET_CODE (dest) == STRICT_LOW_PART)
|
|
|
|
|
dest = XEXP (dest, 0);
|
1998-09-12 03:03:36 +02:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (dest) == PARALLEL
|
|
|
|
|
&& GET_MODE (dest) == BLKmode)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
|
1999-10-27 21:27:41 +02:00
|
|
|
|
(*fun) (SET_DEST (XVECEXP (dest, 0, i)), x, data);
|
1998-09-12 03:03:36 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
1999-10-27 21:27:41 +02:00
|
|
|
|
(*fun) (dest, x, data);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (x) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
register rtx y = XVECEXP (x, 0, i);
|
|
|
|
|
if (GET_CODE (y) == SET || GET_CODE (y) == CLOBBER)
|
|
|
|
|
{
|
|
|
|
|
register rtx dest = SET_DEST (y);
|
|
|
|
|
while ((GET_CODE (dest) == SUBREG
|
|
|
|
|
&& (GET_CODE (SUBREG_REG (dest)) != REG
|
|
|
|
|
|| (REGNO (SUBREG_REG (dest))
|
|
|
|
|
>= FIRST_PSEUDO_REGISTER)))
|
|
|
|
|
|| GET_CODE (dest) == ZERO_EXTRACT
|
|
|
|
|
|| GET_CODE (dest) == SIGN_EXTRACT
|
|
|
|
|
|| GET_CODE (dest) == STRICT_LOW_PART)
|
|
|
|
|
dest = XEXP (dest, 0);
|
1998-09-12 03:03:36 +02:00
|
|
|
|
if (GET_CODE (dest) == PARALLEL
|
|
|
|
|
&& GET_MODE (dest) == BLKmode)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
|
1999-10-27 21:27:41 +02:00
|
|
|
|
(*fun) (SET_DEST (XVECEXP (dest, 0, i)), y, data);
|
1998-09-12 03:03:36 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
1999-10-27 21:27:41 +02:00
|
|
|
|
(*fun) (dest, y, data);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if X's old contents don't survive after INSN.
|
|
|
|
|
This will be true if X is (cc0) or if X is a register and
|
|
|
|
|
X dies in INSN or because INSN entirely sets X.
|
|
|
|
|
|
|
|
|
|
"Entirely set" means set directly and not through a SUBREG,
|
|
|
|
|
ZERO_EXTRACT or SIGN_EXTRACT, so no trace of the old contents remains.
|
|
|
|
|
Likewise, REG_INC does not count.
|
|
|
|
|
|
|
|
|
|
REG may be a hard or pseudo reg. Renumbering is not taken into account,
|
|
|
|
|
but for this use that makes no difference, since regs don't overlap
|
|
|
|
|
during their lifetimes. Therefore, this function may be used
|
|
|
|
|
at any time after deaths have been computed (in flow.c).
|
|
|
|
|
|
|
|
|
|
If REG is a hard reg that occupies multiple machine registers, this
|
|
|
|
|
function will only return 1 if each of those registers will be replaced
|
|
|
|
|
by INSN. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
dead_or_set_p (insn, x)
|
|
|
|
|
rtx insn;
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register int regno, last_regno;
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
/* Can't use cc0_rtx below since this file is used by genattrtab.c. */
|
|
|
|
|
if (GET_CODE (x) == CC0)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (x) != REG)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
regno = REGNO (x);
|
|
|
|
|
last_regno = (regno >= FIRST_PSEUDO_REGISTER ? regno
|
|
|
|
|
: regno + HARD_REGNO_NREGS (regno, GET_MODE (x)) - 1);
|
|
|
|
|
|
|
|
|
|
for (i = regno; i <= last_regno; i++)
|
|
|
|
|
if (! dead_or_set_regno_p (insn, i))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Utility function for dead_or_set_p to check an individual register. Also
|
|
|
|
|
called from flow.c. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
dead_or_set_regno_p (insn, test_regno)
|
|
|
|
|
rtx insn;
|
|
|
|
|
int test_regno;
|
|
|
|
|
{
|
|
|
|
|
int regno, endregno;
|
|
|
|
|
rtx link;
|
|
|
|
|
|
1998-10-16 02:08:51 +02:00
|
|
|
|
/* See if there is a death note for something that includes
|
|
|
|
|
TEST_REGNO. */
|
|
|
|
|
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
1998-10-16 02:08:51 +02:00
|
|
|
|
if (REG_NOTE_KIND (link) != REG_DEAD
|
|
|
|
|
|| GET_CODE (XEXP (link, 0)) != REG)
|
|
|
|
|
continue;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
1998-10-16 02:08:51 +02:00
|
|
|
|
regno = REGNO (XEXP (link, 0));
|
|
|
|
|
endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
|
|
|
|
|
: regno + HARD_REGNO_NREGS (regno,
|
|
|
|
|
GET_MODE (XEXP (link, 0))));
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
1998-10-16 02:08:51 +02:00
|
|
|
|
if (test_regno >= regno && test_regno < endregno)
|
|
|
|
|
return 1;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
1994-05-06 23:43:38 +02:00
|
|
|
|
if (GET_CODE (insn) == CALL_INSN
|
|
|
|
|
&& find_regno_fusage (insn, CLOBBER, test_regno))
|
|
|
|
|
return 1;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
if (GET_CODE (PATTERN (insn)) == SET)
|
|
|
|
|
{
|
|
|
|
|
rtx dest = SET_DEST (PATTERN (insn));
|
|
|
|
|
|
|
|
|
|
/* A value is totally replaced if it is the destination or the
|
|
|
|
|
destination is a SUBREG of REGNO that does not change the number of
|
|
|
|
|
words in it. */
|
1998-10-16 02:08:51 +02:00
|
|
|
|
if (GET_CODE (dest) == SUBREG
|
1991-12-01 06:13:56 +01:00
|
|
|
|
&& (((GET_MODE_SIZE (GET_MODE (dest))
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
|
|
|
|
== ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
|
|
|
|
|
dest = SUBREG_REG (dest);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (dest) != REG)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
regno = REGNO (dest);
|
|
|
|
|
endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
|
|
|
|
|
: regno + HARD_REGNO_NREGS (regno, GET_MODE (dest)));
|
|
|
|
|
|
|
|
|
|
return (test_regno >= regno && test_regno < endregno);
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (PATTERN (insn)) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
rtx body = XVECEXP (PATTERN (insn), 0, i);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (body) == SET || GET_CODE (body) == CLOBBER)
|
|
|
|
|
{
|
|
|
|
|
rtx dest = SET_DEST (body);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (dest) == SUBREG
|
|
|
|
|
&& (((GET_MODE_SIZE (GET_MODE (dest))
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
|
|
|
|
== ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
|
|
|
|
|
dest = SUBREG_REG (dest);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (dest) != REG)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
regno = REGNO (dest);
|
|
|
|
|
endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
|
|
|
|
|
: regno + HARD_REGNO_NREGS (regno, GET_MODE (dest)));
|
|
|
|
|
|
|
|
|
|
if (test_regno >= regno && test_regno < endregno)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the reg-note of kind KIND in insn INSN, if there is one.
|
|
|
|
|
If DATUM is nonzero, look for one whose datum is DATUM. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
find_reg_note (insn, kind, datum)
|
|
|
|
|
rtx insn;
|
|
|
|
|
enum reg_note kind;
|
|
|
|
|
rtx datum;
|
|
|
|
|
{
|
|
|
|
|
register rtx link;
|
|
|
|
|
|
1998-05-14 00:10:04 +02:00
|
|
|
|
/* Ignore anything that is not an INSN, JUMP_INSN or CALL_INSN. */
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
|
|
|
|
|
return 0;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
|
|
|
|
|
if (REG_NOTE_KIND (link) == kind
|
|
|
|
|
&& (datum == 0 || datum == XEXP (link, 0)))
|
|
|
|
|
return link;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the reg-note of kind KIND in insn INSN which applies to register
|
1993-03-30 22:36:43 +02:00
|
|
|
|
number REGNO, if any. Return 0 if there is no such reg-note. Note that
|
|
|
|
|
the REGNO of this NOTE need not be REGNO if REGNO is a hard register;
|
|
|
|
|
it might be the case that the note overlaps REGNO. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
find_regno_note (insn, kind, regno)
|
|
|
|
|
rtx insn;
|
|
|
|
|
enum reg_note kind;
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
register rtx link;
|
|
|
|
|
|
1998-05-14 00:10:04 +02:00
|
|
|
|
/* Ignore anything that is not an INSN, JUMP_INSN or CALL_INSN. */
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
|
|
|
|
|
return 0;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
|
|
|
|
|
if (REG_NOTE_KIND (link) == kind
|
|
|
|
|
/* Verify that it is a register, so that scratch and MEM won't cause a
|
|
|
|
|
problem here. */
|
|
|
|
|
&& GET_CODE (XEXP (link, 0)) == REG
|
1993-03-30 22:36:43 +02:00
|
|
|
|
&& REGNO (XEXP (link, 0)) <= regno
|
|
|
|
|
&& ((REGNO (XEXP (link, 0))
|
|
|
|
|
+ (REGNO (XEXP (link, 0)) >= FIRST_PSEUDO_REGISTER ? 1
|
|
|
|
|
: HARD_REGNO_NREGS (REGNO (XEXP (link, 0)),
|
|
|
|
|
GET_MODE (XEXP (link, 0)))))
|
|
|
|
|
> regno))
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return link;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1994-05-06 23:43:38 +02:00
|
|
|
|
|
|
|
|
|
/* Return true if DATUM, or any overlap of DATUM, of kind CODE is found
|
|
|
|
|
in the CALL_INSN_FUNCTION_USAGE information of INSN. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
find_reg_fusage (insn, code, datum)
|
|
|
|
|
rtx insn;
|
|
|
|
|
enum rtx_code code;
|
|
|
|
|
rtx datum;
|
|
|
|
|
{
|
|
|
|
|
/* If it's not a CALL_INSN, it can't possibly have a
|
|
|
|
|
CALL_INSN_FUNCTION_USAGE field, so don't bother checking. */
|
|
|
|
|
if (GET_CODE (insn) != CALL_INSN)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (! datum)
|
|
|
|
|
abort();
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (datum) != REG)
|
|
|
|
|
{
|
|
|
|
|
register rtx link;
|
|
|
|
|
|
|
|
|
|
for (link = CALL_INSN_FUNCTION_USAGE (insn);
|
|
|
|
|
link;
|
|
|
|
|
link = XEXP (link, 1))
|
|
|
|
|
if (GET_CODE (XEXP (link, 0)) == code
|
|
|
|
|
&& rtx_equal_p (datum, SET_DEST (XEXP (link, 0))))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
register int regno = REGNO (datum);
|
|
|
|
|
|
|
|
|
|
/* CALL_INSN_FUNCTION_USAGE information cannot contain references
|
|
|
|
|
to pseudo registers, so don't bother checking. */
|
|
|
|
|
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
int end_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (datum));
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = regno; i < end_regno; i++)
|
|
|
|
|
if (find_regno_fusage (insn, code, i))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return true if REGNO, or any overlap of REGNO, of kind CODE is found
|
|
|
|
|
in the CALL_INSN_FUNCTION_USAGE information of INSN. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
find_regno_fusage (insn, code, regno)
|
|
|
|
|
rtx insn;
|
|
|
|
|
enum rtx_code code;
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
register rtx link;
|
|
|
|
|
|
|
|
|
|
/* CALL_INSN_FUNCTION_USAGE information cannot contain references
|
|
|
|
|
to pseudo registers, so don't bother checking. */
|
|
|
|
|
|
|
|
|
|
if (regno >= FIRST_PSEUDO_REGISTER
|
|
|
|
|
|| GET_CODE (insn) != CALL_INSN )
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
|
flow.c (propagate_block): Use XEXP not SET_DEST for a USE.
* flow.c (propagate_block): Use XEXP not SET_DEST for a USE.
(recompute_reg_usage): Likewise.
* rtlanal.c (find_regno_fusage): Likewise.
* rtl.c (rtl_check_failed_code1): New function.
(rtl_check_failed_code2): New.
* rtl.h (RTL_CHECK1, RTL_CHECK2, RTVEC_ELT): Parenthesize args.
(RTL_CHECKC1, RTL_CHECKC2): New.
(XC*): New accessor macros.
(NOTE_*, LABEL_NAME, LABEL_NUSES, ADDRESSOF_REGNO): Use them.
(ADDRESSOF_DECL, JUMP_LABEL, LABEL_REFS, LABEL_NEXTREF): Likewise.
(CONTAINING_INSN, REGNO, INTVAL, SUBREG_REG, SUBREG_WORD): Likewise.
(ASM_OPERANDS_*, MEM_ALIAS_SET, SET_SRC, SET_DEST): Likewise.
(TRAP_*, RANGE_INFO_*): Likewise.
From-SVN: r29089
1999-09-04 00:23:11 +02:00
|
|
|
|
{
|
|
|
|
|
register int regnote;
|
|
|
|
|
register rtx op, reg;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op = XEXP (link, 0)) == code
|
|
|
|
|
&& GET_CODE (reg = XEXP (op, 0)) == REG
|
|
|
|
|
&& (regnote = REGNO (reg)) <= regno
|
|
|
|
|
&& regnote + HARD_REGNO_NREGS (regnote, GET_MODE (reg)) > regno)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
1994-05-06 23:43:38 +02:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
/* Remove register note NOTE from the REG_NOTES of INSN. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
remove_note (insn, note)
|
|
|
|
|
register rtx insn;
|
1999-10-20 16:04:12 +02:00
|
|
|
|
register rtx note;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
register rtx link;
|
|
|
|
|
|
1999-10-20 16:04:12 +02:00
|
|
|
|
if (note == NULL_RTX)
|
|
|
|
|
return;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
if (REG_NOTES (insn) == note)
|
|
|
|
|
{
|
|
|
|
|
REG_NOTES (insn) = XEXP (note, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
|
|
|
|
|
if (XEXP (link, 1) == note)
|
|
|
|
|
{
|
|
|
|
|
XEXP (link, 1) = XEXP (note, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
1999-04-12 04:18:55 +02:00
|
|
|
|
|
|
|
|
|
/* Search LISTP (an EXPR_LIST) for NODE and remove NODE from the list
|
|
|
|
|
if it is found.
|
|
|
|
|
|
|
|
|
|
A simple equality test is used to determine if NODE is on the
|
|
|
|
|
EXPR_LIST. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
remove_node_from_expr_list (node, listp)
|
|
|
|
|
rtx node;
|
|
|
|
|
rtx *listp;
|
|
|
|
|
{
|
|
|
|
|
rtx temp = *listp;
|
|
|
|
|
rtx prev = NULL_RTX;
|
|
|
|
|
|
|
|
|
|
while (temp)
|
|
|
|
|
{
|
|
|
|
|
if (node == XEXP (temp, 0))
|
|
|
|
|
{
|
|
|
|
|
/* Splice the node out of the list. */
|
|
|
|
|
if (prev)
|
|
|
|
|
XEXP (prev, 1) = XEXP (temp, 1);
|
|
|
|
|
else
|
|
|
|
|
*listp = XEXP (temp, 1);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
temp = XEXP (temp, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
1993-10-19 05:42:55 +01:00
|
|
|
|
/* Nonzero if X contains any volatile instructions. These are instructions
|
|
|
|
|
which may cause unpredictable machine state instructions, and thus no
|
|
|
|
|
instructions should be moved or combined across them. This includes
|
|
|
|
|
only volatile asms and UNSPEC_VOLATILE instructions. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
volatile_insn_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CC0:
|
|
|
|
|
case PC:
|
|
|
|
|
case REG:
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case CLOBBER:
|
|
|
|
|
case ASM_INPUT:
|
|
|
|
|
case ADDR_VEC:
|
|
|
|
|
case ADDR_DIFF_VEC:
|
|
|
|
|
case CALL:
|
|
|
|
|
case MEM:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case UNSPEC_VOLATILE:
|
|
|
|
|
/* case TRAP_IF: This isn't clear yet. */
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case ASM_OPERANDS:
|
|
|
|
|
if (MEM_VOLATILE_P (x))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1993-10-19 05:42:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recursively scan the operands of this expression. */
|
|
|
|
|
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt = GET_RTX_FORMAT (code);
|
1993-10-19 05:42:55 +01:00
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
1994-05-29 21:58:14 +02:00
|
|
|
|
if (volatile_insn_p (XEXP (x, i)))
|
1993-10-19 05:42:55 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1993-10-19 05:42:55 +01:00
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
1994-05-29 21:58:14 +02:00
|
|
|
|
if (volatile_insn_p (XVECEXP (x, i, j)))
|
1993-10-19 05:42:55 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* Nonzero if X contains any volatile memory references
|
1992-01-28 20:31:58 +01:00
|
|
|
|
UNSPEC_VOLATILE operations or volatile ASM_OPERANDS expressions. */
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
volatile_refs_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CC0:
|
|
|
|
|
case PC:
|
|
|
|
|
case REG:
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case CLOBBER:
|
|
|
|
|
case ASM_INPUT:
|
|
|
|
|
case ADDR_VEC:
|
|
|
|
|
case ADDR_DIFF_VEC:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case CALL:
|
1992-01-28 20:31:58 +01:00
|
|
|
|
case UNSPEC_VOLATILE:
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* case TRAP_IF: This isn't clear yet. */
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case MEM:
|
|
|
|
|
case ASM_OPERANDS:
|
|
|
|
|
if (MEM_VOLATILE_P (x))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recursively scan the operands of this expression. */
|
|
|
|
|
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt = GET_RTX_FORMAT (code);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
if (volatile_refs_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
if (volatile_refs_p (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Similar to above, except that it also rejects register pre- and post-
|
|
|
|
|
incrementing. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
side_effects_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CC0:
|
|
|
|
|
case PC:
|
|
|
|
|
case REG:
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case ASM_INPUT:
|
|
|
|
|
case ADDR_VEC:
|
|
|
|
|
case ADDR_DIFF_VEC:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case CLOBBER:
|
|
|
|
|
/* Reject CLOBBER with a non-VOID mode. These are made by combine.c
|
|
|
|
|
when some combination can't be done. If we see one, don't think
|
|
|
|
|
that we can simplify the expression. */
|
|
|
|
|
return (GET_MODE (x) != VOIDmode);
|
|
|
|
|
|
|
|
|
|
case PRE_INC:
|
|
|
|
|
case PRE_DEC:
|
|
|
|
|
case POST_INC:
|
|
|
|
|
case POST_DEC:
|
|
|
|
|
case CALL:
|
1992-01-28 20:31:58 +01:00
|
|
|
|
case UNSPEC_VOLATILE:
|
1991-12-01 06:13:56 +01:00
|
|
|
|
/* case TRAP_IF: This isn't clear yet. */
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case MEM:
|
|
|
|
|
case ASM_OPERANDS:
|
|
|
|
|
if (MEM_VOLATILE_P (x))
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recursively scan the operands of this expression. */
|
|
|
|
|
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt = GET_RTX_FORMAT (code);
|
1991-12-01 06:13:56 +01:00
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
if (side_effects_p (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if evaluating rtx X might cause a trap. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
may_trap_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
enum rtx_code code;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
/* Handle these cases quickly. */
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case CONST:
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case REG:
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Conditional trap can trap! */
|
1992-01-28 20:31:58 +01:00
|
|
|
|
case UNSPEC_VOLATILE:
|
1991-12-01 06:13:56 +01:00
|
|
|
|
case TRAP_IF:
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* Memory ref can trap unless it's a static var or a stack slot. */
|
|
|
|
|
case MEM:
|
|
|
|
|
return rtx_addr_can_trap_p (XEXP (x, 0));
|
|
|
|
|
|
|
|
|
|
/* Division by a non-constant might trap. */
|
|
|
|
|
case DIV:
|
|
|
|
|
case MOD:
|
|
|
|
|
case UDIV:
|
|
|
|
|
case UMOD:
|
1997-11-02 22:19:36 +01:00
|
|
|
|
if (! CONSTANT_P (XEXP (x, 1))
|
|
|
|
|
|| GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return 1;
|
|
|
|
|
/* This was const0_rtx, but by not using that,
|
|
|
|
|
we can link this file into other programs. */
|
|
|
|
|
if (GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 0)
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
break;
|
|
|
|
|
|
1994-08-26 00:48:42 +02:00
|
|
|
|
case EXPR_LIST:
|
|
|
|
|
/* An EXPR_LIST is used to represent a function call. This
|
|
|
|
|
certainly may trap. */
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
default:
|
|
|
|
|
/* Any floating arithmetic may trap. */
|
|
|
|
|
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
if (may_trap_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
if (may_trap_p (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if X contains a comparison that is not either EQ or NE,
|
|
|
|
|
i.e., an inequality. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
inequality_comparisons_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
register int len, i;
|
|
|
|
|
register enum rtx_code code = GET_CODE (x);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case REG:
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CONST:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case LT:
|
|
|
|
|
case LTU:
|
|
|
|
|
case GT:
|
|
|
|
|
case GTU:
|
|
|
|
|
case LE:
|
|
|
|
|
case LEU:
|
|
|
|
|
case GE:
|
|
|
|
|
case GEU:
|
|
|
|
|
return 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
len = GET_RTX_LENGTH (code);
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
if (inequality_comparisons_p (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
if (inequality_comparisons_p (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1998-07-28 14:54:04 +02:00
|
|
|
|
/* Replace any occurrence of FROM in X with TO. The function does
|
|
|
|
|
not enter into CONST_DOUBLE for the replace.
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
Note that copying is not done so X must not be shared unless all copies
|
|
|
|
|
are to be modified. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
replace_rtx (x, from, to)
|
|
|
|
|
rtx x, from, to;
|
|
|
|
|
{
|
|
|
|
|
register int i, j;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
1998-07-28 14:54:04 +02:00
|
|
|
|
/* The following prevents loops occurrence when we change MEM in
|
|
|
|
|
CONST_DOUBLE onto the same CONST_DOUBLE. */
|
|
|
|
|
if (x != 0 && GET_CODE (x) == CONST_DOUBLE)
|
|
|
|
|
return x;
|
|
|
|
|
|
1991-12-01 06:13:56 +01:00
|
|
|
|
if (x == from)
|
|
|
|
|
return to;
|
|
|
|
|
|
|
|
|
|
/* Allow this function to make replacements in EXPR_LISTs. */
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (GET_CODE (x));
|
|
|
|
|
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
XEXP (x, i) = replace_rtx (XEXP (x, i), from, to);
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
XVECEXP (x, i, j) = replace_rtx (XVECEXP (x, i, j), from, to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Throughout the rtx X, replace many registers according to REG_MAP.
|
|
|
|
|
Return the replacement for X (which may be X with altered contents).
|
|
|
|
|
REG_MAP[R] is the replacement for register R, or 0 for don't replace.
|
|
|
|
|
NREGS is the length of REG_MAP; regs >= NREGS are not mapped.
|
|
|
|
|
|
|
|
|
|
We only support REG_MAP entries of REG or SUBREG. Also, hard registers
|
|
|
|
|
should not be mapped to pseudos or vice versa since validate_change
|
|
|
|
|
is not called.
|
|
|
|
|
|
|
|
|
|
If REPLACE_DEST is 1, replacements are also done in destinations;
|
|
|
|
|
otherwise, only sources are replaced. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
replace_regs (x, reg_map, nregs, replace_dest)
|
|
|
|
|
rtx x;
|
|
|
|
|
rtx *reg_map;
|
|
|
|
|
int nregs;
|
|
|
|
|
int replace_dest;
|
|
|
|
|
{
|
|
|
|
|
register enum rtx_code code;
|
|
|
|
|
register int i;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case SCRATCH:
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case CONST:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
/* Verify that the register has an entry before trying to access it. */
|
|
|
|
|
if (REGNO (x) < nregs && reg_map[REGNO (x)] != 0)
|
1993-12-21 19:25:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* SUBREGs can't be shared. Always return a copy to ensure that if
|
|
|
|
|
this replacement occurs more than once then each instance will
|
|
|
|
|
get distinct rtx. */
|
|
|
|
|
if (GET_CODE (reg_map[REGNO (x)]) == SUBREG)
|
|
|
|
|
return copy_rtx (reg_map[REGNO (x)]);
|
|
|
|
|
return reg_map[REGNO (x)];
|
|
|
|
|
}
|
1991-12-01 06:13:56 +01:00
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
case SUBREG:
|
|
|
|
|
/* Prevent making nested SUBREGs. */
|
|
|
|
|
if (GET_CODE (SUBREG_REG (x)) == REG && REGNO (SUBREG_REG (x)) < nregs
|
|
|
|
|
&& reg_map[REGNO (SUBREG_REG (x))] != 0
|
|
|
|
|
&& GET_CODE (reg_map[REGNO (SUBREG_REG (x))]) == SUBREG)
|
|
|
|
|
{
|
|
|
|
|
rtx map_val = reg_map[REGNO (SUBREG_REG (x))];
|
|
|
|
|
rtx map_inner = SUBREG_REG (map_val);
|
|
|
|
|
|
|
|
|
|
if (GET_MODE (x) == GET_MODE (map_inner))
|
|
|
|
|
return map_inner;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We cannot call gen_rtx here since we may be linked with
|
|
|
|
|
genattrtab.c. */
|
|
|
|
|
/* Let's try clobbering the incoming SUBREG and see
|
|
|
|
|
if this is really safe. */
|
|
|
|
|
SUBREG_REG (x) = map_inner;
|
|
|
|
|
SUBREG_WORD (x) += SUBREG_WORD (map_val);
|
|
|
|
|
return x;
|
|
|
|
|
#if 0
|
|
|
|
|
rtx new = rtx_alloc (SUBREG);
|
|
|
|
|
PUT_MODE (new, GET_MODE (x));
|
|
|
|
|
SUBREG_REG (new) = map_inner;
|
|
|
|
|
SUBREG_WORD (new) = SUBREG_WORD (x) + SUBREG_WORD (map_val);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SET:
|
|
|
|
|
if (replace_dest)
|
|
|
|
|
SET_DEST (x) = replace_regs (SET_DEST (x), reg_map, nregs, 0);
|
|
|
|
|
|
|
|
|
|
else if (GET_CODE (SET_DEST (x)) == MEM
|
|
|
|
|
|| GET_CODE (SET_DEST (x)) == STRICT_LOW_PART)
|
|
|
|
|
/* Even if we are not to replace destinations, replace register if it
|
|
|
|
|
is CONTAINED in destination (destination is memory or
|
|
|
|
|
STRICT_LOW_PART). */
|
|
|
|
|
XEXP (SET_DEST (x), 0) = replace_regs (XEXP (SET_DEST (x), 0),
|
|
|
|
|
reg_map, nregs, 0);
|
|
|
|
|
else if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT)
|
|
|
|
|
/* Similarly, for ZERO_EXTRACT we replace all operands. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
SET_SRC (x) = replace_regs (SET_SRC (x), reg_map, nregs, 0);
|
|
|
|
|
return x;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-12-01 06:13:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
XEXP (x, i) = replace_regs (XEXP (x, i), reg_map, nregs, replace_dest);
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1991-12-01 06:13:56 +01:00
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
XVECEXP (x, i, j) = replace_regs (XVECEXP (x, i, j), reg_map,
|
|
|
|
|
nregs, replace_dest);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return x;
|
|
|
|
|
}
|
1997-09-22 02:49:32 +02:00
|
|
|
|
|
|
|
|
|
/* Return 1 if X, the SRC_SRC of SET of (pc) contain a REG or MEM that is
|
|
|
|
|
not in the constant pool and not in the condition of an IF_THEN_ELSE. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
jmp_uses_reg_or_mem (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
|
|
|
|
int i, j;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt;
|
1997-09-22 02:49:32 +02:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case CONST:
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case PC:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case MEM:
|
|
|
|
|
return ! (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
|
|
|
|
|
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
|
|
|
|
|
|
|
|
|
|
case IF_THEN_ELSE:
|
|
|
|
|
return (jmp_uses_reg_or_mem (XEXP (x, 1))
|
|
|
|
|
|| jmp_uses_reg_or_mem (XEXP (x, 2)));
|
|
|
|
|
|
|
|
|
|
case PLUS: case MINUS: case MULT:
|
|
|
|
|
return (jmp_uses_reg_or_mem (XEXP (x, 0))
|
|
|
|
|
|| jmp_uses_reg_or_mem (XEXP (x, 1)));
|
1997-12-20 12:31:54 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1997-09-22 02:49:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e'
|
|
|
|
|
&& jmp_uses_reg_or_mem (XEXP (x, i)))
|
|
|
|
|
return 1;
|
|
|
|
|
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1997-09-22 02:49:32 +02:00
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
|
|
|
|
if (jmp_uses_reg_or_mem (XVECEXP (x, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if INSN is an indirect jump (aka computed jump).
|
|
|
|
|
|
|
|
|
|
Tablejumps and casesi insns are not considered indirect jumps;
|
|
|
|
|
we can recognize them by a (use (lael_ref)). */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
computed_jump_p (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
if (GET_CODE (insn) == JUMP_INSN)
|
|
|
|
|
{
|
|
|
|
|
rtx pat = PATTERN (insn);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (pat) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
int len = XVECLEN (pat, 0);
|
|
|
|
|
int has_use_labelref = 0;
|
|
|
|
|
|
|
|
|
|
for (i = len - 1; i >= 0; i--)
|
|
|
|
|
if (GET_CODE (XVECEXP (pat, 0, i)) == USE
|
|
|
|
|
&& (GET_CODE (XEXP (XVECEXP (pat, 0, i), 0))
|
|
|
|
|
== LABEL_REF))
|
|
|
|
|
has_use_labelref = 1;
|
|
|
|
|
|
|
|
|
|
if (! has_use_labelref)
|
|
|
|
|
for (i = len - 1; i >= 0; i--)
|
|
|
|
|
if (GET_CODE (XVECEXP (pat, 0, i)) == SET
|
|
|
|
|
&& SET_DEST (XVECEXP (pat, 0, i)) == pc_rtx
|
1997-09-23 08:58:12 +02:00
|
|
|
|
&& jmp_uses_reg_or_mem (SET_SRC (XVECEXP (pat, 0, i))))
|
1997-09-22 02:49:32 +02:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (pat) == SET
|
|
|
|
|
&& SET_DEST (pat) == pc_rtx
|
|
|
|
|
&& jmp_uses_reg_or_mem (SET_SRC (pat)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1998-08-19 15:44:57 +02:00
|
|
|
|
|
|
|
|
|
/* Traverse X via depth-first search, calling F for each
|
|
|
|
|
sub-expression (including X itself). F is also passed the DATA.
|
|
|
|
|
If F returns -1, do not traverse sub-expressions, but continue
|
|
|
|
|
traversing the rest of the tree. If F ever returns any other
|
|
|
|
|
non-zero value, stop the traversal, and return the value returned
|
|
|
|
|
by F. Otherwise, return 0. This function does not traverse inside
|
|
|
|
|
tree structure that contains RTX_EXPRs, or into sub-expressions
|
|
|
|
|
whose format code is `0' since it is not known whether or not those
|
|
|
|
|
codes are actually RTL.
|
|
|
|
|
|
|
|
|
|
This routine is very general, and could (should?) be used to
|
|
|
|
|
implement many of the other routines in this file. */
|
|
|
|
|
|
1998-10-14 01:41:11 +02:00
|
|
|
|
int
|
|
|
|
|
for_each_rtx (x, f, data)
|
1999-02-10 10:56:36 +01:00
|
|
|
|
rtx *x;
|
1998-08-19 15:44:57 +02:00
|
|
|
|
rtx_function f;
|
1999-02-10 10:56:36 +01:00
|
|
|
|
void *data;
|
1998-08-19 15:44:57 +02:00
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
int length;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char* format;
|
1998-08-19 15:44:57 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Call F on X. */
|
|
|
|
|
result = (*f)(x, data);
|
|
|
|
|
if (result == -1)
|
|
|
|
|
/* Do not traverse sub-expressions. */
|
|
|
|
|
return 0;
|
|
|
|
|
else if (result != 0)
|
|
|
|
|
/* Stop the traversal. */
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
if (*x == NULL_RTX)
|
|
|
|
|
/* There are no sub-expressions. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
length = GET_RTX_LENGTH (GET_CODE (*x));
|
|
|
|
|
format = GET_RTX_FORMAT (GET_CODE (*x));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < length; ++i)
|
|
|
|
|
{
|
|
|
|
|
switch (format[i])
|
|
|
|
|
{
|
|
|
|
|
case 'e':
|
|
|
|
|
result = for_each_rtx (&XEXP (*x, i), f, data);
|
|
|
|
|
if (result != 0)
|
|
|
|
|
return result;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'V':
|
|
|
|
|
case 'E':
|
|
|
|
|
if (XVEC (*x, i) != 0)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (*x, i); ++j)
|
|
|
|
|
{
|
|
|
|
|
result = for_each_rtx (&XVECEXP (*x, i, j), f, data);
|
|
|
|
|
if (result != 0)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* Nothing to do. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
rtl.h (insn_first_p): Declare.
* rtl.h (insn_first_p): Declare.
* rtlanal.c (insn_first_p): New function.
* loop.h (varray.h): Include.
(struct induction): Change combined_with to unsigned.
New members derived, ix and last_use.
(reg_iv_type, reg_iv_info): Now varray_type. All references changed.
(REG_IV_TYPE, REG_IV_INFO): Define.
(first_increment_giv, last_increment_giv): Declare.
* loop.c (loop_number_loop_cont): New static variable.
(loop_number_cont_dominator): Likewise.
(reg_iv_type, reg_iv_info): Now varray_type.
(first_increment_giv, last_increment_giv): New variables.
(compute_luids, verify_dominator, find_life_end): New functions.
(cmp_recombine_givs_stats, recombine_givs): Likewise.
(loop_optimize): Allocate loop_number_loop_cont and
loop_number_cont_dominator. Use compute_luids.
(find_and_verify_loops): Initialize loop_number_loop_cont and
loop_number_cont_dominator.
(strength_reduce): Try to find bivs that can be expressed as givs
of another biv, and to convert biv increments into givs.
Call recombine_givs. Handle derived givs.
(record_biv): New argument location. All callers changed.
(record_giv): Initialize derived and last_use fields.
(basic_induction_var): New argument location. All callers changed.
(combine_givs): Don't combine a DEST_REG giv with a DEST_ADDR giv.
Increment combined_with instead of setting to 1.
* unroll.c (derived_regs): New static variable.
(unroll_loop): Initialize it.
Allocate local_regno according to max_reg_num.
(copy_loop_body): Cope with derived givs.
(find_splittable_givs): Check for Givs made from biv increments.
Set derived_regs for givs.
* Makefile.in (stmt.o, loop.o, unroll.o): Depend on loop.h .
From-SVN: r24889
1999-01-27 16:45:50 +01:00
|
|
|
|
|
1999-02-02 22:49:34 +01:00
|
|
|
|
/* Searches X for any reference to REGNO, returning the rtx of the
|
|
|
|
|
reference found if any. Otherwise, returns NULL_RTX. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
regno_use_in (regno, x)
|
|
|
|
|
int regno;
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1999-02-02 22:49:34 +01:00
|
|
|
|
int i, j;
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (x) == REG && REGNO (x) == regno)
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (GET_CODE (x));
|
|
|
|
|
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
if ((tem = regno_use_in (regno, XEXP (x, i))))
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
if ((tem = regno_use_in (regno , XVECEXP (x, i, j))))
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
}
|
1999-03-15 02:52:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return 1 if X is an autoincrement side effect and the register is
|
|
|
|
|
not the stack pointer. */
|
|
|
|
|
int
|
|
|
|
|
auto_inc_p (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
switch (GET_CODE (x))
|
|
|
|
|
{
|
|
|
|
|
case PRE_INC:
|
|
|
|
|
case POST_INC:
|
|
|
|
|
case PRE_DEC:
|
|
|
|
|
case POST_DEC:
|
|
|
|
|
case PRE_MODIFY:
|
|
|
|
|
case POST_MODIFY:
|
|
|
|
|
/* There are no REG_INC notes for SP. */
|
|
|
|
|
if (XEXP (x, 0) != stack_pointer_rtx)
|
|
|
|
|
return 1;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-09-19 18:04:01 +02:00
|
|
|
|
|
|
|
|
|
/* Return 1 if the sequence of instructions beginning with FROM and up
|
|
|
|
|
to and including TO is safe to move. If NEW_TO is non-NULL, and
|
|
|
|
|
the sequence is not already safe to move, but can be easily
|
|
|
|
|
extended to a sequence which is safe, then NEW_TO will point to the
|
1999-09-19 19:00:01 +02:00
|
|
|
|
end of the extended sequence.
|
|
|
|
|
|
|
|
|
|
For now, this function only checks that the region contains whole
|
|
|
|
|
exception regiongs, but it could be extended to check additional
|
|
|
|
|
conditions as well. */
|
1999-09-19 18:04:01 +02:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
insns_safe_to_move_p (from, to, new_to)
|
|
|
|
|
rtx from;
|
|
|
|
|
rtx to;
|
|
|
|
|
rtx *new_to;
|
|
|
|
|
{
|
|
|
|
|
int eh_region_count = 0;
|
|
|
|
|
int past_to_p = 0;
|
|
|
|
|
rtx r = from;
|
|
|
|
|
|
1999-09-19 19:00:01 +02:00
|
|
|
|
/* By default, assume the end of the region will be what was
|
|
|
|
|
suggested. */
|
|
|
|
|
if (new_to)
|
|
|
|
|
*new_to = to;
|
|
|
|
|
|
1999-09-19 18:04:01 +02:00
|
|
|
|
while (r)
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (r) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
switch (NOTE_LINE_NUMBER (r))
|
|
|
|
|
{
|
|
|
|
|
case NOTE_INSN_EH_REGION_BEG:
|
|
|
|
|
++eh_region_count;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NOTE_INSN_EH_REGION_END:
|
|
|
|
|
if (eh_region_count == 0)
|
|
|
|
|
/* This sequence of instructions contains the end of
|
|
|
|
|
an exception region, but not he beginning. Moving
|
|
|
|
|
it will cause chaos. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
--eh_region_count;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (past_to_p)
|
|
|
|
|
/* If we've passed TO, and we see a non-note instruction, we
|
|
|
|
|
can't extend the sequence to a movable sequence. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (r == to)
|
|
|
|
|
{
|
|
|
|
|
if (!new_to)
|
|
|
|
|
/* It's OK to move the sequence if there were matched sets of
|
|
|
|
|
exception region notes. */
|
|
|
|
|
return eh_region_count == 0;
|
|
|
|
|
|
|
|
|
|
past_to_p = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* It's OK to move the sequence if there were matched sets of
|
|
|
|
|
exception region notes. */
|
|
|
|
|
if (past_to_p && eh_region_count == 0)
|
|
|
|
|
{
|
|
|
|
|
*new_to = r;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Go to the next instruction. */
|
|
|
|
|
r = NEXT_INSN (r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|