ROSE Compiler Framework/Constant Propagation

Please see also ROSE Compiler Framework/Generic Dataflow Framework since this analysis is implemented using the framework.

overview
See http://en.wikipedia.org/wiki/Constant_folding for the examples of constant folding and constant propagation "Constant propagation is the process of substituting the values of known constants in expressions at compile time. "

Example
The analysis will only generate lattices representing the propagated constant values. It will NOT actually transform the AST! So the example code below is used to only illustrate the propagation of values.

Input code

Propagating x yields:

Continuing to propagate yields the following:

Source files
List
 * rose/tests/roseTests/programAnalysisTests/generalDataFlowAnalysisTests/constantPropagation.h
 * rose/tests/roseTests/programAnalysisTests/generalDataFlowAnalysisTests/constantPropagation.C

TODO
 * move them into rose/src/midend/programAnalysis/genericDataflow/simpleAnalyses

Tests
test translator
 * rose/tests/roseTests/programAnalysisTests/generalDataFlowAnalysisTests/constantPropagationTest.C github-link

The test translator will
 * generate dot graph for the CFG and attached constant lattice.
 * verify the generated results are expected (given as pragmas in the input test input file)

test input with verification
 * rose/tests/roseTests/programAnalysisTests/generalDataFlowAnalysisTests/cp_test1.C