> No, the ISO C standard is clear that the value of an uninitialized
> variable is indeterminate.  It may be a trap representation, or it may
> be an unspecified value.  In the latter case it must have the correct
> type.  But there is no other restriction on it, and the standard
> specifically says (3.17.3) it "imposes no requirements on which value
> is chosen in any instance."

Ok, then I believe that the register selection by reload might be
improved.  I see the following assembler code at -O2 for this test
program on hppa-unknow-linux-gnu:

extern int bar (int);
int
foo (void)
{
  int x;

  bar (x);
  return x;
}

        stw %r2,-20(%r30)
        copy %r3,%r26
        bl bar,%r2
        stwm %r3,64(%r30)
        ldw -84(%r30),%r2
        copy %r3,%r28
        bv %r0(%r2)
        ldwm -64(%r30),%r3

Reload instantiates the uninitialized value of 'x' using register
'r3'.  Register 'r3' is a callee saves register on the PA.  As a
result, the prologue and epilogue of foo save and restore 'r3'.
Thus, the code isn't as optimal as it might be.

It would be better if uninitialized values were instantiated using
call-clobbered registers.  Even better, choosing the destination
register in the "copy" instructions would allow the instructions
to be deleted.

For those that like as much determinism as possible, it would be
better to instantiate uninitialized register values using the value
zero.  The cost for this on PA-RISC is the same as using an arbitrary
call-clobbered register.

Dave
-- 
J. David Anglin                                  [EMAIL PROTECTED]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Reply via email to