dcbaker / meson-plus-plus

An experimental and incomplete implementation of Meson in C++, for solving Meson's bootstrapping issue.
Apache License 2.0
50 stars 7 forks source link

Constant Folding #60

Closed dcbaker closed 2 years ago

dcbaker commented 2 years ago

That allows constants (all assignments in meson are const) to be folding. Which means we can optimize code like:

X = 7
if true
   Y = X
else
   Y = X + 1
endif
Z = Y

to

if true
    Z = X
else
   Z = X + 1
endif

With some additional passes (like const prop) we can further simplify this.