This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Remove FIRST_INSN_ADDRESS.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Dec 2003 11:36:44 -0500 (EST)
- Subject: [patch] Remove FIRST_INSN_ADDRESS.
Hi,
Attached is a patch to FIRST_INSN_ADDRESS, which is only used in m32r
port in a non-crucial way.
First, note that FIRST_INSN_ADDRESS in m32r port always returns 0, so
that justifies the changes to final.c.
Now, focus on the rest of m32r_first_insn_address() in m32r.c.
if (! current_frame_info.initialized)
m32r_compute_frame_size (get_frame_size ());
It turns out that this "if" statement will never trigger. To see
this, consider the following call sequence:
reload ();
reload_completed = 1;
thread_prologue_and_epilogue_insns ();
gen_prologue ();
m32r_expand_prologue ();
m32r_compute_frame_size ();
current_frame_info.initialized = reload_completed;
Tested on m32r-elf. OK to apply?
Kazu Hirata
2003-12-21 Kazu Hirata <kazu@cs.umass.edu>
* final.c (FIRST_INSN_ADDRESS): Remove.
(shorten_branches): Don't use FIRST_INSN_ADDRESS.
* system.h (FIRST_INSN_ADDRESS): Poison.
* config/avr/avr.h: Remove a comment about FIRST_INSN_ADDRESS.
* config/m32r/m32r-protos.h: Remove the prototype for
m32r_first_insn_address.
* config/m32r/m32r.c (m32r_first_insn_address): Remove.
* config/m32r/m32r.h (FIRST_INSN_ADDRESS): Likewise.
* doc/md.texi (FIRST_INSN_ADDRESS): Likewise.
Index: final.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/final.c,v
retrieving revision 1.301
diff -u -p -r1.301 final.c
--- final.c 21 Dec 2003 14:08:33 -0000 1.301
+++ final.c 21 Dec 2003 14:45:53 -0000
@@ -736,12 +736,6 @@ compute_alignments (void)
/* Make a pass over all insns and compute their actual lengths by shortening
any branches of variable length if possible. */
-/* Give a default value for the lowest address in a function. */
-
-#ifndef FIRST_INSN_ADDRESS
-#define FIRST_INSN_ADDRESS 0
-#endif
-
/* shorten_branches might be called multiple times: for example, the SH
port splits out-of-range conditional branches in MACHINE_DEPENDENT_REORG.
In order to do this, it needs proper length information, which it obtains
@@ -971,7 +965,7 @@ shorten_branches (rtx first ATTRIBUTE_UN
#endif /* CASE_VECTOR_SHORTEN_MODE */
/* Compute initial lengths, addresses, and varying flags for each insn. */
- for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
+ for (insn_current_address = 0, insn = first;
insn != 0;
insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
{
@@ -1072,7 +1066,7 @@ shorten_branches (rtx first ATTRIBUTE_UN
{
something_changed = 0;
insn_current_align = MAX_CODE_ALIGN - 1;
- for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
+ for (insn_current_address = 0, insn = first;
insn != 0;
insn = NEXT_INSN (insn))
{
Index: system.h
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/system.h,v
retrieving revision 1.178
diff -u -p -r1.178 system.h
--- system.h 20 Dec 2003 01:40:41 -0000 1.178
+++ system.h 21 Dec 2003 14:46:42 -0000
@@ -620,7 +620,7 @@ typedef char _Bool;
INSN_CACHE_LINE_WIDTH INIT_SECTION_PREAMBLE NEED_ATEXIT ON_EXIT \
EXIT_BODY OBJECT_FORMAT_ROSE MULTIBYTE_CHARS MAP_CHARACTER \
LIBGCC_NEEDS_DOUBLE FINAL_PRESCAN_LABEL DEFAULT_CALLER_SAVES \
- LOAD_ARGS_REVERSED MAX_INTEGER_COMPUTATION_MODE
+ LOAD_ARGS_REVERSED MAX_INTEGER_COMPUTATION_MODE FIRST_INSN_ADDRESS
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \
Index: config/avr/avr.h
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/config/avr/avr.h,v
retrieving revision 1.92
diff -u -p -r1.92 avr.h
--- config/avr/avr.h 21 Dec 2003 07:29:35 -0000 1.92
+++ config/avr/avr.h 21 Dec 2003 14:45:53 -0000
@@ -2301,11 +2301,6 @@ extern int avr_case_values_threshold;
#define FUNCTION_PROFILER(FILE, LABELNO) \
fprintf (FILE, "/* profiler %d */", (LABELNO))
-/* `FIRST_INSN_ADDRESS'
- When the `length' insn attribute is used, this macro specifies the
- value to be assigned to the address of the first insn in a
- function. If not specified, 0 is used. */
-
#define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
adjust_insn_length (INSN, LENGTH))
/* If defined, modifies the length assigned to instruction INSN as a
Index: config/m32r/m32r-protos.h
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/config/m32r/m32r-protos.h,v
retrieving revision 1.19
diff -u -p -r1.19 m32r-protos.h
--- config/m32r/m32r-protos.h 5 Dec 2003 09:38:31 -0000 1.19
+++ config/m32r/m32r-protos.h 21 Dec 2003 14:45:53 -0000
@@ -27,7 +27,6 @@ extern void sdata_section (void);
extern void m32r_init (void);
extern void m32r_init_expanders (void);
extern unsigned m32r_compute_frame_size (int);
-extern int m32r_first_insn_address (void);
extern void m32r_expand_prologue (void);
extern void m32r_finalize_pic (void);
extern int direct_return (void);
Index: config/m32r/m32r.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.76
diff -u -p -r1.76 m32r.c
--- config/m32r/m32r.c 17 Dec 2003 03:30:19 -0000 1.76
+++ config/m32r/m32r.c 21 Dec 2003 15:02:33 -0000
@@ -1852,19 +1852,6 @@ m32r_compute_frame_size (int size) /* #
return total_size;
}
-/* When the `length' insn attribute is used, this macro specifies the
- value to be assigned to the address of the first insn in a
- function. If not specified, 0 is used. */
-
-int
-m32r_first_insn_address (void)
-{
- if (! current_frame_info.initialized)
- m32r_compute_frame_size (get_frame_size ());
-
- return 0;
-}
-
/* Expand the m32r prologue as a series of insns. */
void
Index: config/m32r/m32r.h
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.93
diff -u -p -r1.93 m32r.h
--- config/m32r/m32r.h 11 Dec 2003 10:22:43 -0000 1.93
+++ config/m32r/m32r.h 21 Dec 2003 14:46:01 -0000
@@ -1464,12 +1464,6 @@ do { \
itself with an explicit address than to call an address kept in a
register. */
#define NO_RECURSIVE_FUNCTION_CSE
-
-/* When the `length' insn attribute is used, this macro specifies the
- value to be assigned to the address of the first insn in a
- function. If not specified, 0 is used. */
-#define FIRST_INSN_ADDRESS m32r_first_insn_address ()
-
/* Section selection. */
Index: doc/md.texi
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/doc/md.texi,v
retrieving revision 1.80
diff -u -p -r1.80 md.texi
--- doc/md.texi 30 Nov 2003 15:51:36 -0000 1.80
+++ doc/md.texi 21 Dec 2003 14:46:02 -0000
@@ -5286,12 +5286,6 @@ Lengths are measured in addressable stor
The following macros can be used to refine the length computation:
@table @code
-@findex FIRST_INSN_ADDRESS
-@item FIRST_INSN_ADDRESS
-When the @code{length} insn attribute is used, this macro specifies the
-value to be assigned to the address of the first insn in a function. If
-not specified, 0 is used.
-
@findex ADJUST_INSN_LENGTH
@item ADJUST_INSN_LENGTH (@var{insn}, @var{length})
If defined, modifies the length assigned to instruction @var{insn} as a