Commit ec35d572 by Richard Sandiford Committed by Richard Sandiford

[5/77] Small tweak to array_value_type

Store the type mode in a variable so that a later,
more mechanical patch can change its type.

2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* tree-switch-conversion.c (array_value_type): Only read TYPE_MODE
	once.  Use get_narrowest_mode instead of GET_CLASS_NARROWEST_MODE.

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

From-SVN: r251456
parent c94843d2
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* tree-switch-conversion.c (array_value_type): Only read TYPE_MODE
once. Use get_narrowest_mode instead of GET_CLASS_NARROWEST_MODE.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
......
...@@ -1037,7 +1037,6 @@ array_value_type (gswitch *swtch, tree type, int num, ...@@ -1037,7 +1037,6 @@ array_value_type (gswitch *swtch, tree type, int num,
{ {
unsigned int i, len = vec_safe_length (info->constructors[num]); unsigned int i, len = vec_safe_length (info->constructors[num]);
constructor_elt *elt; constructor_elt *elt;
machine_mode mode;
int sign = 0; int sign = 0;
tree smaller_type; tree smaller_type;
...@@ -1051,8 +1050,9 @@ array_value_type (gswitch *swtch, tree type, int num, ...@@ -1051,8 +1050,9 @@ array_value_type (gswitch *swtch, tree type, int num,
if (!INTEGRAL_TYPE_P (type)) if (!INTEGRAL_TYPE_P (type))
return type; return type;
mode = GET_CLASS_NARROWEST_MODE (GET_MODE_CLASS (TYPE_MODE (type))); machine_mode type_mode = TYPE_MODE (type);
if (GET_MODE_SIZE (TYPE_MODE (type)) <= GET_MODE_SIZE (mode)) machine_mode mode = get_narrowest_mode (type_mode);
if (GET_MODE_SIZE (type_mode) <= GET_MODE_SIZE (mode))
return type; return type;
if (len < (optimize_bb_for_size_p (gimple_bb (swtch)) ? 2 : 32)) if (len < (optimize_bb_for_size_p (gimple_bb (swtch)) ? 2 : 32))
...@@ -1090,7 +1090,7 @@ array_value_type (gswitch *swtch, tree type, int num, ...@@ -1090,7 +1090,7 @@ array_value_type (gswitch *swtch, tree type, int num,
mode = GET_MODE_WIDER_MODE (mode); mode = GET_MODE_WIDER_MODE (mode);
if (mode == VOIDmode if (mode == VOIDmode
|| GET_MODE_SIZE (mode) >= GET_MODE_SIZE (TYPE_MODE (type))) || GET_MODE_SIZE (mode) >= GET_MODE_SIZE (type_mode))
return type; return type;
} }
} }
......
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