diff options
| author | Alasdair Armstrong | 2018-12-14 17:58:30 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-12-14 17:58:30 +0000 |
| commit | c37666f691078e39102d125298cd70b210f83f63 (patch) | |
| tree | 400fba0795ec0b8f3702d67a45f3ef6296c21c69 /src/specialize.ml | |
| parent | 2dfcbdeedb0ac40d4865aaf5c2202dfba95f4a38 (diff) | |
Add some experimental support for non-lexical flow-typing rules
Add a file nl_flow.ml which can analyse a block of Sail expressions
and insert constraints for flow-typing rules which do not follow the
lexical structure of the code (and therefore the syntax-directed
typing rules can't do any flow-typing for). A common case found in ASL
translated Sail would be something like
function decode(Rt: bits(4)) = {
if Rt == 0xF then {
throw(Error_see("instruction"));
};
let t = unsigned(Rt);
execute(t)
}
which would currently fail is execute has a 0 <= t <= 14 constraint
for a register it writes to. However if we spot this pattern and add
an assertion automatically:
let t = unsigned(Rt);
assert(t != 15);
execute(t)
Then everything works, because the assertion is in the correct place
for regular flow typing. Currently it only works for this specific
use-case, and is turned on using the -non_lexical_flow flag
Diffstat (limited to 'src/specialize.ml')
0 files changed, 0 insertions, 0 deletions
