loki
loki copied to clipboard
Transformations: Re-organise `inline` and `extract` sub-packages
This change creates two new separate transformation sub-packages loki.transformations.inline
and loki.transformations.extract
that are conceptual complements. For the inline sub-package, this allows us to separate the different types of inlining (constants, small functions and full procedures), and the associated tests. For "extract", this change brings together the two disparate current implementations (formerly extract_contained
and region_to_call
), and provides the counter-passes to the respective inlining operations as extract_internals
and extract_marked
. I've also added a wrapper ExtractTransformation
class that provides both functionalities for batch processing.
Please note that, other than a minor bug-fix, I've left the implementations untouched. Further consolidation and additional features are planned, but I wanted to get the diff-heavy stuff out of the way first.
In some more detail:
- Created separate
loki.transformations.inline
sub-package withconstants
/functions
/mapper
/procedures
modules. Importantly, I also split the test accordingly and localised it! - Renamed
extract_contained
toextract_internals
for consistency and created newloki.transformations.extract
sub-package. - Renamed
region_to_call
toextract_marked
and moved toloki.transformations.extract
. - Added a new
ExtractTransformation
as batch-processing entry point. Importantly, this works onModule
andSourcefile
objects only, as that defines where the newly created procedures go. Also added tests for this - A small bug-fix for
extract_internals
and a few linter-compliance fixes for the transformation standalone tests. (Turns out pylint does not recurse into test directories, as there is no automatic package import 😉 )