This is the mail archive of the
mailing list for the GCC project.
Re: Question about Gimple FE
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Yinsong Xue <xyshh94225 at hotmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Diego Novillo <dnovillo at google dot com>, GCC Development <gcc at gcc dot gnu dot org>, Sebastian Pop <sebpop at gmail dot com>
- Date: Wed, 8 Apr 2015 10:15:01 +0200
- Subject: Re: Question about Gimple FE
- Authentication-results: sourceware.org; auth=none
- References: <BLU436-SMTP393D735E667D7744698A4D85080 at phx dot gbl> <CAFiYyc0ukmm0w+YPQ1QOV2Vw3euPmVZR2MLHsjc25XB9T0ds8w at mail dot gmail dot com> <BLU436-SMTP23617265C8657F936DF78CF85090 at phx dot gbl> <CAFiYyc3Ryj6mj9o-JeJwfBHfHavQDD-iA_8gW9taoUEehKLWdw at mail dot gmail dot com> <CAFiYyc2eje=Fx5DRRDOktqvv0=MDp8vK54AKvKuwWRbM4u5-DQ at mail dot gmail dot com> <BLU437-SMTP126C99D3E9C8BD08E2658385F10 at phx dot gbl> <551E9992 dot 7020608 at google dot com> <6B559995-4BD4-4EC3-B8B0-6261767B8740 at hotmail dot com> <BLU436-SMTP6095BDF79AC949FCD664E485F10 at phx dot gbl> <CAD_=9DR9pZ6TSA-73kzeEPo+=3-PsCUQhEynn=-vF=gOoQ0J8A at mail dot gmail dot com> <551EB355 dot 8010607 at redhat dot com> <CAD_=9DSp5bniJ+uPTyLqS+GP-ERPudzgcLSDuZ2BR7Q64V3g4w at mail dot gmail dot com> <551ED79D dot 60703 at redhat dot com> <CAFk3UF9Q0WuODC5p61WkHT2_2s+jMv3jMfDX6BPWnENUG36F7Q at mail dot gmail dot com> <CAFiYyc38J4YvKmyos6Gzn6847pg-BCi4zJPSH9xOVn4nofRaTQ at mail dot gmail dot com> <BLU436-SMTP168D90E8D42F45A6F3E06E285FC0 at phx dot gbl>
On Wed, Apr 8, 2015 at 4:48 AM, Yinsong Xue <email@example.com> wrote:
> On 15/4/7 äå4:33, "Richard Biener" <firstname.lastname@example.org> 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
# 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>;
# 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);
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.