On Wed, Apr 8, 2015 at 4:48 AM, Yinsong Xue <xyshh94...@hotmail.com> wrote:
> On 15/4/7 δΈ‹εˆ4:33, "Richard Biener" <richard.guent...@gmail.com> wrote:
>
>>I still like the idea of using C + extensions most.  As well as making the
>>-fdump-tree-XXX dumps (more) valid C (+ extensions).  Cut & pasting
>>from dump files to generate testcases is currently somewhat awkward,
>>mainly due to the issue how we dump labels + goto destinations.
>>
>>Richard.
>
> What is the issue all about specifically?
> Does that mean we have to translate labels and gotos to conditions and loops?

No.  Currently we dump

  <bb 11>:
  # i_57 = PHI <i_10(8)>
  # ivtmp_60 = PHI <ivtmp_16(8)>
  _65 = (int) ratio_mult_vf.8_45;
  tmp.9_64 = i_30 + _65;
  tmp.10_66 = ivtmp_33 - ratio_mult_vf.8_45;
  if (niters.6_41 == ratio_mult_vf.8_45)
    goto <bb 15>;
  else
    goto <bb 12>;

  <bb 12>:
  # i_56 = PHI <tmp.9_64(11), i_30(6)>
  # ivtmp_59 = PHI <tmp.10_66(11), ivtmp_33(6)>
  goto <bb 9>;

and <bb 11>: isn't a valid label in C.  Dumping sth like _BB11:
instead would make it a valid label
and you need to do less editing to get it compile.

Yes, PHIs are another story ;)

Likewise names of temporary variables passes generate are not always
valid identifiers (containing '.'s).

IMHO trying to get -fdump-tree-cfg (dump after CFG build) emit mostly
valid C would be nice (that is,
before you go into SSA form and need to deal with PHIs).

For SSA form we'd need to find a nice syntax for PHI nodes.  I doesn't
need to be the same as used
in debugging dumps.  Easy enough to parse would be using a function
call, thus for bb12 above

_BB12:
  i_56 = __PHI (tmp$9_64, &_BB11, i_30, &_BB6);
  ivtmp_59 = __PHI (tmp$10_66, &_BB11, ivtmp_33, &_BB6);
  goto _BB9;

possibly less conflicting would be to allow '11:' as label as
extension so we can use literal 11 for
the __PHI argument.

The point of re-using (parts of) the C frontend is that you get types
and decls for free.  The GIMPLE
part is really the easy part of writing a gimple FE ;)

You need to shortcut most of the C FEs specialities such as type
promotion rules and stuff, of course.

Richard.

> β€”
> Yinsong
>
>

Reply via email to