public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4727] IBM Z: Unhardcode NR_C_MODES
@ 2020-11-04 21:34 Ilya Leoshkevich
  0 siblings, 0 replies; only message in thread
From: Ilya Leoshkevich @ 2020-11-04 21:34 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6682ef4363b32977aeca590fced2221329c92c02

commit r11-4727-g6682ef4363b32977aeca590fced2221329c92c02
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Wed Oct 21 13:48:07 2020 +0200

    IBM Z: Unhardcode NR_C_MODES
    
    gcc/ChangeLog:
    
    2020-11-03  Ilya Leoshkevich  <iii@linux.ibm.com>
    
            * config/s390/s390.c (NR_C_MODES): Unhardcode.
            (s390_alloc_pool): Use size_t for iterating from 0 to
            NR_C_MODES.
            (s390_add_constant): Likewise.
            (s390_find_constant): Likewise.
            (s390_dump_pool): Likewise.
            (s390_free_pool): Likewise.

Diff:
---
 gcc/config/s390/s390.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 3c3feb2769b..b8961a315aa 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8621,8 +8621,7 @@ replace_constant_pool_ref (rtx_insn *insn, rtx ref, rtx offset)
 /* We keep a list of constants which we have to add to internal
    constant tables in the middle of large functions.  */
 
-#define NR_C_MODES 32
-machine_mode constant_modes[NR_C_MODES] =
+static machine_mode constant_modes[] =
 {
   TFmode, TImode, TDmode,
   V16QImode, V8HImode, V4SImode, V2DImode, V1TImode,
@@ -8636,6 +8635,7 @@ machine_mode constant_modes[NR_C_MODES] =
   QImode,
   V1QImode
 };
+#define NR_C_MODES (sizeof (constant_modes) / sizeof (constant_modes[0]))
 
 struct constant
 {
@@ -8664,7 +8664,7 @@ static struct constant_pool *
 s390_alloc_pool (void)
 {
   struct constant_pool *pool;
-  int i;
+  size_t i;
 
   pool = (struct constant_pool *) xmalloc (sizeof *pool);
   pool->next = NULL;
@@ -8743,7 +8743,7 @@ static void
 s390_add_constant (struct constant_pool *pool, rtx val, machine_mode mode)
 {
   struct constant *c;
-  int i;
+  size_t i;
 
   for (i = 0; i < NR_C_MODES; i++)
     if (constant_modes[i] == mode)
@@ -8788,7 +8788,7 @@ s390_find_constant (struct constant_pool *pool, rtx val,
 		    machine_mode mode)
 {
   struct constant *c;
-  int i;
+  size_t i;
 
   for (i = 0; i < NR_C_MODES; i++)
     if (constant_modes[i] == mode)
@@ -8895,7 +8895,7 @@ s390_dump_pool (struct constant_pool *pool, bool remote_label)
 {
   struct constant *c;
   rtx_insn *insn = pool->pool_insn;
-  int i;
+  size_t i;
 
   /* Switch to rodata section.  */
   insn = emit_insn_after (gen_pool_section_start (), insn);
@@ -8966,7 +8966,7 @@ static void
 s390_free_pool (struct constant_pool *pool)
 {
   struct constant *c, *next;
-  int i;
+  size_t i;
 
   for (i = 0; i < NR_C_MODES; i++)
     for (c = pool->constants[i]; c; c = next)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-04 21:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 21:34 [gcc r11-4727] IBM Z: Unhardcode NR_C_MODES Ilya Leoshkevich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).