This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Modifying ARM code generator for elimination of 8bit writes - need help
- From: Ian Lance Taylor <iant at google dot com>
- To: "Dave Korn" <dave dot korn at artimi dot com>
- Cc: 'Wolfgang MÃes' <wolfgang at iksw-muees dot de>, "'Rask Ingemann Lambertsen'" <rask at sygehus dot dk>, <gcc at gcc dot gnu dot org>
- Date: 20 Jul 2006 08:25:06 -0700
- Subject: Re: Modifying ARM code generator for elimination of 8bit writes - need help
- References: <02d201c6abec$54fb6170$a501a8c0@CAM.ARTIMI.COM>
"Dave Korn" <dave.korn@artimi.com> writes:
> Is there any generic advice available as to when and why one should use
> emit_insn (gen_rtx_SET (....)) as opposed to emit_move_insn (...)?
It depends on where you are in the compiler. You can only use
gen_rtx_SET if you know that the resulting insn will be recognized. I
think it is usually cleaner to use gen_INSNNAME, but in some cases
that is inconvenient because there are different possible insns
involved (depending on processor type, etc.).
emit_move_insn should be used to move values around. The middle end
only calls gen_rtx_SET if it is going to then call recog to make sure
the result is valid.
> (There are other similar pairs of functions with seemingly overlapping
> functionality that I find equally confusing. For instance, I *think* that you
> should only use gen_rtx_REG when you want to create a new pseudo, and that in
> the general case of wanting an rtx that refers to an existing pseudo or a hard
> reg you're supposed to use gen_reg_rtx which takes care of sharing and
> everything for you... but I haven't seen any solid documentation that backs up
> my hypothesis.)
You should normally use gen_reg_rtx to create a new pseudo-register.
gen_rtx_REG is normally used to create a reference to a hard register.
Using gen_rtx_REG to refer to an existing pseudo-register will
normally do the wrong thing. If there is any code which does that, it
needs a very hard look.
Ian