This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Modifying ARM code generator for elimination of 8bit writes - need help


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]