Commit 4f1c5cce by Richard Henderson Committed by Richard Henderson

alpha.c (alpha_does_function_need_gp): Test TARGET_PROFILING_NEEDS_GP in the if,…

alpha.c (alpha_does_function_need_gp): Test TARGET_PROFILING_NEEDS_GP in the if, instead of with an ifdef.

        * 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.

From-SVN: r34222
parent a1920fc3
2000-05-27 Richard Henderson <rth@cygnus.com> 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 * config/alpha/elf.h (SELECT_SECTION): Mirror Kenner's May 19
change to config/elfos.h. change to config/elfos.h.
...@@ -4056,10 +4056,8 @@ alpha_does_function_need_gp () ...@@ -4056,10 +4056,8 @@ alpha_does_function_need_gp ()
if (TARGET_WINDOWS_NT || TARGET_OPEN_VMS) if (TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
return 0; return 0;
#ifdef TARGET_PROFILING_NEEDS_GP if (TARGET_PROFILING_NEEDS_GP && profile_flag)
if (profile_flag)
return 1; return 1;
#endif
#ifdef ASM_OUTPUT_MI_THUNK #ifdef ASM_OUTPUT_MI_THUNK
if (current_function_is_thunk) if (current_function_is_thunk)
...@@ -4190,6 +4188,13 @@ alpha_expand_prologue () ...@@ -4190,6 +4188,13 @@ alpha_expand_prologue ()
emit_insn (gen_prologue_ldgp ()); 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 /* 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 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 4096 bytes (we can probably get away without the latter test) and
......
...@@ -185,6 +185,9 @@ extern enum alpha_fp_trap_mode alpha_fptm; ...@@ -185,6 +185,9 @@ extern enum alpha_fp_trap_mode alpha_fptm;
#ifndef TARGET_HAS_XFLOATING_LIBS #ifndef TARGET_HAS_XFLOATING_LIBS
#define TARGET_HAS_XFLOATING_LIBS 0 #define TARGET_HAS_XFLOATING_LIBS 0
#endif #endif
#ifndef TARGET_PROFILING_NEEDS_GP
#define TARGET_PROFILING_NEEDS_GP 0
#endif
/* Macro to define tables used to set the flags. /* Macro to define tables used to set the flags.
This is a list in braces of pairs in braces, This is a list in braces of pairs in braces,
......
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
;; 5 prologue_stack_probe_loop ;; 5 prologue_stack_probe_loop
;; 6 realign ;; 6 realign
;; 7 exception_receiver ;; 7 exception_receiver
;; 8 prologue_mcount
;; 9 prologue_ldgp_1
;; 10 prologue_ldgp_2
;; Processor type -- this attribute must exactly match the processor_type ;; Processor type -- this attribute must exactly match the processor_type
;; enumeration in alpha.h. ;; enumeration in alpha.h.
...@@ -5613,6 +5616,17 @@ ...@@ -5613,6 +5616,17 @@
"! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT" "! 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" (define_insn "init_fp"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(match_operand:DI 1 "register_operand" "r")) (match_operand:DI 1 "register_operand" "r"))
......
...@@ -31,11 +31,8 @@ SUB_CPP_PREDEFINES ...@@ -31,11 +31,8 @@ SUB_CPP_PREDEFINES
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}" #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. */ /* Show that we need a GP when profiling. */
#undef TARGET_PROFILING_NEEDS_GP
#define TARGET_PROFILING_NEEDS_GP 1 #define TARGET_PROFILING_NEEDS_GP 1
/* Don't care about faults in the prologue. */ /* Don't care about faults in the prologue. */
......
...@@ -28,9 +28,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -28,9 +28,6 @@ Boston, MA 02111-1307, USA. */
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}" #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. */ /* Show that we need a GP when profiling. */
#define TARGET_PROFILING_NEEDS_GP #undef TARGET_PROFILING_NEEDS_GP
#define TARGET_PROFILING_NEEDS_GP 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment