This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Remove useless definitions of FINALIZE_PIC.


Hi,

Attached is a patch to remove bording uses of FINALIZE_PIC.

The comment just above the sole use of FINALIZE_PIC in passes.c reads

  /* If we are doing position-independent code generation, now
     is the time to output special prologues and epilogues.
     We do not want to do this earlier, because it just clutters
     up inline functions with meaningless insns.  */

So FINALIZE_PIC seems to be pretty useless now that we do inlining at the tree level. It turns out that all definitions of the macro except the one in m32r port are useless.

The patch removes these useless definitions.

The definition in m32r port does not seem to be too crucial. All it does is

void
m32r_finalize_pic (void)
{
  current_function_uses_pic_offset_table |= current_function_profile;
}

There may be an alternative way to achieve the same thing, but I haven't thought hard on this. Kazuhiro, you added FINALIZE_PIC on 2003-12-31. Do you think it's still necessary or can be done elsewhere?

Tested by building cc1 for each target affected. OK to apply?

Kazu Hirata
2005-06-12  Kazu Hirata  <kazu@codesourcery.com>

	* config/arc/arc-protos.c: Remove the prototype for
	arc_finalize_pic.
	* config/arc/arc.c (arc_finalize_pic): Remove.
	* config/arc/arc.h (FINALIZE_PIC): Likewise.
	* config/bfin/bfin.h (FINALIZE_PIC): Likewise.
	* config/rs6000/rs6000.h (FINALIZE_PIC): Likewise.

Index: config/arc/arc-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc-protos.h,v
retrieving revision 1.12
diff -u -d -p -r1.12 arc-protos.h
--- config/arc/arc-protos.h	8 Jul 2004 21:10:16 -0000	1.12
+++ config/arc/arc-protos.h	10 Jun 2005 20:36:09 -0000
@@ -60,7 +60,6 @@ extern unsigned int arc_compute_frame_si
 extern void arc_save_restore (FILE *, const char *, unsigned int,
 			      unsigned int, const char *);
 extern int arc_delay_slots_for_epilogue (void);
-extern void arc_finalize_pic (void);
 extern void arc_ccfsm_at_label (const char *, int);
 extern int arc_ccfsm_branch_deleted_p (void);
 extern void arc_ccfsm_record_branch_deleted (void);
Index: config/arc/arc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.c,v
retrieving revision 1.71
diff -u -d -p -r1.71 arc.c
--- config/arc/arc.c	26 May 2005 05:27:35 -0000	1.71
+++ config/arc/arc.c	10 Jun 2005 20:36:13 -0000
@@ -1443,16 +1443,6 @@ arc_eligible_for_epilogue_delay (rtx tri
   return 0;
 }
 
-/* PIC */
-
-/* Emit special PIC prologues and epilogues.  */
-
-void
-arc_finalize_pic (void)
-{
-  /* nothing to do */
-}
-
 /* Return true if OP is a shift operator.  */
 
 int
Index: config/arc/arc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.h,v
retrieving revision 1.84
diff -u -d -p -r1.84 arc.h
--- config/arc/arc.h	18 Mar 2005 15:24:23 -0000	1.84
+++ config/arc/arc.h	10 Jun 2005 20:36:16 -0000
@@ -900,22 +900,6 @@ extern const char *arc_text_section, *ar
 /* This register is call-saved on the ARC.  */
 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
 
-/* By generating position-independent code, when two different programs (A
-   and B) share a common library (libC.a), the text of the library can be
-   shared whether or not the library is linked at the same address for both
-   programs.  In some of these environments, position-independent code
-   requires not only the use of different addressing modes, but also
-   special code to enable the use of these addressing modes.
-
-   The FINALIZE_PIC macro serves as a hook to emit these special
-   codes once the function is being compiled into assembly code, but not
-   before.  (It is not done before, because in the case of compiling an
-   inline function, it would lead to multiple PIC prologues being
-   included in functions which used inline functions and were compiled to
-   assembly language.)  */
-
-#define FINALIZE_PIC arc_finalize_pic ()
-
 /* A C expression that is nonzero if X is a legitimate immediate
    operand on the target machine when generating position independent code.
    You can assume that X satisfies CONSTANT_P, so you need not
Index: config/bfin/bfin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/bfin/bfin.h,v
retrieving revision 1.7
diff -u -d -p -r1.7 bfin.h
--- config/bfin/bfin.h	9 Jun 2005 11:26:16 -0000	1.7
+++ config/bfin/bfin.h	10 Jun 2005 20:36:18 -0000
@@ -989,23 +989,6 @@ do {                                    
 #define EXTRA_CONSTRAINT(VALUE, D) \
     ((D) == 'Q' ? GET_CODE (VALUE) == SYMBOL_REF : 0)
 
-/* `FINALIZE_PIC'
-     By generating position-independent code, when two different
-     programs (A and B) share a common library (libC.a), the text of
-     the library can be shared whether or not the library is linked at
-     the same address for both programs.  In some of these
-     environments, position-independent code requires not only the use
-     of different addressing modes, but also special code to enable the
-     use of these addressing modes.
-
-     The `FINALIZE_PIC' macro serves as a hook to emit these special
-     codes once the function is being compiled into assembly code, but
-     not before.  (It is not done before, because in the case of
-     compiling an inline function, it would lead to multiple PIC
-     prologues being included in functions which used inline functions
-     and were compiled to assembly language.) */
-#define FINALIZE_PIC  do {} while (0)
-
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
 
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.369
diff -u -d -p -r1.369 rs6000.h
--- config/rs6000/rs6000.h	8 Jun 2005 23:45:45 -0000	1.369
+++ config/rs6000/rs6000.h	10 Jun 2005 20:36:24 -0000
@@ -1813,23 +1813,6 @@ do {								\
 
 /* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
 
-/* By generating position-independent code, when two different
-   programs (A and B) share a common library (libC.a), the text of
-   the library can be shared whether or not the library is linked at
-   the same address for both programs.  In some of these
-   environments, position-independent code requires not only the use
-   of different addressing modes, but also special code to enable the
-   use of these addressing modes.
-
-   The `FINALIZE_PIC' macro serves as a hook to emit these special
-   codes once the function is being compiled into assembly code, but
-   not before.  (It is not done before, because in the case of
-   compiling an inline function, it would lead to multiple PIC
-   prologues being included in functions which used inline functions
-   and were compiled to assembly language.)  */
-
-/* #define FINALIZE_PIC */
-
 /* A C expression that is nonzero if X is a legitimate immediate
    operand on the target machine when generating position independent
    code.  You can assume that X satisfies `CONSTANT_P', so you need

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]