/* Default target hook functions.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
-#include "machmode.h"
+#include "target.h"
+#include "function.h"
#include "rtl.h"
#include "tree.h"
+#include "tree-ssa-alias.h"
+#include "gimple-expr.h"
+#include "tm_p.h"
+#include "stringpool.h"
+#include "tree-ssanames.h"
+#include "optabs.h"
+#include "regs.h"
+#include "recog.h"
+#include "diagnostic-core.h"
+#include "fold-const.h"
#include "stor-layout.h"
#include "varasm.h"
+#include "flags.h"
+#include "explow.h"
+#include "calls.h"
#include "expr.h"
#include "output.h"
-#include "diagnostic-core.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "vec.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "target.h"
-#include "tm_p.h"
-#include "target-def.h"
-#include "regs.h"
#include "reload.h"
-#include "insn-codes.h"
-#include "optabs.h"
-#include "recog.h"
#include "intl.h"
#include "opts.h"
-#include "tree-ssa-alias.h"
-#include "gimple-expr.h"
#include "gimplify.h"
-#include "stringpool.h"
-#include "tree-ssanames.h"
bool
return x;
}
+bool
+default_legitimize_address_displacement (rtx *disp ATTRIBUTE_UNUSED,
+ rtx *offset ATTRIBUTE_UNUSED,
+ machine_mode mode ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
rtx
default_expand_builtin_saveregs (void)
{
void
default_print_operand_address (FILE *stream ATTRIBUTE_UNUSED,
+ machine_mode /*mode*/,
rtx x ATTRIBUTE_UNUSED)
{
#ifdef PRINT_OPERAND_ADDRESS
/* Mapping of builtin functions to vectorized variants. */
tree
-default_builtin_vectorized_function (tree fndecl ATTRIBUTE_UNUSED,
- tree type_out ATTRIBUTE_UNUSED,
- tree type_in ATTRIBUTE_UNUSED)
+default_builtin_vectorized_function (unsigned int, tree, tree)
+{
+ return NULL_TREE;
+}
+
+/* Mapping of target builtin functions to vectorized variants. */
+
+tree
+default_builtin_md_vectorized_function (tree, tree, tree)
{
return NULL_TREE;
}
/* Reciprocal. */
tree
-default_builtin_reciprocal (unsigned int fn ATTRIBUTE_UNUSED,
- bool md_fn ATTRIBUTE_UNUSED,
- bool sqrt ATTRIBUTE_UNUSED)
+default_builtin_reciprocal (tree)
{
return NULL_TREE;
}
}
rtx
-default_static_chain (const_tree fndecl, bool incoming_p)
+default_static_chain (const_tree ARG_UNUSED (fndecl_or_type), bool incoming_p)
{
- if (!DECL_STATIC_CHAIN (fndecl))
- return NULL;
-
if (incoming_p)
{
#ifdef STATIC_CHAIN_INCOMING_REGNUM
return NO_REGS;
}
+reg_class_t
+default_ira_change_pseudo_allocno_class (int regno ATTRIBUTE_UNUSED,
+ reg_class_t cl,
+ reg_class_t best_cl ATTRIBUTE_UNUSED)
+{
+ return cl;
+}
+
extern bool
default_lra_p (void)
{
HOST_WIDE_INT
default_vector_alignment (const_tree type)
{
- return tree_to_shwi (TYPE_SIZE (type));
+ HOST_WIDE_INT align = tree_to_shwi (TYPE_SIZE (type));
+ if (align > MAX_OFILE_ALIGNMENT)
+ align = MAX_OFILE_ALIGNMENT;
+ return align;
}
bool
return 0;
}
+/* By defaults a vector of integers is used as a mask. */
+
+machine_mode
+default_get_mask_mode (unsigned nunits, unsigned vector_size)
+{
+ unsigned elem_size = vector_size / nunits;
+ machine_mode elem_mode
+ = smallest_mode_for_size (elem_size * BITS_PER_UNIT, MODE_INT);
+ machine_mode vector_mode;
+
+ gcc_assert (elem_size * nunits == vector_size);
+
+ vector_mode = mode_for_vector (elem_mode, nunits);
+ if (!VECTOR_MODE_P (vector_mode)
+ || !targetm.vector_mode_supported_p (vector_mode))
+ vector_mode = BLKmode;
+
+ return vector_mode;
+}
+
/* By default, the cost model accumulates three separate costs (prologue,
loop body, and epilogue) for a vectorized loop or block. So allocate an
array of three unsigned ints, set it to zero, and return its address. */
return false;
}
-/* Return the mode for a pointer to a given ADDRSPACE, defaulting to ptr_mode
- for the generic address space only. */
+/* Return the mode for a pointer to a given ADDRSPACE,
+ defaulting to ptr_mode for all address spaces. */
machine_mode
default_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
{
- gcc_assert (ADDR_SPACE_GENERIC_P (addrspace));
return ptr_mode;
}
-/* Return the mode for an address in a given ADDRSPACE, defaulting to Pmode
- for the generic address space only. */
+/* Return the mode for an address in a given ADDRSPACE,
+ defaulting to Pmode for all address spaces. */
machine_mode
default_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
{
- gcc_assert (ADDR_SPACE_GENERIC_P (addrspace));
return Pmode;
}
-/* Named address space version of valid_pointer_mode. */
+/* Named address space version of valid_pointer_mode.
+ To match the above, the same modes apply to all address spaces. */
bool
-default_addr_space_valid_pointer_mode (machine_mode mode, addr_space_t as)
+default_addr_space_valid_pointer_mode (machine_mode mode,
+ addr_space_t as ATTRIBUTE_UNUSED)
{
- if (!ADDR_SPACE_GENERIC_P (as))
- return (mode == targetm.addr_space.pointer_mode (as)
- || mode == targetm.addr_space.address_mode (as));
-
return targetm.valid_pointer_mode (mode);
}
return true;
}
-/* Named address space version of legitimate_address_p. */
+/* Named address space version of legitimate_address_p.
+ By default, all address spaces have the same form. */
bool
default_addr_space_legitimate_address_p (machine_mode mode, rtx mem,
- bool strict, addr_space_t as)
+ bool strict,
+ addr_space_t as ATTRIBUTE_UNUSED)
{
- if (!ADDR_SPACE_GENERIC_P (as))
- gcc_unreachable ();
-
return targetm.legitimate_address_p (mode, mem, strict);
}
-/* Named address space version of LEGITIMIZE_ADDRESS. */
+/* Named address space version of LEGITIMIZE_ADDRESS.
+ By default, all address spaces have the same form. */
rtx
-default_addr_space_legitimize_address (rtx x, rtx oldx,
- machine_mode mode, addr_space_t as)
+default_addr_space_legitimize_address (rtx x, rtx oldx, machine_mode mode,
+ addr_space_t as ATTRIBUTE_UNUSED)
{
- if (!ADDR_SPACE_GENERIC_P (as))
- return x;
-
return targetm.legitimize_address (x, oldx, mode);
}
return (subset == superset);
}
+/* The default hook for determining if 0 within a named address
+ space is a valid address. */
+
+bool
+default_addr_space_zero_address_valid (addr_space_t as ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+/* The default hook for debugging the address space is to return the
+ address space number to indicate DW_AT_address_class. */
+int
+default_addr_space_debug (addr_space_t as)
+{
+ return as;
+}
+
/* The default hook for TARGET_ADDR_SPACE_CONVERT. This hook should never be
called for targets with only a generic address space. */
default_target_option_pragma_parse (tree ARG_UNUSED (args),
tree ARG_UNUSED (pop_target))
{
- warning (OPT_Wpragmas,
- "#pragma GCC target is not supported for this machine");
+ /* If args is NULL the caller is handle_pragma_pop_options (). In that case,
+ emit no warning because "#pragma GCC pop_target" is valid on targets that
+ do not have the "target" pragma. */
+ if (args)
+ warning (OPT_Wpragmas,
+ "#pragma GCC target is not supported for this machine");
return false;
}
return ret;
}
-#ifndef HAVE_casesi
-# define HAVE_casesi 0
-#endif
-
/* If the machine does not have a case insn that compares the bounds,
this means extra overhead for dispatch tables, which raises the
threshold for using them. */
unsigned int
default_case_values_threshold (void)
{
- return (HAVE_casesi ? 4 : 5);
+ return (targetm.have_casesi () ? 4 : 5);
}
bool
default_have_conditional_execution (void)
{
-#ifdef HAVE_conditional_execution
return HAVE_conditional_execution;
-#else
- return false;
-#endif
}
/* By default we assume that c99 functions are present at the runtime,
}
/* For hooks which use the MOVE_RATIO macro, this gives the legacy default
- behaviour. SPEED_P is true if we are compiling for speed. */
+ behavior. SPEED_P is true if we are compiling for speed. */
-static unsigned int
+unsigned int
get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
{
unsigned int move_ratio;
a call to memcpy emitted. */
bool
-default_use_by_pieces_infrastructure_p (unsigned int size,
+default_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size,
unsigned int alignment,
enum by_pieces_operation op,
bool speed_p)
static const char *
pch_option_mismatch (const char *option)
{
- char *r;
-
- asprintf (&r, _("created and used with differing settings of '%s'"), option);
- if (r == NULL)
- return _("out of memory");
- return r;
+ return xasprintf (_("created and used with differing settings of '%s'"),
+ option);
}
/* Default version of pch_valid_p. */
unsigned HOST_WIDE_INT align, boundary;
bool indirect;
-#ifdef ARGS_GROW_DOWNWARD
/* All of the alignment and movement below is for args-grow-up machines.
As of 2004, there are only 3 ARGS_GROW_DOWNWARD targets, and they all
implement their own specialized gimplify_va_arg_expr routines. */
- gcc_unreachable ();
-#endif
+ if (ARGS_GROW_DOWNWARD)
+ gcc_unreachable ();
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
if (indirect)
if (boundary < TYPE_ALIGN (type))
{
type = build_variant_type_copy (type);
- TYPE_ALIGN (type) = boundary;
+ SET_TYPE_ALIGN (type, boundary);
}
/* Compute the rounded size of the type. */
return loop_depth == 1;
}
+/* Default implementation of TARGET_OPTAB_SUPPORTED_P. */
+
+bool
+default_optab_supported_p (int, machine_mode, machine_mode, optimization_type)
+{
+ return true;
+}
+
+/* Default implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE. */
+bool
+default_have_speculation_safe_value (bool active ATTRIBUTE_UNUSED)
+{
+#ifdef HAVE_speculation_barrier
+ return active ? HAVE_speculation_barrier : true;
+#else
+ return false;
+#endif
+}
+/* Alternative implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE
+ that can be used on targets that never have speculative execution. */
+bool
+speculation_safe_value_not_needed (bool active)
+{
+ return !active;
+}
+
+/* Default implementation of the speculation-safe-load builtin. This
+ implementation simply copies val to result and generates a
+ speculation_barrier insn, if such a pattern is defined. */
+rtx
+default_speculation_safe_value (machine_mode mode ATTRIBUTE_UNUSED,
+ rtx result, rtx val,
+ rtx failval ATTRIBUTE_UNUSED)
+{
+ emit_move_insn (result, val);
+
+#ifdef HAVE_speculation_barrier
+ /* Assume the target knows what it is doing: if it defines a
+ speculation barrier, but it is not enabled, then assume that one
+ isn't needed. */
+ if (HAVE_speculation_barrier)
+ emit_insn (gen_speculation_barrier ());
+#endif
+
+ return result;
+}
+
#include "gt-targhooks.h"