add pet_inliner
commit9b5b0976f5ee24ea3bacb08ec6a54b21126ee848
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 11 Aug 2015 12:10:38 +0000 (11 14:10 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 10 Nov 2015 11:04:49 +0000 (10 12:04 +0100)
tree5e5b41fd9ad77162317fa9962bf2340dfe4d2ca3
parent5830e808a7060b5f1c18617f73dc5bdf12de8f57
add pet_inliner

A pet_inliner keeps track of assignments of (parts of) actual arguments
to temporary variables and substitutions of the formal arguments
by (expressions containing) these temporary variables.
It then applies the substitutions to a tree corresponding to
the body of the called functions and places the result in
a block after the assignments.
In case of array arguments, it's the arguments of the array access
expression that are assigned to temporary variables and these temporary
variables replace the original arguments in the array access expression
that is used as a substitution for the corresponding formal argument.

The inliner is intended to be used on an unevaluated pet_tree.
The use of assignments before the inlined tree ensures that
the correct values are used.  In those cases where the assignments
can be propagated to the reads of the corresponding variables,
it will be taken care of by the general propagation mechanism
of pet_context.

The use of the inliner will follow in a subsequent commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Makefile.am
inliner.cc [new file with mode: 0644]
inliner.h [new file with mode: 0644]