GIMPLE FE: A Gimple Front End
The Gimple FE project, that started as part of Google Summer of code 2016, is aimed at converting the GIMPLE IR to a fixed format textual representation and to develop a front end which can recognize this textual GIMPLE and parse it. The essence of the project is to enable easy unit-testing and testcase extraction.
Code Repository
The project is being implemented on trunk since its original state was merged for GCC 8.
Implementation
The GIMPLE frontend piggy-backs on the C frontend where GIMPLE annotated functions are parsed specially when -fgimple is specified for the compilation. This allows type parsing to be done by the C frontend and a testglue be written in C. Example: In general syntax closely follows that of C. A good source of frontend capabilities is the testcases in gcc.dg/gimplefe-*.c To help extracting GIMPLE frontend testcases from passes there is the -gimple dump modifier. Note manual massaging of the output is still necessary.
The biggest TODO is to make the GIMPLE frontend more amenable for unit-testing by supporting CFG annotations such as profile counters. Major missing CFG parts are also abnormal and exception handling edges. Likewise the loop state flags need to be passed in to support IL that is officially in loop-closed SSA for example. Gotos could get additional markup: for an example with an EH edge with EDGE_EXECUTABLE set and edge profile count 1246. struct S { int i; };
int __GIMPLE foo()
{
struct S s;
int _1;
s.i = 0;
_1 = s.i;
return _1;
}
int main() { return foo (); }
TOOD
goto _BBN(EH|EXECUTABLE, count: 1246);