This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Hashing regs and subregs
- From: Ian Lance Taylor <iant at google dot com>
- To: "Paulo J. Matos" <paulo at matos-sorge dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 19 Jan 2012 12:15:05 -0800
- Subject: Re: Hashing regs and subregs
- References: <jf93ec$57d$1@dough.gmane.org>
"Paulo J. Matos" <paulo@matos-sorge.com> writes:
> I am developing a new pass and looking for suggestions on the best way
> to record in a data structure which regs and subregs I have seen and
> which mode they are in through the insn chain so I know if I find
> duplicates.
>
> Any suggestions on the best way to do this?
> Are there any rtx hashes already implemented somewhere?
Note that pseudo-regs always have the same mode. Hard regs and subregs
do not.
There are lots of ways to record regs and subregs. There is nothing
very wrong with allocate a VEC of size max_reg_num (). Plenty of passes
do that.
If you really want a hash table, you can use iterative_hash_rtx to get
the hash code. Just pass 0 as the hash argument.
Ian