Commit b660eccf by Richard Sandiford Committed by Richard Sandiford

Add a fixed_size_mode_pod class

This patch adds a POD version of fixed_size_mode.  The only current use
is for storing the __builtin_apply and __builtin_result register modes,
which were made fixed_size_modes by the previous patch.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* coretypes.h (fixed_size_mode): Declare.
	(fixed_size_mode_pod): New typedef.
	* builtins.h (target_builtins::x_apply_args_mode)
	(target_builtins::x_apply_result_mode): Change type to
	fixed_size_mode_pod.
	* builtins.c (apply_args_size, apply_result_size, result_vector)
	(expand_builtin_apply_args_1, expand_builtin_apply)
	(expand_builtin_return): Update accordingly.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r256193
parent 16c78b66
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* coretypes.h (fixed_size_mode): Declare.
(fixed_size_mode_pod): New typedef.
* builtins.h (target_builtins::x_apply_args_mode)
(target_builtins::x_apply_result_mode): Change type to
fixed_size_mode_pod.
* builtins.c (apply_args_size, apply_result_size, result_vector)
(expand_builtin_apply_args_1, expand_builtin_apply)
(expand_builtin_return): Update accordingly.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
* cse.c (hash_rtx_cb): Hash only the encoded elements. * cse.c (hash_rtx_cb): Hash only the encoded elements.
* cselib.c (cselib_hash_rtx): Likewise. * cselib.c (cselib_hash_rtx): Likewise.
......
...@@ -1364,7 +1364,6 @@ apply_args_size (void) ...@@ -1364,7 +1364,6 @@ apply_args_size (void)
static int size = -1; static int size = -1;
int align; int align;
unsigned int regno; unsigned int regno;
machine_mode mode;
/* The values computed by this function never change. */ /* The values computed by this function never change. */
if (size < 0) if (size < 0)
...@@ -1380,7 +1379,7 @@ apply_args_size (void) ...@@ -1380,7 +1379,7 @@ apply_args_size (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (FUNCTION_ARG_REGNO_P (regno)) if (FUNCTION_ARG_REGNO_P (regno))
{ {
mode = targetm.calls.get_raw_arg_mode (regno); fixed_size_mode mode = targetm.calls.get_raw_arg_mode (regno);
gcc_assert (mode != VOIDmode); gcc_assert (mode != VOIDmode);
...@@ -1392,7 +1391,7 @@ apply_args_size (void) ...@@ -1392,7 +1391,7 @@ apply_args_size (void)
} }
else else
{ {
apply_args_mode[regno] = VOIDmode; apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
} }
} }
return size; return size;
...@@ -1406,7 +1405,6 @@ apply_result_size (void) ...@@ -1406,7 +1405,6 @@ apply_result_size (void)
{ {
static int size = -1; static int size = -1;
int align, regno; int align, regno;
machine_mode mode;
/* The values computed by this function never change. */ /* The values computed by this function never change. */
if (size < 0) if (size < 0)
...@@ -1416,7 +1414,7 @@ apply_result_size (void) ...@@ -1416,7 +1414,7 @@ apply_result_size (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (targetm.calls.function_value_regno_p (regno)) if (targetm.calls.function_value_regno_p (regno))
{ {
mode = targetm.calls.get_raw_result_mode (regno); fixed_size_mode mode = targetm.calls.get_raw_result_mode (regno);
gcc_assert (mode != VOIDmode); gcc_assert (mode != VOIDmode);
...@@ -1427,7 +1425,7 @@ apply_result_size (void) ...@@ -1427,7 +1425,7 @@ apply_result_size (void)
apply_result_mode[regno] = mode; apply_result_mode[regno] = mode;
} }
else else
apply_result_mode[regno] = VOIDmode; apply_result_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
/* Allow targets that use untyped_call and untyped_return to override /* Allow targets that use untyped_call and untyped_return to override
the size so that machine-specific information can be stored here. */ the size so that machine-specific information can be stored here. */
...@@ -1446,7 +1444,7 @@ static rtx ...@@ -1446,7 +1444,7 @@ static rtx
result_vector (int savep, rtx result) result_vector (int savep, rtx result)
{ {
int regno, size, align, nelts; int regno, size, align, nelts;
machine_mode mode; fixed_size_mode mode;
rtx reg, mem; rtx reg, mem;
rtx *savevec = XALLOCAVEC (rtx, FIRST_PSEUDO_REGISTER); rtx *savevec = XALLOCAVEC (rtx, FIRST_PSEUDO_REGISTER);
...@@ -1475,7 +1473,7 @@ expand_builtin_apply_args_1 (void) ...@@ -1475,7 +1473,7 @@ expand_builtin_apply_args_1 (void)
{ {
rtx registers, tem; rtx registers, tem;
int size, align, regno; int size, align, regno;
machine_mode mode; fixed_size_mode mode;
rtx struct_incoming_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 1); rtx struct_incoming_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 1);
/* Create a block where the arg-pointer, structure value address, /* Create a block where the arg-pointer, structure value address,
...@@ -1579,7 +1577,7 @@ static rtx ...@@ -1579,7 +1577,7 @@ static rtx
expand_builtin_apply (rtx function, rtx arguments, rtx argsize) expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
{ {
int size, align, regno; int size, align, regno;
machine_mode mode; fixed_size_mode mode;
rtx incoming_args, result, reg, dest, src; rtx incoming_args, result, reg, dest, src;
rtx_call_insn *call_insn; rtx_call_insn *call_insn;
rtx old_stack_level = 0; rtx old_stack_level = 0;
...@@ -1740,7 +1738,7 @@ static void ...@@ -1740,7 +1738,7 @@ static void
expand_builtin_return (rtx result) expand_builtin_return (rtx result)
{ {
int size, align, regno; int size, align, regno;
machine_mode mode; fixed_size_mode mode;
rtx reg; rtx reg;
rtx_insn *call_fusage = 0; rtx_insn *call_fusage = 0;
......
...@@ -29,14 +29,14 @@ struct target_builtins { ...@@ -29,14 +29,14 @@ struct target_builtins {
the register is not used for calling a function. If the machine the register is not used for calling a function. If the machine
has register windows, this gives only the outbound registers. has register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */ INCOMING_REGNO gives the corresponding inbound register. */
machine_mode x_apply_args_mode[FIRST_PSEUDO_REGISTER]; fixed_size_mode_pod x_apply_args_mode[FIRST_PSEUDO_REGISTER];
/* For each register that may be used for returning values, this gives /* For each register that may be used for returning values, this gives
a mode used to copy the register's value. VOIDmode indicates the a mode used to copy the register's value. VOIDmode indicates the
register is not used for returning values. If the machine has register is not used for returning values. If the machine has
register windows, this gives only the outbound registers. register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */ INCOMING_REGNO gives the corresponding inbound register. */
machine_mode x_apply_result_mode[FIRST_PSEUDO_REGISTER]; fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
}; };
extern struct target_builtins default_target_builtins; extern struct target_builtins default_target_builtins;
......
...@@ -59,6 +59,7 @@ class scalar_mode; ...@@ -59,6 +59,7 @@ class scalar_mode;
class scalar_int_mode; class scalar_int_mode;
class scalar_float_mode; class scalar_float_mode;
class complex_mode; class complex_mode;
class fixed_size_mode;
template<typename> class opt_mode; template<typename> class opt_mode;
typedef opt_mode<scalar_mode> opt_scalar_mode; typedef opt_mode<scalar_mode> opt_scalar_mode;
typedef opt_mode<scalar_int_mode> opt_scalar_int_mode; typedef opt_mode<scalar_int_mode> opt_scalar_int_mode;
...@@ -66,6 +67,7 @@ typedef opt_mode<scalar_float_mode> opt_scalar_float_mode; ...@@ -66,6 +67,7 @@ typedef opt_mode<scalar_float_mode> opt_scalar_float_mode;
template<typename> class pod_mode; template<typename> class pod_mode;
typedef pod_mode<scalar_mode> scalar_mode_pod; typedef pod_mode<scalar_mode> scalar_mode_pod;
typedef pod_mode<scalar_int_mode> scalar_int_mode_pod; typedef pod_mode<scalar_int_mode> scalar_int_mode_pod;
typedef pod_mode<fixed_size_mode> fixed_size_mode_pod;
/* Subclasses of rtx_def, using indentation to show the class /* Subclasses of rtx_def, using indentation to show the class
hierarchy, along with the relevant invariant. hierarchy, along with the relevant invariant.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment