From d26afa4f569ccb9ac5f1331a8b75420e34210262 Mon Sep 17 00:00:00 2001 From: Steve Ellcey Date: Fri, 17 Jun 2005 20:45:50 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/ia64/hpux.h | 15 +++++++++++++++ gcc/config/ia64/ia64-protos.h | 1 + gcc/config/ia64/ia64.c | 36 +++++++++++++++++++++++++++++++++++ gcc/config/ia64/ia64.md | 10 ++++++++++ 5 files changed, 75 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae8f419a343..c48bf43f7ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2005-06-17 Steve Ellcey + + 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 * config/rs6000/predicates.md (s5bit_cint_operand, diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index 396094fc668..6423124bb9f 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 7b097bf56c4..e3e1560e559 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 dc701e4dc58..8d209922271 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 7260678504b..0accd960399 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 -- 2.30.2