summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/alpha/alpha.c11
-rw-r--r--gcc/config/alpha/alpha.h3
-rw-r--r--gcc/config/alpha/alpha.md14
-rw-r--r--gcc/config/alpha/linux.h5
-rw-r--r--gcc/config/alpha/netbsd.h7
6 files changed, 39 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 461423fcdf4..cff7b963bb7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index ed708788d7c..f70e889bac8 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -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
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index a362bb86c74..ad59214ff18 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -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,
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index dfef1506b08..0866be524a1 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -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
;; Processor type -- this attribute must exactly match the processor_type
;; enumeration in alpha.h.
@@ -5613,6 +5616,17 @@
"! 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"))
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index 8858eb6be51..9969cc6279f 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -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. */
diff --git a/gcc/config/alpha/netbsd.h b/gcc/config/alpha/netbsd.h
index 15dcadb00ef..0a10f5ae0dc 100644
--- a/gcc/config/alpha/netbsd.h
+++ b/gcc/config/alpha/netbsd.h
@@ -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