OSDN Git Service

* config/alpha/alpha.c (alpha_does_function_need_gp): Test
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 May 2000 02:25:46 +0000 (02:25 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 May 2000 02:25:46 +0000 (02:25 +0000)
        TARGET_PROFILING_NEEDS_GP in the if, instead of with an ifdef.
        (alpha_expand_prologue): Emit prologue_mcount if needed.
        * config/alpha/alpha.h (TARGET_PROFILING_NEEDS_GP): Default to 0.
        * config/alpha/alpha.md (prologue_mcount): New.
        * config/alpha/linux.h (FUNCTION_PROFILER): Remove.
        (TARGET_PROFILING_NEEDS_GP): Undef before redefining.
        * config/alpha/netbsd.h: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34222 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/alpha/alpha.md
gcc/config/alpha/linux.h
gcc/config/alpha/netbsd.h

index 461423f..cff7b96 100644 (file)
@@ -1,5 +1,16 @@
 2000-05-27  Richard Henderson  <rth@cygnus.com>
 
+       * config/alpha/alpha.c (alpha_does_function_need_gp): Test
+       TARGET_PROFILING_NEEDS_GP in the if, instead of with an ifdef.
+       (alpha_expand_prologue): Emit prologue_mcount if needed.
+       * config/alpha/alpha.h (TARGET_PROFILING_NEEDS_GP): Default to 0.
+       * config/alpha/alpha.md (prologue_mcount): New.
+       * config/alpha/linux.h (FUNCTION_PROFILER): Remove.
+       (TARGET_PROFILING_NEEDS_GP): Undef before redefining.
+       * config/alpha/netbsd.h: Likewise.
+
+2000-05-27  Richard Henderson  <rth@cygnus.com>
+
        * config/alpha/elf.h (SELECT_SECTION): Mirror Kenner's May 19
        change to config/elfos.h.
 
index ed70878..f70e889 100644 (file)
@@ -4056,10 +4056,8 @@ alpha_does_function_need_gp ()
   if (TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
     return 0;
 
-#ifdef TARGET_PROFILING_NEEDS_GP
-  if (profile_flag)
+  if (TARGET_PROFILING_NEEDS_GP && profile_flag)
     return 1;
-#endif
 
 #ifdef ASM_OUTPUT_MI_THUNK
   if (current_function_is_thunk)
@@ -4190,6 +4188,13 @@ alpha_expand_prologue ()
        emit_insn (gen_prologue_ldgp ());
     }
 
+  /* TARGET_PROFILING_NEEDS_GP actually implies that we need to insert
+     the call to mcount ourselves, rather than having the linker do it
+     magically in response to -pg.  Since _mcount has special linkage,
+     don't represent the call as a call.  */
+  if (TARGET_PROFILING_NEEDS_GP && profile_flag)
+    emit_insn (gen_prologue_mcount ());
+      
   /* Adjust the stack by the frame size.  If the frame size is > 4096
      bytes, we need to be sure we probe somewhere in the first and last
      4096 bytes (we can probably get away without the latter test) and
index a362bb8..ad59214 100644 (file)
@@ -185,6 +185,9 @@ extern enum alpha_fp_trap_mode alpha_fptm;
 #ifndef TARGET_HAS_XFLOATING_LIBS
 #define TARGET_HAS_XFLOATING_LIBS 0
 #endif
+#ifndef TARGET_PROFILING_NEEDS_GP
+#define TARGET_PROFILING_NEEDS_GP 0
+#endif
 
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
index dfef150..0866be5 100644 (file)
@@ -41,6 +41,9 @@
 ;;     5       prologue_stack_probe_loop
 ;;     6       realign
 ;;     7       exception_receiver
+;;     8       prologue_mcount
+;;     9       prologue_ldgp_1
+;;     10      prologue_ldgp_2
 \f
 ;; Processor type -- this attribute must exactly match the processor_type
 ;; enumeration in alpha.h.
   "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
   "")
 
+;; The _mcount profiling hook has special calling conventions, and
+;; does not clobber all the registers that a normal call would.  So
+;; hide the fact this is a call at all.
+
+(define_insn "prologue_mcount"
+  [(unspec_volatile [(const_int 0)] 8)]
+  ""
+  "lda $28,_mcount\;jsr $28,($28),_mcount"
+  [(set_attr "type" "multi")
+   (set_attr "length" "8")])
+
 (define_insn "init_fp"
   [(set (match_operand:DI 0 "register_operand" "=r")
         (match_operand:DI 1 "register_operand" "r"))
index 8858eb6..9969cc6 100644 (file)
@@ -31,11 +31,8 @@ SUB_CPP_PREDEFINES
 #undef LIB_SPEC
 #define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}"
 
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO)                       \
-       fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE))
-
 /* Show that we need a GP when profiling.  */
+#undef TARGET_PROFILING_NEEDS_GP
 #define TARGET_PROFILING_NEEDS_GP 1
 
 /* Don't care about faults in the prologue.  */
index 15dcadb..0a10f5a 100644 (file)
@@ -28,9 +28,6 @@ Boston, MA 02111-1307, USA.  */
 #undef LIB_SPEC
 #define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}"
 
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO)                       \
-       fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE))
-
 /* Show that we need a GP when profiling.  */
-#define TARGET_PROFILING_NEEDS_GP
+#undef TARGET_PROFILING_NEEDS_GP
+#define TARGET_PROFILING_NEEDS_GP 1