aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-11-01 12:52:50 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-11-01 12:52:50 +0000
commitb3ad445f853ab7ca0da6216ff1bebfd6f90425f5 (patch)
tree577e5328d9d178838c8eb7f7463fb071697131b4 /gcc/rtl.h
parent4b926feae10ecec6555dca641c03a8239a824eab (diff)
downloadgcc-b3ad445f853ab7ca0da6216ff1bebfd6f90425f5.zip
gcc-b3ad445f853ab7ca0da6216ff1bebfd6f90425f5.tar.gz
gcc-b3ad445f853ab7ca0da6216ff1bebfd6f90425f5.tar.bz2
Add narrower_subreg_mode helper function
This patch adds a narrowing equivalent of wider_subreg_mode. At present there is only one user. 2017-11-01 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (narrower_subreg_mode): New function. * ira-color.c (update_costs_from_allocno): Use it. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r254304
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r--gcc/rtl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 53635a2..8de5a1c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2955,6 +2955,16 @@ subreg_lowpart_offset (machine_mode outermode, machine_mode innermode)
}
/* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
+ return the smaller of the two modes if they are different sizes,
+ otherwise return the outer mode. */
+
+inline machine_mode
+narrower_subreg_mode (machine_mode outermode, machine_mode innermode)
+{
+ return paradoxical_subreg_p (outermode, innermode) ? innermode : outermode;
+}
+
+/* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
return the mode that is big enough to hold both the outer and inner
values. Prefer the outer mode in the event of a tie. */