From: Ilya Leoshkevich <iii@linux.ibm.com>
To: krebbel@linux.ibm.com
Cc: gcc-patches@gcc.gnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 2/4] IBM Z: Unhardcode NR_C_MODES
Date: Tue, 3 Nov 2020 22:45:09 +0100 [thread overview]
Message-ID: <20201103214509.1877595-1-iii@linux.ibm.com> (raw)
In-Reply-To: <20201103213637.1876906-1-iii@linux.ibm.com>
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.
---
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)
--
2.25.4
next prev parent reply other threads:[~2020-11-03 21:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 21:36 [PATCH 0/4] IBM Z: Store long doubles in vector registers when possible Ilya Leoshkevich
2020-11-03 21:36 ` [PATCH 1/4] IBM Z: Remove unused RRe and RXe mode_attrs Ilya Leoshkevich
2020-11-04 17:14 ` Andreas Krebbel
2020-11-03 21:45 ` Ilya Leoshkevich [this message]
2020-11-04 17:14 ` [PATCH 2/4] IBM Z: Unhardcode NR_C_MODES Andreas Krebbel
2020-11-03 21:45 ` [PATCH 3/4] IBM Z: Store long doubles in vector registers when possible Ilya Leoshkevich
2020-11-04 17:16 ` Andreas Krebbel
2020-11-04 22:12 ` Ilya Leoshkevich
2020-11-05 7:26 ` Andreas Krebbel
2020-11-03 21:46 ` [PATCH 4/4] IBM Z: Test long doubles in vector registers Ilya Leoshkevich
2020-11-04 17:28 ` Andreas Krebbel
2020-11-04 22:19 ` Ilya Leoshkevich
2020-11-05 7:28 ` Andreas Krebbel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201103214509.1877595-1-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).