2000-07-27 Alexandre Oliva <aoliva@redhat.com>
+ * Makefile.in (INSN_ATTR_H): New macro. Replace all dependencies
+ on insn-attr.h with it.
+ * genattr.c: Generate `#include "insn-addr.h"' if HAVE_ATTR_length.
+ * insn-addr.h: New header.
+ (insn_addresses_): Renamed from insn_addresses.
+ (INSN_ADDRESSES_DEFN, INSN_ADDRESSES, INSN_ADDRESSES_ALLOC,
+ INSN_ADDRESSES_FREE, INSN_ADDRESSES_SET_P, INSN_ADDRESSES_SIZE,
+ INSN_ADDRESSES_NEW): New macros.
+ * genattrtab.c (write_test_expr): Use new macros.
+ * final.c (insn_addresses, init_insn_lengths): Likewise.
+ (align_fuzz, shorten_branches): Likewise.
+ (final): Likewise. Do not reject new insns if their addresses
+ have been added to INSN_ADDRESSES.
+ * config/arm/arm.c, config/avr/avr.c: Use new macros.
+ * config/h8300/h8300.c, config/i370/i370.c: Likewise.
+ * config/m88k/m88k.c, config/pa/pa.c, config/pa/pa.md: Likewise.
+ * config/sparc/sparc.c, config/sparc/sparc.md: Likewise.
+ * config/sh/sh.c: Likewise.
+ (output_branchy_insn): Use INSN_ADDRESSES_NEW.
+
* Makefile.in (bootstrap): Move -BstageN/ back to the beginning.
2000-07-27 Andrew Cagney <cagney@b1.cygnus.com>
GCC_H = gcc.h version.h
GGC_H = ggc.h varray.h
TIMEVAR_H = timevar.h timevar.def
+INSN_ATTR_H = insn-attr.h $(srcdir)/insn-addr.h $(srcdir)/varray.h
#\f
# Language makefile fragments.
$(RTL_H) ggc.h
diagnostic.o : diagnostic.c diagnostic.h \
$(CONFIG_H) system.h $(TREE_H) $(RTL_H) tm_p.h flags.h \
- $(GGC_H) input.h insn-attr.h insn-codes.h insn-config.h toplev.h intl.h
+ $(GGC_H) input.h $(INSN_ATTR_H) insn-codes.h insn-config.h toplev.h intl.h
toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) function.h \
- flags.h input.h insn-attr.h xcoffout.h defaults.h output.h diagnostic.h \
+ flags.h input.h $(INSN_ATTR_H) xcoffout.h defaults.h output.h diagnostic.h \
insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
graph.h loop.h except.h regs.h $(TIMEVAR_H) $(lang_options_files)
intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H)
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
- toplev.h insn-attr.h
+ toplev.h $(INSN_ATTR_H)
simplify-rtx.o : simplify-rtx.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) \
hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
$(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \
- insn-attr.h except.h
+ $(INSN_ATTR_H) except.h
lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
- real.h insn-config.h insn-attr.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
+ real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
ssa.o : ssa.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) $(BASIC_BLOCK_H) \
output.h insn-config.h
conflict.o : conflict.c $(CONFIG_H) system.h $(OBSTACK_H) $(HASHTAB_H) \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
insn-flags.h function.h except.h $(EXPR_H)
combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h function.h \
- insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
+ insn-config.h insn-flags.h insn-codes.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \
$(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
$(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h \
toplev.h function.h output.h $(GGC_H)
local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
- output.h function.h insn-attr.h toplev.h
+ output.h function.h $(INSN_ATTR_H) toplev.h
bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
$(REGS_H)
global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h function.h \
$(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \
$(RECOG_H) reload.h $(EXPR_H) toplev.h
reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
- $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h insn-flags.h \
+ $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(INSN_ATTR_H) insn-flags.h \
$(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h
alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
$(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h $(GGC_H) function.h \
$(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
haifa-sched.o : haifa-sched.c $(CONFIG_H) system.h $(RTL_H) \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
- insn-attr.h toplev.h $(RECOG_H) except.h
+ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h
final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h intl.h \
- $(REGS_H) $(RECOG_H) conditions.h insn-config.h insn-attr.h function.h \
+ $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \
real.h output.h hard-reg-set.h insn-flags.h insn-codes.h gstab.h except.h \
xcoffout.h defaults.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h \
dbxout.h $(BASIC_BLOCK_H)
recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) function.h $(BASIC_BLOCK_H) \
- $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
+ $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h $(INSN_ATTR_H) \
insn-flags.h insn-codes.h real.h toplev.h output.h
reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) $(RECOG_H) \
$(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h \
output.h
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
- insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h function.h
+ insn-flags.h output.h $(INSN_ATTR_H) insn-codes.h system.h toplev.h function.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
# Build auxiliary files that support ecoff format.
touch s-peep
insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
- output.h insn-attr.h insn-config.h system.h toplev.h $(RECOG_H)
+ output.h $(INSN_ATTR_H) insn-config.h system.h toplev.h $(RECOG_H)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
insn-attr.h: s-attr ; @true
touch s-attrtab
insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(GGC_H) $(REGS_H) real.h \
- conditions.h hard-reg-set.h insn-config.h insn-flags.h insn-attr.h \
+ conditions.h hard-reg-set.h insn-config.h insn-flags.h $(INSN_ATTR_H) \
output.h $(RECOG_H) function.h insn-codes.h system.h toplev.h flags.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
thumb_final_prescan_insn (insn)
rtx insn;
{
- extern int * insn_addresses;
-
if (flag_print_asm_name)
- asm_fprintf (asm_out_file, "%@ 0x%04x\n", insn_addresses[INSN_UID (insn)]);
+ asm_fprintf (asm_out_file, "%@ 0x%04x\n",
+ INSN_ADDRESSES (INSN_UID (insn)));
}
int
signal_func_p = signal_function_p (current_function_decl);
leaf_func_p = leaf_function_p ();
main_p = ! strcmp ("main", current_function_name);
- function_size = (insn_addresses[INSN_UID (get_last_insn ())]
- - insn_addresses[INSN_UID (get_insns ())]);
+ function_size = (INSN_ADDRESSES (INSN_UID (get_last_insn ()))
+ - INSN_ADDRESSES (INSN_UID (get_insns ())));
live_seq = sequent_regs_live ();
minimize = (TARGET_CALL_PROLOGUES
&& !interrupt_func_p && !signal_func_p && live_seq);
rtx x; /* jump operand */
rtx insn; /* jump insn */
{
- int dest_addr = insn_addresses[INSN_UID (GET_MODE (x) == LABEL_REF
- ? XEXP (x, 0) : x)];
- int cur_addr = insn_addresses[INSN_UID (insn)];
+ int dest_addr = INSN_ADDRESSES (INSN_UID (GET_MODE (x) == LABEL_REF
+ ? XEXP (x, 0) : x));
+ int cur_addr = INSN_ADDRESSES (INSN_UID (insn));
int jump_distance = cur_addr - dest_addr;
if (-63 <= jump_distance && jump_distance <= 62)
if (TARGET_INSN_SIZE_DUMP || TARGET_ALL_DEBUG)
{
- fprintf (asm_out_file, "/*DEBUG: 0x%x\t\t%d\t%d */\n", insn_addresses[uid],
- insn_addresses[uid] - last_insn_address,
- rtx_cost (PATTERN (insn),INSN));
+ fprintf (asm_out_file, "/*DEBUG: 0x%x\t\t%d\t%d */\n",
+ INSN_ADDRESSES (uid),
+ INSN_ADDRESSES (uid) - last_insn_address,
+ rtx_cost (PATTERN (insn), INSN));
}
- last_insn_address = insn_addresses[uid];
+ last_insn_address = INSN_ADDRESSES (uid);
if (TARGET_RTL_DUMP)
{
int uid = INSN_UID (GET_CODE (dest) == LABEL_REF
? XEXP (dest, 0)
: dest);
- int jump_addr = insn_addresses[INSN_UID (insn)];
- int dest_addr = insn_addresses[uid];
+ int jump_addr = INSN_ADDRESSES (INSN_UID (insn));
+ int dest_addr = INSN_ADDRESSES (uid);
return dest_addr - jump_addr == 2;
}
if (TARGET_ADDRESSES)
{
- fprintf (asm_out_file, "; 0x%x %d\n", insn_addresses[uid],
- insn_addresses[uid] - last_insn_address);
- last_insn_address = insn_addresses[uid];
+ fprintf (asm_out_file, "; 0x%x %d\n", INSN_ADDRESSES (uid),
+ INSN_ADDRESSES (uid) - last_insn_address);
+ last_insn_address = INSN_ADDRESSES (uid);
}
}
dest = XEXP (dest, 1);
dest = XEXP (dest, 0);
dest_uid = INSN_UID (dest);
- dest_addr = insn_addresses[dest_uid];
+ dest_addr = INSN_ADDRESSES (dest_uid);
/* next, record the address of this insn as the true addr of first ref */
{
rtx insn;
{
int here, there;
- here = insn_addresses[INSN_UID (insn)];
+ here = INSN_ADDRESSES (INSN_UID (insn));
there = i370_branch_dest (insn);
return (there - here);
}
for (insn = get_insns(); insn; insn = NEXT_INSN(insn))
{
- int here = insn_addresses[INSN_UID (insn)];
+ int here = INSN_ADDRESSES (INSN_UID (insn));
enum rtx_code code = GET_CODE(insn);
/* ??? adjust for tables embedded in the .text section that
* the compiler didn't take into account */
here += tablejump_offset;
- insn_addresses[INSN_UID (insn)] = here;
+ INSN_ADDRESSES (INSN_UID (insn)) = here;
/* check to see if this insn is a label ... */
if (CODE_LABEL == code)
rtx low, high;
const char *last;
rtx dest = XEXP (SET_SRC (PATTERN (jump)), 0);
- int delta = 4 * (insn_addresses[INSN_UID (dest)]
- - insn_addresses[INSN_UID (seq_insn)]
+ int delta = 4 * (INSN_ADDRESSES (INSN_UID (dest))
+ - INSN_ADDRESSES (INSN_UID (seq_insn))
- 2);
#if (MONITOR_GCC & 0x2) /* How often do long branches happen? */
if ((unsigned) (delta + 0x8000) >= 0x10000)
insnj = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
else
insnj = jump_insn;
- if (insn_addresses[INSN_UID (insnj)]
- > insn_addresses[INSN_UID (target_label)])
+ if (INSN_ADDRESSES (INSN_UID (insnj))
+ > INSN_ADDRESSES (INSN_UID (target_label)))
return 0;
/* EQ tests are usually false and NE tests are usually true. Also,
we don't need to accumulate the total number of code bytes. */
if (TARGET_GAS && ! TARGET_PORTABLE_RUNTIME)
total_code_bytes = 0;
- else if (insn_addresses)
+ else if (INSN_ADDRESSES_SET_P ())
{
unsigned int old_total = total_code_bytes;
- total_code_bytes += insn_addresses[INSN_UID (get_last_insn())];
+ total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_insn()));
total_code_bytes += FUNCTION_BOUNDARY / BITS_PER_UNIT;
/* Be prepared to handle overflows. */
taken and untaken branches. */
else if (dbr_sequence_length () == 0
&& ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
+ && INSN_ADDRESSES_SET_P ()
+ && VAL_14_BITS_P (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (insn)))
+ - INSN_ADDRESSES (INSN_UID (insn)) - 8))
{
strcpy (buf, "{com%I2b,|cmp%I2b,}");
if (GET_MODE (operands[1]) == DImode)
taken and untaken branches. */
else if (dbr_sequence_length () == 0
&& ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
+ && INSN_ADDRESSES_SET_P ()
+ && VAL_14_BITS_P (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (insn)))
+ - INSN_ADDRESSES (INSN_UID (insn)) - 8))
{
strcpy (buf, "bb,");
if (GET_MODE (operands[0]) == DImode)
taken and untaken branches. */
else if (dbr_sequence_length () == 0
&& ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
+ && INSN_ADDRESSES_SET_P ()
+ && VAL_14_BITS_P (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (insn)))
+ - INSN_ADDRESSES (INSN_UID (insn)) - 8))
{
strcpy (buf, "{bvb,|bb,}");
if (GET_MODE (operands[0]) == DImode)
taken and untaken branches. */
else if (dbr_sequence_length () == 0
&& ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
+ && INSN_ADDRESSES_SET_P ()
+ && VAL_14_BITS_P (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (insn)))
+ - INSN_ADDRESSES (INSN_UID (insn)) - 8))
return "addib,%C2 %1,%0,%3%#";
/* Handle normal cases. */
taken and untaken branches. */
else if (dbr_sequence_length () == 0
&& ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
+ && INSN_ADDRESSES_SET_P ()
+ && VAL_14_BITS_P (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (insn)))
+ - INSN_ADDRESSES (INSN_UID (insn)) - 8))
return "movb,%C2 %1,%0,%3%#";
/* Handle normal cases. */
if (nullify)
/* Use the containing sequence insn's address. */
seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
- distance = insn_addresses[INSN_UID (JUMP_LABEL (NEXT_INSN (insn)))]
- - insn_addresses[INSN_UID (seq_insn)] - 8;
+ distance = INSN_ADDRESSES (INSN_UID (JUMP_LABEL (NEXT_INSN (insn))))
+ - INSN_ADDRESSES (INSN_UID (seq_insn)) - 8;
/* If the branch was too far away, emit a normal call followed
by a nop, followed by the unconditional branch.
/* Use the containing sequence insn's address. */
seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
- distance = insn_addresses[INSN_UID (JUMP_LABEL (NEXT_INSN (insn)))]
- - insn_addresses[INSN_UID (seq_insn)] - 8;
+ distance = INSN_ADDRESSES (INSN_UID (JUMP_LABEL (NEXT_INSN (insn))))
+ - INSN_ADDRESSES (INSN_UID (seq_insn)) - 8;
/* If the branch was too far away, emit a normal call followed
by a nop, followed by the unconditional branch.
/* If we're trying to load the address of a label that happens to be
close, then we can use a shorter sequence. */
if (GET_CODE (operands[1]) == LABEL_REF
- && insn_addresses
- && abs (insn_addresses[INSN_UID (XEXP (operands[1], 0))]
- - insn_addresses[INSN_UID (insn)]) < 8100)
+ && INSN_ADDRESSES_SET_P ()
+ && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
+ - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
{
/* Prefixing with R% here is wrong, it extracts just 11 bits and is
always non-negative. */
sh_expand_prologue. */
int current_function_anonymous_args;
-/* Global variables from toplev.c and final.c that are used within, but
- not declared in any header file. */
-extern int *insn_addresses;
-
/* Global variables for machine-dependent things. */
/* Which cpu are we scheduling for. */
struct { rtx lab, reg, op; } this;
const char *jump;
int far;
- int offset = branch_dest (insn) - insn_addresses[INSN_UID (insn)];
+ int offset = branch_dest (insn) - INSN_ADDRESSES (INSN_UID (insn));
this.lab = gen_label_rtx ();
/* Following branch not taken */
operands[9] = gen_label_rtx ();
emit_label_after (operands[9], next_insn);
+ INSN_ADDRESSES_NEW (operands[9],
+ INSN_ADDRESSES (INSN_UID (next_insn))
+ + get_attr_length (next_insn));
return template;
}
else
{
int offset = (branch_dest (next_insn)
- - insn_addresses[INSN_UID (next_insn)] + 4);
+ - INSN_ADDRESSES (INSN_UID (next_insn)) + 4);
if (offset >= -252 && offset <= 258)
{
if (GET_CODE (src) == IF_THEN_ELSE)
}
operands[9] = gen_label_rtx ();
emit_label_after (operands[9], insn);
+ INSN_ADDRESSES_NEW (operands[9],
+ INSN_ADDRESSES (INSN_UID (insn))
+ + get_attr_length (insn));
return template;
}
dest = XEXP (SET_SRC (PATTERN (jump)), 0);
/* If the branch is out of range, try to find a scratch register for it. */
if (optimize
- && (insn_addresses[INSN_UID (dest)] - addr + 4092U > 4092 + 4098))
+ && (INSN_ADDRESSES (INSN_UID (dest)) - addr + 4092U > 4092 + 4098))
{
rtx scan;
/* Don't look for the stack pointer as a scratch register,
{
dest = JUMP_LABEL (next);
if (dest
- && insn_addresses[INSN_UID (dest)] - addr + 4092U > 4092 + 4098)
- gen_block_redirect (next, insn_addresses[INSN_UID (next)], -1);
+ && (INSN_ADDRESSES (INSN_UID (dest)) - addr + 4092U
+ > 4092 + 4098))
+ gen_block_redirect (next, INSN_ADDRESSES (INSN_UID (next)), -1);
}
}
}
mdep_reorg_phase = SH_SHORTEN_BRANCHES1;
- insn_addresses = 0;
+ INSN_ADDRESSES_FREE ();
split_branches (first);
/* The INSN_REFERENCES_ARE_DELAYED in sh.h is problematic because it
{
rtx src = SET_SRC (PATTERN (insn));
rtx olabel = XEXP (XEXP (src, 1), 0);
- int addr = insn_addresses[INSN_UID (insn)];
+ int addr = INSN_ADDRESSES (INSN_UID (insn));
rtx label = 0;
int dest_uid = get_dest_uid (olabel, max_uid);
struct far_branch *bp = uid_branch[dest_uid];
== JUMP_INSN))
&& GET_CODE (PATTERN (beyond)) == SET
&& recog_memoized (beyond) == CODE_FOR_jump
- && ((insn_addresses[INSN_UID (XEXP (SET_SRC (PATTERN (beyond)), 0))]
- - insn_addresses[INSN_UID (insn)] + 252U)
+ && ((INSN_ADDRESSES
+ (INSN_UID (XEXP (SET_SRC (PATTERN (beyond)), 0)))
+ - INSN_ADDRESSES (INSN_UID (insn)) + 252U)
> 252 + 258 + 2))
gen_block_redirect (beyond,
- insn_addresses[INSN_UID (beyond)], 1);
+ INSN_ADDRESSES (INSN_UID (beyond)), 1);
}
next = next_active_insn (insn);
|| GET_CODE (next = next_active_insn (next)) == JUMP_INSN)
&& GET_CODE (PATTERN (next)) == SET
&& recog_memoized (next) == CODE_FOR_jump
- && ((insn_addresses[INSN_UID (XEXP (SET_SRC (PATTERN (next)), 0))]
- - insn_addresses[INSN_UID (insn)] + 252U)
+ && ((INSN_ADDRESSES
+ (INSN_UID (XEXP (SET_SRC (PATTERN (next)), 0)))
+ - INSN_ADDRESSES (INSN_UID (insn)) + 252U)
> 252 + 258 + 2))
- gen_block_redirect (next, insn_addresses[INSN_UID (next)], 1);
+ gen_block_redirect (next, INSN_ADDRESSES (INSN_UID (next)), 1);
}
else if (type == TYPE_JUMP || type == TYPE_RETURN)
{
- int addr = insn_addresses[INSN_UID (insn)];
+ int addr = INSN_ADDRESSES (INSN_UID (insn));
rtx far_label = 0;
int dest_uid = 0;
struct far_branch *bp;
int noperands ATTRIBUTE_UNUSED;
{
if (TARGET_DUMPISIZE)
- fprintf (asm_out_file, "\n! at %04x\n", insn_addresses[INSN_UID (insn)]);
+ fprintf (asm_out_file, "\n! at %04x\n", INSN_ADDRESSES (INSN_UID (insn)));
if (TARGET_RELAX)
{
dest = XEXP (dest, 1);
dest = XEXP (dest, 0);
dest_uid = INSN_UID (dest);
- return insn_addresses[dest_uid];
+ return INSN_ADDRESSES (dest_uid);
}
\f
/* Return non-zero if REG is not used after INSN.
short_branch (uid1, uid2)
int uid1, uid2;
{
- int delta = insn_addresses[uid1] - insn_addresses[uid2];
+ int delta = INSN_ADDRESSES (uid1) - INSN_ADDRESSES (uid2);
/* Leave a few words of "slop". */
if (delta >= -1023 && delta <= 1022)
instead. */
if (! TARGET_V9 && flag_delayed_branch
- && (insn_addresses[INSN_UID (operands[0])]
- == insn_addresses[INSN_UID (insn)]))
+ && (INSN_ADDRESSES (INSN_UID (operands[0]))
+ == INSN_ADDRESSES (INSN_UID (insn))))
return \"b\\t%l0%#\";
else
return TARGET_V9 ? \"ba,pt%*\\t%%xcc, %l0%(\" : \"b%*\\t%l0%(\";
`insn_current_length'. */
static short *insn_lengths;
-int *insn_addresses;
+
+#ifdef HAVE_ATTR_length
+varray_type insn_addresses_;
+#endif
/* Max uid for which the above arrays are valid. */
static int insn_lengths_max_uid;
insn_lengths = 0;
insn_lengths_max_uid = 0;
}
- if (insn_addresses)
- {
- free (insn_addresses);
- insn_addresses = 0;
- }
+#ifdef HAVE_ATTR_length
+ INSN_ADDRESSES_FREE ();
+#endif
if (uid_align)
{
free (uid_align);
int align_addr, new_align;
uid = INSN_UID (align_label);
- align_addr = insn_addresses[uid] - insn_lengths[uid];
+ align_addr = INSN_ADDRESSES (uid) - insn_lengths[uid];
if (uid_shuid[uid] > end_shuid)
break;
known_align_log = LABEL_TO_ALIGNMENT (align_label);
insn_lengths_max_uid = max_uid;
/* Syntax errors can lead to labels being outside of the main insn stream.
Initialize insn_addresses, so that we get reproducible results. */
- insn_addresses = (int *) xcalloc (max_uid, sizeof (int));
+ INSN_ADDRESSES_ALLOC (max_uid);
varying_length = (char *) xcalloc (max_uid, sizeof (char));
}
}
- insn_addresses[uid] = insn_current_address;
+ INSN_ADDRESSES (uid) = insn_current_address;
if (GET_CODE (insn) == NOTE || GET_CODE (insn) == BARRIER
|| GET_CODE (insn) == CODE_LABEL)
if ((varying_length[inner_uid]
= insn_variable_length_p (inner_insn)) != 0)
varying_length[uid] = 1;
- insn_addresses[inner_uid] = (insn_current_address +
- insn_lengths[uid]);
+ INSN_ADDRESSES (inner_uid) = (insn_current_address
+ + insn_lengths[uid]);
}
else
varying_length[inner_uid] = 0;
}
else
insn_lengths[uid] = 0;
- insn_addresses[uid] = insn_current_address;
+ INSN_ADDRESSES (uid) = insn_current_address;
continue;
}
if (length_align < insn_current_align)
insn_current_align = length_align;
- insn_last_address = insn_addresses[uid];
- insn_addresses[uid] = insn_current_address;
+ insn_last_address = INSN_ADDRESSES (uid);
+ INSN_ADDRESSES (uid) = insn_current_address;
#ifdef CASE_VECTOR_SHORTEN_MODE
if (optimize && GET_CODE (insn) == JUMP_INSN
rtx min_lab = XEXP (XEXP (body, 2), 0);
rtx max_lab = XEXP (XEXP (body, 3), 0);
addr_diff_vec_flags flags = ADDR_DIFF_VEC_FLAGS (body);
- int rel_addr = insn_addresses[INSN_UID (rel_lab)];
- int min_addr = insn_addresses[INSN_UID (min_lab)];
- int max_addr = insn_addresses[INSN_UID (max_lab)];
+ int rel_addr = INSN_ADDRESSES (INSN_UID (rel_lab));
+ int min_addr = INSN_ADDRESSES (INSN_UID (min_lab));
+ int max_addr = INSN_ADDRESSES (INSN_UID (max_lab));
rtx prev;
int rel_align = 0;
int inner_uid = INSN_UID (inner_insn);
int inner_length;
- insn_addresses[inner_uid] = insn_current_address;
+ INSN_ADDRESSES (inner_uid) = insn_current_address;
/* insn_current_length returns 0 for insns with a
non-varying length. */
for (insn = NEXT_INSN (first); insn;)
{
#ifdef HAVE_ATTR_length
- if (INSN_UID (insn) >= insn_lengths_max_uid)
+ if (INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
{
#ifdef STACK_REGS
/* Irritatingly, the reg-stack pass is creating new instructions
#endif
}
else
- insn_current_address = insn_addresses[INSN_UID (insn)];
+ insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
#endif /* HAVE_ATTR_length */
insn = final_scan_insn (insn, file, optimize, prescan, 0);
printf ("extern int insn_default_length PARAMS ((rtx));\n");
printf ("extern int insn_variable_length_p PARAMS ((rtx));\n");
printf ("extern int insn_current_length PARAMS ((rtx));\n\n");
- printf ("extern int *insn_addresses;\n");
- printf ("extern int insn_current_address;\n\n");
+ printf ("#include \"insn-addr.h\"\n\n");
}
}
/* The address of the branch target. */
case MATCH_DUP:
- printf ("insn_addresses[INSN_UID (GET_CODE (operands[%d]) == LABEL_REF ? XEXP (operands[%d], 0) : operands[%d])]",
+ printf ("INSN_ADDRESSES (INSN_UID (GET_CODE (operands[%d]) == LABEL_REF ? XEXP (operands[%d], 0) : operands[%d]))",
XINT (exp, 0), XINT (exp, 0), XINT (exp, 0));
break;
--- /dev/null
+/* Macros to support INSN_ADDRESSES
+ Copyright (C) 2000 Free Software Foundation, Inc.
+
+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
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _INSN_ADDR_H
+#define _INSN_ADDR_H 1
+
+#include "varray.h"
+
+extern varray_type insn_addresses_;
+extern int insn_current_address;
+
+#define INSN_ADDRESSES_DEFN() varray_type insn_addresses_
+#define INSN_ADDRESSES(id) VARRAY_INT (insn_addresses_, (id))
+#define INSN_ADDRESSES_ALLOC(size) \
+ VARRAY_INT_INIT (insn_addresses_, (size), "insn_addresses")
+#define INSN_ADDRESSES_FREE() VARRAY_FREE (insn_addresses_)
+#define INSN_ADDRESSES_SET_P() (insn_addresses_ != 0)
+#define INSN_ADDRESSES_SIZE() VARRAY_SIZE (insn_addresses_)
+#define INSN_ADDRESSES_NEW(insn,addr) do { \
+ int insn_uid__ = INSN_UID ((insn)), insn_addr__ = (addr); \
+ \
+ if (INSN_ADDRESSES_SET_P()) { \
+ if (INSN_ADDRESSES_SIZE() <= insn_uid__) \
+ insn_addresses_ = VARRAY_GROW (insn_addresses_, insn_uid__ + 1); \
+ INSN_ADDRESSES (insn_uid__) = insn_addr__; \
+ } \
+} while (0)
+
+#endif /* _INSN_ADDR_H */