diff options
Diffstat (limited to 'gcc/config/alpha/alpha.c')
-rw-r--r-- | gcc/config/alpha/alpha.c | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index df4cc1b1c91..77ba003add5 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-expr.h" #include "is-a.h" #include "gimple.h" +#include "gimple-iterator.h" #include "gimplify.h" #include "gimple-ssa.h" #include "stringpool.h" @@ -72,6 +73,7 @@ along with GCC; see the file COPYING3. If not see #include "libfuncs.h" #include "opts.h" #include "params.h" +#include "builtins.h" /* Specify which cpu to schedule for. */ enum processor_type alpha_tune; @@ -4747,7 +4749,7 @@ struct GTY(()) machine_function static struct machine_function * alpha_init_machine_status (void) { - return ggc_alloc_cleared_machine_function (); + return ggc_cleared_alloc<machine_function> (); } /* Support for frame based VMS condition handlers. */ @@ -5449,22 +5451,23 @@ print_operand_address (FILE *file, rtx addr) offset = INTVAL (addr); break; -#if TARGET_ABI_OPEN_VMS case SYMBOL_REF: + gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands); fprintf (file, "%s", XSTR (addr, 0)); return; case CONST: + gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands); gcc_assert (GET_CODE (XEXP (addr, 0)) == PLUS && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF); fprintf (file, "%s+" HOST_WIDE_INT_PRINT_DEC, XSTR (XEXP (XEXP (addr, 0), 0), 0), INTVAL (XEXP (XEXP (addr, 0), 1))); return; - -#endif + default: - gcc_unreachable (); + output_operand_lossage ("invalid operand address"); + return; } fprintf (file, HOST_WIDE_INT_PRINT_DEC "($%d)", offset, basereg); @@ -7042,9 +7045,6 @@ alpha_fold_builtin (tree fndecl, int n_args, tree *op, case ALPHA_BUILTIN_MSKQH: return alpha_fold_builtin_mskxx (op, opint, op_const, 0xff, true); - case ALPHA_BUILTIN_UMULH: - return fold_build2 (MULT_HIGHPART_EXPR, alpha_dimode_u, op[0], op[1]); - case ALPHA_BUILTIN_ZAP: opint[1] ^= 0xff; /* FALLTHRU */ @@ -7094,6 +7094,49 @@ alpha_fold_builtin (tree fndecl, int n_args, tree *op, return NULL; } } + +bool +alpha_gimple_fold_builtin (gimple_stmt_iterator *gsi) +{ + bool changed = false; + gimple stmt = gsi_stmt (*gsi); + tree call = gimple_call_fn (stmt); + gimple new_stmt = NULL; + + if (call) + { + tree fndecl = gimple_call_fndecl (stmt); + + if (fndecl) + { + tree arg0, arg1; + + switch (DECL_FUNCTION_CODE (fndecl)) + { + case ALPHA_BUILTIN_UMULH: + arg0 = gimple_call_arg (stmt, 0); + arg1 = gimple_call_arg (stmt, 1); + + new_stmt + = gimple_build_assign_with_ops (MULT_HIGHPART_EXPR, + gimple_call_lhs (stmt), + arg0, + arg1); + break; + default: + break; + } + } + } + + if (new_stmt) + { + gsi_replace (gsi, new_stmt, true); + changed = true; + } + + return changed; +} /* This page contains routines that are used to determine what the function prologue and epilogue code will do and write them out. */ @@ -9535,7 +9578,7 @@ alpha_use_linkage (rtx func, bool lflag, bool rflag) linksym = (char *) alloca (buf_len); snprintf (linksym, buf_len, "$%d..%s..lk", cfun->funcdef_no, name); - al = ggc_alloc_alpha_links (); + al = ggc_alloc<alpha_links> (); al->func = func; al->linkage = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (linksym)); @@ -9790,6 +9833,8 @@ alpha_canonicalize_comparison (int *code, rtx *op0, rtx *op1, #define TARGET_EXPAND_BUILTIN alpha_expand_builtin #undef TARGET_FOLD_BUILTIN #define TARGET_FOLD_BUILTIN alpha_fold_builtin +#undef TARGET_GIMPLE_FOLD_BUILTIN +#define TARGET_GIMPLE_FOLD_BUILTIN alpha_gimple_fold_builtin #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL alpha_function_ok_for_sibcall |