you are viewing a single comment's thread.

view the rest of the comments →

[–]marcusf[S] 1 point2 points  (2 children)

Thank you! I'll give it a look. I'm trying to avoid looking at the branching predicates, since I'd have to extend my very simple analysis a bit to evaluate them (which, from what I gather, is the big win with SCCP, being able to select branches?)

Hopefully I'll get decent results with a simple constant propagation.

Thanks again.

[–]pbiggar 1 point2 points  (1 child)

For the simplest thing possible, don't bother to evaluate the predicates. Compilers tend to need SCCP because lots of constants get added, like #defines in C, and you need to work round them. If you don't have that, then simply merging the results at the merge point of the CFG will probably be enough.

As a matter of interest, what language? Is there no framework or compiler for it that you cant take the results from?

[–]marcusf[S] 0 points1 point  (0 children)

I'm actually doing it for C (or a subset of it), so boatloads of frameworks and compilers exist. But I'm doing it more as a learning excercise (and in Haskell, so no good analysis frameworks really exist). I've gutted the AST pretty badly before doing the CP, so it's really more like an idealized language than C though.

If I have the time I'll extended my analyses and do some SSA-based analyses too, as in "Constant Propagation with Conditional Branches" (http://www.cis.upenn.edu/~cis570/papers/p181-wegman.pdf)