From 1afec8ade9fceba5d24195f3d152fc701e51c835 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 16 Oct 2001 15:44:39 -0700 Subject: [PATCH] alpha.c (current_file_function_operand): Don't fail for profiling. * 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 | 11 +++++++++ gcc/config/alpha/alpha-protos.h | 1 + gcc/config/alpha/alpha.c | 33 ++++++++++++++++++++++---- gcc/config/alpha/alpha.h | 41 ++------------------------------- gcc/config/alpha/alpha.md | 22 +++++++++++++----- gcc/config/alpha/alpha32.h | 27 ---------------------- 6 files changed, 59 insertions(+), 76 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92bd5db1d3f..f645485692e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2001-10-16 Richard Henderson + + * 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 * config/i386/netbsd-elf.h (ASM_OUTPUT_ADDR_DIFF_ELT): Define. diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index 8aae90c565c..e7da7d2e980 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -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)); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 1b599540cba..48e157e2b08 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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 diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 038cb5176a9..d8e4b04a520 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -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 /* 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}}, \ diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 55f08459353..4eecb1d939f 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -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 "" "") diff --git a/gcc/config/alpha/alpha32.h b/gcc/config/alpha/alpha32.h index 8ef83330de1..bb961c2b5a5 100644 --- a/gcc/config/alpha/alpha32.h +++ b/gcc/config/alpha/alpha32.h @@ -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