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]

Re: [patch] Remove useless definitions of FINALIZE_PIC.


Hi Kazu,

This is a patch for your request.

Regards,
Kazuhiro Inaoka

Kazu Hirata wrote:
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: m32r-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r-protos.h,v
retrieving revision 1.29
diff -u -r1.29 m32r-protos.h
--- m32r-protos.h	24 May 2005 07:45:24 -0000	1.29
+++ m32r-protos.h	13 Jun 2005 11:04:39 -0000
@@ -29,7 +29,6 @@
 extern void   m32r_init_expanders (void);
 extern unsigned m32r_compute_frame_size (int);
 extern void   m32r_expand_prologue (void);
-extern void   m32r_finalize_pic (void);
 extern int    direct_return (void);
 extern void   m32r_load_pic_register (void);
 
Index: m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.117
diff -u -r1.117 m32r.c
--- m32r.c	26 May 2005 05:27:52 -0000	1.117
+++ m32r.c	13 Jun 2005 11:04:39 -0000
@@ -1276,7 +1276,8 @@
   unsigned int gmask;
   enum m32r_function_type fn_type;
   int interrupt_p;
-  int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table);
+  int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
+                                  | current_function_profile);
 
   var_size	= M32R_STACK_ALIGN (size);
   args_size	= M32R_STACK_ALIGN (current_function_outgoing_args_size);
@@ -1375,7 +1376,8 @@
   int regno;
   int frame_size;
   unsigned int gmask;
-  int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table);
+  int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
+                                  | current_function_profile);
 
   if (! current_frame_info.initialized)
     m32r_compute_frame_size (get_frame_size ());
@@ -1710,13 +1712,6 @@
   return orig;
 }
 
-/* Emit special PIC prologues and epilogues.  */
-
-void
-m32r_finalize_pic (void)
-{
-  current_function_uses_pic_offset_table |= current_function_profile;
-}
 
 /* Nested function support.  */
 
Index: m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.130
diff -u -r1.130 m32r.h
--- m32r.h	26 May 2005 05:27:52 -0000	1.130
+++ m32r.h	13 Jun 2005 11:04:40 -0000
@@ -1344,22 +1344,6 @@
 /* This register is call-saved on the M32R.  */
 /*#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 m32r_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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]