aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2005-06-17 20:45:50 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2005-06-17 20:45:50 +0000
commitd26afa4f569ccb9ac5f1331a8b75420e34210262 (patch)
tree32f8c08fbeae93d8a90581da378c193a39ca15ff /gcc
parentafca671b7852829464044338e7a3c0a7353a39e9 (diff)
downloadgcc-d26afa4f569ccb9ac5f1331a8b75420e34210262.zip
gcc-d26afa4f569ccb9ac5f1331a8b75420e34210262.tar.gz
gcc-d26afa4f569ccb9ac5f1331a8b75420e34210262.tar.bz2
re PR target/19889 (g++.old-deja/g++.law/profile1.C execution test fails on ia64-hpux)
PR target/19889 * config/ia64/hpux.h (FUNCTION_PROFILER): New (dummy). (PROFILE_HOOK): New. (PROFILE_BEFORE_PROLOGUE): Undef. (NO_PROFILE_COUNTERS): New. * config/ia64/ia64-protos.h (ia64_profile_hook): New. * config/ia64/ia64.c (ia64_compute_frame_size): Add ifdef. (gen_mcount_func_rtx): New. (ia64_profile_hook): New. * config/ia64/ia64.md (ip_value): New. From-SVN: r101134
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/ia64/hpux.h15
-rw-r--r--gcc/config/ia64/ia64-protos.h1
-rw-r--r--gcc/config/ia64/ia64.c36
-rw-r--r--gcc/config/ia64/ia64.md10
5 files changed, 75 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae8f419..c48bf43 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2005-06-17 Steve Ellcey <sje@cup.hp.com>
+
+ PR target/19889
+ * config/ia64/hpux.h (FUNCTION_PROFILER): New (dummy).
+ (PROFILE_HOOK): New.
+ (PROFILE_BEFORE_PROLOGUE): Undef.
+ (NO_PROFILE_COUNTERS): New.
+ * config/ia64/ia64-protos.h (ia64_profile_hook): New.
+ * config/ia64/ia64.c (ia64_compute_frame_size): Add ifdef.
+ (gen_mcount_func_rtx): New.
+ (ia64_profile_hook): New.
+ * config/ia64/ia64.md (ip_value): New.
+
2005-06-17 Devang Patel <dpatel@apple.com>
* config/rs6000/predicates.md (s5bit_cint_operand,
diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h
index 396094f..6423124 100644
--- a/gcc/config/ia64/hpux.h
+++ b/gcc/config/ia64/hpux.h
@@ -208,3 +208,18 @@ do { \
/* HP-UX headers are C++-compatible. */
#define NO_IMPLICIT_EXTERN_C
+
+/* HP-UX uses PROFILE_HOOK instead of FUNCTION_PROFILER but we need a
+ FUNCTION_PROFILER defined because its use is not ifdefed. When using
+ PROFILE_HOOK, the profile call comes after the prologue. */
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) do { } while (0)
+
+#undef PROFILE_HOOK
+#define PROFILE_HOOK(LABEL) ia64_profile_hook (LABEL)
+
+#undef PROFILE_BEFORE_PROLOGUE
+
+#undef NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS 0
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index 7b097bf..e3e1560 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -114,3 +114,4 @@ extern enum direction ia64_hpux_function_arg_padding (enum machine_mode, tree);
extern void ia64_hpux_handle_builtin_pragma (struct cpp_reader *);
extern void ia64_output_function_profiler (FILE *, int);
+extern void ia64_profile_hook (int);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index dc701e4..8d20992 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -2087,12 +2087,14 @@ ia64_compute_frame_size (HOST_WIDE_INT size)
break;
i = regno - OUT_REG (0) + 1;
+#ifndef PROFILE_HOOK
/* When -p profiling, we need one output register for the mcount argument.
Likewise for -a profiling for the bb_init_func argument. For -ax
profiling, we need two output registers for the two bb_init_trace_func
arguments. */
if (current_function_profile)
i = MAX (i, 1);
+#endif
current_frame_info.n_output_regs = i;
/* ??? No rotating register support yet. */
@@ -8579,4 +8581,38 @@ ia64_output_function_profiler (FILE *file, int labelno)
fputs ("\tbr.call.sptk.many b0 = _mcount\n\t;;\n", file);
}
+static GTY(()) rtx mcount_func_rtx;
+static rtx
+gen_mcount_func_rtx (void)
+{
+ if (!mcount_func_rtx)
+ mcount_func_rtx = init_one_libfunc ("_mcount");
+ return mcount_func_rtx;
+}
+
+void
+ia64_profile_hook (int labelno)
+{
+ rtx label, ip;
+
+ if (NO_PROFILE_COUNTERS)
+ label = const0_rtx;
+ else
+ {
+ char buf[30];
+ const char *label_name;
+ ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
+ label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf));
+ label = gen_rtx_SYMBOL_REF (Pmode, label_name);
+ SYMBOL_REF_FLAGS (label) = SYMBOL_FLAG_LOCAL;
+ }
+ ip = gen_reg_rtx (Pmode);
+ emit_insn (gen_ip_value (ip));
+ emit_library_call (gen_mcount_func_rtx (), LCT_NORMAL,
+ VOIDmode, 3,
+ gen_rtx_REG (Pmode, BR_REG (0)), Pmode,
+ ip, Pmode,
+ label, Pmode);
+}
+
#include "gt-ia64.h"
diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md
index 7260678..0accd96 100644
--- a/gcc/config/ia64/ia64.md
+++ b/gcc/config/ia64/ia64.md
@@ -6154,6 +6154,16 @@
"addp4 %0 = %1, %2"
[(set_attr "itanium_class" "ialu")])
+;;
+;; Get instruction pointer
+
+(define_insn "ip_value"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (pc))]
+ ""
+ "mov %0 = ip"
+ [(set_attr "itanium_class" "ialu")])
+
;; Vector operations
(include "vect.md")
;; Atomic operations