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
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.
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)
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
#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,
;; 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"))
#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. */
#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