Up until now there was no smartness in the BIL smart constructors so that Bil.(x + y) was just BinOp(PLUS,x,y). This PR adds some intelligence to smart constructors and teaches them a few identities, e.g., Bil.(x - x) will evaluate to 0. In addition, all constants will be immediately evaluated. The optimization are as lightweight as possible (not to be confused with the BIL simplifications routines that will optimize code recursively).
The code was mostly moved from the BIL semantics implementation that was before that in the bil plugin with a small change to allow ill-formed BIL expressions. In case of the ill-formed expression we will just keep the expression untouched.
Up until now there was no smartness in the BIL smart constructors so that
Bil.(x + y)
was justBinOp(PLUS,x,y)
. This PR adds some intelligence to smart constructors and teaches them a few identities, e.g.,Bil.(x - x)
will evaluate to0
. In addition, all constants will be immediately evaluated. The optimization are as lightweight as possible (not to be confused with the BIL simplifications routines that will optimize code recursively).The code was mostly moved from the BIL semantics implementation that was before that in the bil plugin with a small change to allow ill-formed BIL expressions. In case of the ill-formed expression we will just keep the expression untouched.