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]

Re: dangerous cleverness? ppc int<->float conversions, subreg


On Oct 25, 2001, Zack Weinberg <zack@codesourcery.com> wrote:

> I'm currently thinking of setting a flag somewhere that says "this
> function uses floating point", and having HARD_REGNO_MODE_OK look at
> that as well as the global flag_implicit_fp.

I don't think setting HARD_REGNO_MODE_OK is going to be enough.  I
think this won't affect the choice of register class, and will end up
resulting in GCC committing to the FP class before realizing no
hardware register in that class is going to be usable.


As for setting a flag, it may be easy enough to add a hook before
register allocation, such that you can scan the insn stream looking
for insns with a certain attribute, that marks insns requiring FP.  If
you don't find any such insn, you may set a variable that would cause
every insn that may reference FP regs (that should contain this
variable in its condition test) to decay to another insn that does not
reference FP regs.  You may have to reset the insn codes of those
insns, so that they're re-recognized, after this scan.

The code would be something like this:

(define_insn "requires_fp"
  (match_operand:SF 0 "floating_point_operand" "=f")
  "! disable_floating_point /* Just for safety.  */"
  ""
  [(set_attr "fp_needed" "yes")])

(define_insn "may_use_fp"
  (match_operand:SI 0 "" "=rf")
  "! disable_floating_point"
  ""
  [(set_attr "fp_usable" "yes")])

(define_insn "dont_use_fp"
  (match_operand:SI 0 "" "=r")
  "disable_floating_point")

If the scan doesdn't find any insn with fp_needed set, it would set
disable_floating_point to 1 and then look for insns with the fp_usable
attribute and reset their memoized codes.


I don't see how to do this in a platform-independent way.  For one,
there's no platform-independent concept of FP regs, and some
architectures have register classes with both GP and FP regs (besides
ALL_REGS).

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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