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]
Other format: [Raw text]

Re: Question about Gimple FE

On Wed, Apr 8, 2015 at 4:48 AM, Yinsong Xue <> wrote:
> On 15/4/7 äå4:33, "Richard Biener" <> 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.
> 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>;
    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

  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.


> â
> Yinsong

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