* VEC re-write [patch 18/25]
@ 2012-11-15 21:54 Diego Novillo
2012-11-15 22:48 ` Richard Sandiford
0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2012-11-15 21:54 UTC (permalink / raw)
To: rdsandiford, gcc-patches
2012-11-15 Diego Novillo <dnovillo@google.com>
Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec)
* config/mips/mips.c: Use new vec API in vec.h.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 01f6b61..ebe21a9 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -4013,11 +4013,9 @@ struct mips_multi_member {
typedef struct mips_multi_member mips_multi_member;
/* Vector definitions for the above. */
-DEF_VEC_O(mips_multi_member);
-DEF_VEC_ALLOC_O(mips_multi_member, heap);
/* The instructions that make up the current multi-insn sequence. */
-static VEC (mips_multi_member, heap) *mips_multi_members;
+static vec<mips_multi_member> mips_multi_members;
/* How many instructions (as opposed to labels) are in the current
multi-insn sequence. */
@@ -4028,7 +4026,7 @@ static unsigned int mips_multi_num_insns;
static void
mips_multi_start (void)
{
- VEC_truncate (mips_multi_member, mips_multi_members, 0);
+ mips_multi_members.truncate (0);
mips_multi_num_insns = 0;
}
@@ -4038,7 +4036,7 @@ static struct mips_multi_member *
mips_multi_add (void)
{
mips_multi_member empty;
- return VEC_safe_push (mips_multi_member, heap, mips_multi_members, empty);
+ return mips_multi_members.safe_push (empty);
}
/* Add a normal insn with the given asm format to the current multi-insn
@@ -4081,7 +4079,7 @@ mips_multi_add_label (const char *label)
static unsigned int
mips_multi_last_index (void)
{
- return VEC_length (mips_multi_member, mips_multi_members) - 1;
+ return mips_multi_members.length () - 1;
}
/* Add a copy of an existing instruction to the current multi-insn
@@ -4093,7 +4091,7 @@ mips_multi_copy_insn (unsigned int i)
struct mips_multi_member *member;
member = mips_multi_add ();
- memcpy (member, &VEC_index (mips_multi_member, mips_multi_members, i),
+ memcpy (member, &mips_multi_members[i],
sizeof (*member));
gcc_assert (!member->is_label_p);
}
@@ -4105,7 +4103,7 @@ mips_multi_copy_insn (unsigned int i)
static void
mips_multi_set_operand (unsigned int i, unsigned int op, rtx x)
{
- VEC_index (mips_multi_member, mips_multi_members, i).operands[op] = x;
+ mips_multi_members[i].operands[op] = x;
}
/* Write out the asm code for the current multi-insn sequence. */
@@ -4116,7 +4114,7 @@ mips_multi_write (void)
struct mips_multi_member *member;
unsigned int i;
- FOR_EACH_VEC_ELT (mips_multi_member, mips_multi_members, i, member)
+ FOR_EACH_VEC_ELT (mips_multi_members, i, member)
if (member->is_label_p)
fprintf (asm_out_file, "%s\n", member->format);
else
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: VEC re-write [patch 18/25]
2012-11-15 21:54 VEC re-write [patch 18/25] Diego Novillo
@ 2012-11-15 22:48 ` Richard Sandiford
2012-11-16 15:40 ` Diego Novillo
0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2012-11-15 22:48 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches
Thanks for all your work on this.
dnovillo@google.com (Diego Novillo) writes:
> * config/mips/mips.c: Use new vec API in vec.h.
Looks good to me. Just a couple of minor nits:
> @@ -4013,11 +4013,9 @@ struct mips_multi_member {
> typedef struct mips_multi_member mips_multi_member;
>
> /* Vector definitions for the above. */
> -DEF_VEC_O(mips_multi_member);
> -DEF_VEC_ALLOC_O(mips_multi_member, heap);
Please delete the comment too.
> @@ -4093,7 +4091,7 @@ mips_multi_copy_insn (unsigned int i)
> struct mips_multi_member *member;
>
> member = mips_multi_add ();
> - memcpy (member, &VEC_index (mips_multi_member, mips_multi_members, i),
> + memcpy (member, &mips_multi_members[i],
> sizeof (*member));
> gcc_assert (!member->is_label_p);
> }
This call now fits comfortably onto one line.
Doesn't need a retest, obviously. :-)
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: VEC re-write [patch 18/25]
2012-11-15 22:48 ` Richard Sandiford
@ 2012-11-16 15:40 ` Diego Novillo
0 siblings, 0 replies; 3+ messages in thread
From: Diego Novillo @ 2012-11-16 15:40 UTC (permalink / raw)
To: Diego Novillo, gcc-patches, rdsandiford
On Thu, Nov 15, 2012 at 5:48 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
>> @@ -4013,11 +4013,9 @@ struct mips_multi_member {
>> typedef struct mips_multi_member mips_multi_member;
>>
>> /* Vector definitions for the above. */
>> -DEF_VEC_O(mips_multi_member);
>> -DEF_VEC_ALLOC_O(mips_multi_member, heap);
>
> Please delete the comment too.
Done.
>
>> @@ -4093,7 +4091,7 @@ mips_multi_copy_insn (unsigned int i)
>> struct mips_multi_member *member;
>>
>> member = mips_multi_add ();
>> - memcpy (member, &VEC_index (mips_multi_member, mips_multi_members, i),
>> + memcpy (member, &mips_multi_members[i],
>> sizeof (*member));
>> gcc_assert (!member->is_label_p);
>> }
>
> This call now fits comfortably onto one line.
Done.
Diego.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-16 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 21:54 VEC re-write [patch 18/25] Diego Novillo
2012-11-15 22:48 ` Richard Sandiford
2012-11-16 15:40 ` Diego Novillo
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).