You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When targeting Wizard, predication will have to be done more strategically. Predicate expressions contain both static and dynamic data. Wizard supports evaluating static predicates at match time, so the whamm compiler will need to split out the static and dynamic portions of the predicate.
In the simplest case, if there is a dynamic portion of the predicate, the entire predicate is treated as dynamic. However, there can be some optimizations to this as follows.
Overview
When targeting Wizard, predication will have to be done more strategically. Predicate expressions contain both static and dynamic data. Wizard supports evaluating static predicates at match time, so the
whamm
compiler will need to split out the static and dynamic portions of the predicate.In the simplest case, if there is a dynamic portion of the predicate, the entire predicate is treated as dynamic. However, there can be some optimizations to this as follows.
Basis
Color guide:
Given this basis, a pattern arises.
If we categorize parts of the predicate as either static or dynamic, we can use constant propagation to find each case to generate.
Example
(${{\color{Aquamarine}{X}}}$ || ${{\color{Red}{Y}}}$ ) || ${{\color{Red}{B}}}$
2a) Dynamic Truth Table
2b) Static Truth Table
3a) Dynamic constant propagation
true
(true ||${{\color{Red}{Y}}}$ ) || ${{\color{Red}{B}}}$ ${{\color{Red}{B}}}$
true ||
true
false
(false ||${{\color{Red}{Y}}}$ ) || ${{\color{Red}{B}}}$
${{\color{Red}{Y}}}$ || ${{\color{Red}{B}}}$
3b) Static constant propagation
(${{\color{Aquamarine}{X}}}$ || true ) || true => ${{\color{Aquamarine}{X}}}$ || true ) || false => ${{\color{Aquamarine}{X}}}$ || false ) || true => ${{\color{Aquamarine}{X}}}$ || false ) || false => ${{\color{Aquamarine}{X}}}$
true
(
true
(
true
(
4) Collect and Simplify
|${{\color{Aquamarine}{/\$X(..)/}}}$ | ${{\color{Red}{\{\}}}}$ |${{\color{Aquamarine}{/!\$X(..)/}}}$ | ${{\color{Red}{\{Y||B\}}}}$ |
|
The text was updated successfully, but these errors were encountered: