alpha.c (current_file_function_operand): Don't fail for profiling.
authorRichard Henderson <rth@redhat.com>
Tue, 16 Oct 2001 22:44:39 +0000 (15:44 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 16 Oct 2001 22:44:39 +0000 (15:44 -0700)
        * alpha.c (current_file_function_operand): Don't fail for profiling.
        (direct_call_operand): New.
        * alpha-protos.h: Declare it.
        * alpha.h (EXTRA_CONSTRAINT): Use it.
        (PREDICATE_CODES): Add it.
        (ASM_OUTPUT_MI_THUNK): Remove.
        * alpha32.h (ASM_OUTPUT_MI_THUNK): Remove.
        * alpha.md (sibcall_osf_1, sibcall_value_osf_1): Add 's' alternative.

From-SVN: r46299

gcc/ChangeLog
gcc/config/alpha/alpha-protos.h
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/alpha/alpha.md
gcc/config/alpha/alpha32.h

index 92bd5db1d3f80f4b7a8bb1b1a54fadca3830d0e0..f645485692e0f3a8d43f83fa1879cb3a460291ef 100644 (file)
@@ -1,3 +1,14 @@
+2001-10-16  Richard Henderson  <rth@redhat.com>
+
+       * alpha.c (current_file_function_operand): Don't fail for profiling.
+       (direct_call_operand): New.
+       * alpha-protos.h: Declare it.
+       * alpha.h (EXTRA_CONSTRAINT): Use it.
+       (PREDICATE_CODES): Add it.
+       (ASM_OUTPUT_MI_THUNK): Remove.
+       * alpha32.h (ASM_OUTPUT_MI_THUNK): Remove.
+       * alpha.md (sibcall_osf_1, sibcall_value_osf_1): Add 's' alternative.
+
 2001-10-16  Krister Walfridsson  <cato@df.lth.se>
  
        * config/i386/netbsd-elf.h (ASM_OUTPUT_ADDR_DIFF_ELT): Define.
index 8aae90c565c82a99705373cbd5d223786f3a4234..e7da7d2e9805aba1818689da7c507a3346359d0b 100644 (file)
@@ -56,6 +56,7 @@ extern int some_operand PARAMS ((rtx, enum machine_mode));
 extern int some_ni_operand PARAMS ((rtx, enum machine_mode));
 extern int input_operand PARAMS ((rtx, enum machine_mode));
 extern int current_file_function_operand PARAMS ((rtx, enum machine_mode));
+extern int direct_call_operand PARAMS ((rtx, enum machine_mode));
 extern int local_symbolic_operand PARAMS ((rtx, enum machine_mode));
 extern int small_symbolic_operand PARAMS ((rtx, enum machine_mode));
 extern int global_symbolic_operand PARAMS ((rtx, enum machine_mode));
index 1b599540cbafb53b6a882b3cf909df63c78543f0..48e157e2b088b3928b84b1adbc77a9166d229a96 100644 (file)
@@ -839,10 +839,35 @@ current_file_function_operand (op, mode)
      rtx op;
      enum machine_mode mode ATTRIBUTE_UNUSED;
 {
-  return (GET_CODE (op) == SYMBOL_REF
-         && ! profile_flag && ! profile_block_flag
-         && (SYMBOL_REF_FLAG (op)
-             || op == XEXP (DECL_RTL (current_function_decl), 0)));
+  if (GET_CODE (op) != SYMBOL_REF)
+    return 0;
+
+  if (! SYMBOL_REF_FLAG (op)
+      && op != XEXP (DECL_RTL (current_function_decl), 0))
+    return 0;
+
+  return 1;
+}
+
+/* Return 1 if OP is a SYMBOL_REF for which we can make a call via bsr.  */
+
+int
+direct_call_operand (op, mode)
+     rtx op;
+     enum machine_mode mode;
+{
+  /* Must be defined in this file.  */
+  if (! current_file_function_operand (op, mode))
+    return 0;
+
+  /* If profiling is implemented via linker tricks, we can't jump
+     to the nogp alternate entry point.  */
+  /* ??? TARGET_PROFILING_NEEDS_GP isn't really the right test,
+     but is approximately correct for the OSF ABIs.  Don't know
+     what to do for VMS, NT, or UMK.  */
+  if (! TARGET_PROFILING_NEEDS_GP
+      && ! profile_flag && ! profile_block_flag)
+    return 0;
 }
 
 /* Return true if OP is a LABEL_REF, or SYMBOL_REF or CONST referencing
index 038cb5176a9c447a2550f0a31a873718ffc499a4..d8e4b04a520c7296b015d80ee107eff1a8300cec 100644 (file)
@@ -824,7 +824,7 @@ enum reg_class { NO_REGS, PV_REG, GENERAL_REGS, FLOAT_REGS, ALL_REGS,
 
 #define EXTRA_CONSTRAINT(OP, C)                                \
   ((C) == 'Q' ? normal_memory_operand (OP, VOIDmode)                   \
-   : (C) == 'R' ? current_file_function_operand (OP, Pmode)            \
+   : (C) == 'R' ? direct_call_operand (OP, Pmode)              \
    : (C) == 'S' ? (GET_CODE (OP) == CONST_INT                          \
                   && (unsigned HOST_WIDE_INT) INTVAL (OP) < 64)        \
    : (C) == 'T' ? GET_CODE (OP) == HIGH                                        \
@@ -2093,44 +2093,6 @@ do {                                             \
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),   \
   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
-   Used for C++ multiple inheritance.  */
-/* ??? This is only used with the v2 ABI, and alpha.c makes assumptions
-   about current_function_is_thunk that are not valid with the v3 ABI.  */
-#if 0
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)       \
-do {                                                                   \
-  const char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0);       \
-  int reg;                                                             \
-                                                                       \
-  if (TARGET_ABI_OSF)                                                  \
-    fprintf (FILE, "\tldgp $29,0($27)\n");                             \
-                                                                       \
-  /* Mark end of prologue.  */                                         \
-  output_end_prologue (FILE);                                          \
-                                                                       \
-  /* Rely on the assembler to macro expand a large delta.  */          \
-  fprintf (FILE, "\t.set at\n");                                       \
-  reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16;        \
-  fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg);     \
-                                                                       \
-  if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0),    \
-                                    VOIDmode))                         \
-    {                                                                  \
-      fprintf (FILE, "\tbr $31,$");                                    \
-      assemble_name (FILE, fn_name);                                   \
-      fprintf (FILE, "..ng\n");                                                \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      fprintf (FILE, "\tjmp $31,");                                    \
-      assemble_name (FILE, fn_name);                                   \
-      fputc ('\n', FILE);                                              \
-    }                                                                  \
-  fprintf (FILE, "\t.set noat\n");                                     \
-} while (0)
-#endif
 \f
 
 /* Print operand X (an rtx) in assembler syntax to file FILE.
@@ -2188,6 +2150,7 @@ do {                                                                      \
   {"divmod_operator", {DIV, MOD, UDIV, UMOD}},                         \
   {"fp0_operand", {CONST_DOUBLE}},                                     \
   {"current_file_function_operand", {SYMBOL_REF}},                     \
+  {"direct_call_operand", {SYMBOL_REF}},                               \
   {"local_symbolic_operand", {SYMBOL_REF, CONST, LABEL_REF}},          \
   {"small_symbolic_operand", {SYMBOL_REF, CONST}},                     \
   {"global_symbolic_operand", {SYMBOL_REF, CONST}},                    \
index 55f084593533f8bd147904ecad839e7090ebaa25..4eecb1d939f96b5466b429b1cc931a30e532e858 100644 (file)
@@ -4848,13 +4848,18 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
   [(set_attr "type" "jsr")
    (set_attr "length" "12,*,16")])
 
+;; Need 's' alternative for OSF/1, which implements profiling
+;; via linker tricks.
 (define_insn "*sibcall_osf_1"
-  [(call (mem:DI (match_operand:DI 0 "current_file_function_operand" "R"))
+  [(call (mem:DI (match_operand:DI 0 "current_file_function_operand" "R,s"))
         (match_operand 1 "" ""))
    (use (reg:DI 29))]
   "TARGET_ABI_OSF"
-  "br $31,$%0..ng"
-  [(set_attr "type" "jsr")])
+  "@
+   br $31,$%0..ng
+   jmp $31,%0"
+  [(set_attr "type" "jsr")
+   (set_attr "length" "*,8")])
 
 (define_insn "*call_nt_1"
   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
@@ -6802,14 +6807,19 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
   [(set_attr "type" "jsr")
    (set_attr "length" "12,*,16")])
 
+;; Need 's' alternative for OSF/1, which implements profiling
+;; via linker tricks.
 (define_insn "*sibcall_value_osf_1"
   [(set (match_operand 0 "" "")
-       (call (mem:DI (match_operand:DI 1 "current_file_function_operand" "R"))
+       (call (mem:DI (match_operand:DI 1 "current_file_function_operand" "R,s"))
              (match_operand 2 "" "")))
    (use (reg:DI 29))]
   "TARGET_ABI_OSF"
-  "br $31,$%1..ng"
-  [(set_attr "type" "jsr")])
+  "@
+   br $31,$%1..ng
+   jmp $31,%1"
+  [(set_attr "type" "jsr")
+   (set_attr "length" "*,8")])
 
 (define_insn "*call_value_nt_1"
   [(set (match_operand 0 "" "")
index 8ef83330de179fa7003f6020d382e4e08404411e..bb961c2b5a558893db4812cb7d9de9423e5b5676 100644 (file)
@@ -78,30 +78,3 @@ Boston, MA 02111-1307, USA.  */
 #undef INITIALIZE_TRAMPOLINE
 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
   alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12)
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
-   Used for C++ multiple inheritance.  */
-/* ??? This is only used with the v2 ABI, and alpha.c makes assumptions
-   about current_function_is_thunk that are not valid with the v3 ABI.  */
-#if 0
-#undef ASM_OUTPUT_MI_THUNK
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)       \
-do {                                                                   \
-  const char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0);  \
-  int reg;                                                             \
-                                                                       \
-  /* Mark end of prologue.  */                                         \
-  output_end_prologue (FILE);                                          \
-                                                                       \
-  /* Rely on the assembler to macro expand a large delta.  */          \
-  reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \
-  fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg);      \
-                                                                       \
-  op = "jsr";                                                          \
-  if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0)))   \
-    op = "br";                                                         \
-  fprintf (FILE, "\t%s $31,", op);                                     \
-  assemble_name (FILE, fn_name);                                       \
-  fputc ('\n', FILE);                                                  \
-} while (0)
-#endif