How to tell that an insn sets a call argument register in RTL-land?

Steven Bosscher stevenb.gcc@gmail.com
Tue Apr 9 08:51:00 GMT 2013


Hello,

What is the correct way to see if a register is used by a call and not
used to e.g. hold the address of the callee? For example,

   20: %g1:DI=high(`baz')
   22: %g1:DI=[%g1:DI+low(`baz')]
   23: %o0:DI=0x4
   24: %o0:DI=call [%g1:DI] argc:0

In the above code (from the .210.postreload dump of the attached t.c)
insn 23 sets a call arg register for insn 24, and insn 22 loads the
call address. Using sched-deps, my analysis causes both insns to be
candidates to fill the delay slot of insn 24 (see attached DOT file,
region 5), but that's obviously not correct. In reorg.c's delay slot
scheduling, it somehow knows that insn 23 can fill the delay slot of
insn 24 while insn 22 cannot.

How can I tell whether an insn "only" sets a call arg register, and is
otherwise permutable with the call insn itself?

Thanks,

Ciao!
Steven



$ cat t.c
long bar (long) __attribute__((__pure__,__const__));
long (*baz ) (long);

long x[4];

long foo (void);

long
foo (void)
{
  long a = x[0];
  long b = x[1];
  long c = x[2];
  long d = x[3];
  long e;
  long f;

  if (a > b)
    {
      e = baz (4);
      a = c - b;
      f = bar (a);
      b = d - a;
    }
  if (c > d)
    {
      e = bar (6);
      c = a - b;
      f = bar (7);
      d = b - c;
    }
  return a * b * c * d + e + f;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c.228r.sched2.dot
Type: application/octet-stream
Size: 11326 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20130409/47a2abd6/attachment.obj>


More information about the Gcc mailing list