The MiddleEnd contains classes that either makes transformations within the IR or extract information from it, usable for later driver phases.
Extracting information from the program is crucial for the sucess of any optimizing compiler. When a developer write a yaCF driver may found useful to use the mod:MiddleEnd.Loop.Analysis to extract information relative to loops. Other kind of analysis will be added in future versions.
Loop analysis techniques are a basic tool for automatic compiler parallelization. Several bibliography exists about this (See Related Work).
Generic Loop Parameters
In yaCF we have implemented a MiddleEnd.Loop.Analysis.ParametrizeLoopTool, capable of extracting some information of a Frontend.C.c_ast.For node of the IR. Although it has been written with the c_ast IR in mind, it should not be difficult to use it on any kind of IR.
The method MiddleEnd.Loop.Analysis.ParametrizeLoopTool.parametrize() starts the loop analysis, and creates a dictionary of parameters with information from the loop. See method description for parameter details.
Note
We have chosen to return a dictionary, instead of defining a class with its own attributes, to increase the flexibility of the analysis. Using dictionaries, we can add additional parameters to the analysis without affecting the class definition.
Omp specific parameters
As the main pourpose of yaCF is to produce the translating drivers of the llCoMP project, we have implemented a specific Parametrizer which extracts the information of OmpClauses that affects an specific For loop.