This is the mail archive of the 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]

HARD_REGNO_MODE_OK clarification.


Although the documentation for that macro is pretty clear:
"A C expression that is nonzero if it is permissible to store a value
of mode @var{mode} in hard register number @var{regno} (or in several
registers starting with that one)."

it contradicts itself, and also isn't implemented this way in some
* It contradicts itself:
  "For a machine where all registers are equivalent, a suitable definition
  Suppose we have N register, all equivalent.  Say all are SImode wide.
  According to the above statement I could define HARD_REGNO_MODE_OK to
  1.  Nonetheless register N-1 can _not_ hold a DImode, and
  registers [N-3..N-1] can not hold TImode.  Clearly HARD_REGNO_MODE_OK
  can not simply be 1 in the light of multi hardreg modes.
* some machines don't implement it as documented:
  take e.g. x86: HARD_REGNO_MODE_OK(6, DImode) returns 1. 6 is %ebp, and 7
  is %esp, which is fixed, so there can't be a DImode value in hardreg 6.
  Granted this is taken care of, because it wouldn't try allocating 6 to a
  DImode, exactly because the next reg isn't free.  What if %esp weren't
  fixed?  Then it would also return 1 for H_R_M_O(7,DImode), which reaches
  into the floating point registers, so also there it isn't allowed.

So my, or our, question is: can we rely on the documented behaviour of
HARD_REGNO_MODE_OK(R,M), to detect if hardreg R is suitable for mode M,
given that the next HARD_REGNO_NREGS(R,M)-1 registers are free ?  Do we
need to fix some ports, for this to happen?
Especially with wider modes M, and in case R lies near a border of
different register sets (the end of register set is easy, there the other
registers are free, because non-existant, but with in-between borders...)


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