summaryrefslogtreecommitdiff
path: root/src/value2.lem
AgeCommit message (Collapse)Author
2019-11-20Allow undefined values in IR for SMT generationAlasdair Armstrong
Means we can avoid the use of -undefined_gen for Sail->SMT
2019-11-08Refactor Jib compilationAlasdair Armstrong
Split the dynamic context into the ctx struct, and the static configuration into a module which parameterises the sail->jib compilation step rather than just having a giant ctx struct.
2019-11-07Backport fixes to SMT generation from poly_mapping branchAlasdair Armstrong
2019-05-08SMT: Add reals and strings to SMT backendAlasdair Armstrong
Jib_compile now has an option that lets it generate real value literals (VL_real), which we don't want for backends (i.e. C), which don't support them. Reals are encoded as actual reals in SMT, as there isn't really any nice way to encode them as bitvectors. Currently we just have the pure real functions, functions between integers and reals (i.e. floor, to_real, etc) are not supported for now. Strings are likewise encoded as SMTLIB strings, for similar reasons. Jib_smt has ctx.use_real and ctx.use_string which are set when we generate anything real or string related, so we can keep the logic as Arrays+Bitvectors for most Sail that doesn't require either.
2019-04-09SMT: Refactor Jib values to make inlining workAlasdair Armstrong
Had to change the hundreds and hundreds of places such values were used. However this now lets us automatically prove cheri-concentrate properties. Such as showing function prop_cap_round_trip(cap: bits(128)) -> bool = { let cap_rt = capToBits(capBitsToCapability(true, cap)); cap == cap_rt } is always true.
2019-04-05Fix: Don't remove uncalled polymorphic constructors if they are matched uponAlasdair Armstrong
Previously the specialization would remove any polymorphic union constructor that was never created anywhere in the specification. While this wasn't usually problematic, it does leave an edge case where such a constructor could be matched upon in a pattern, and then the resulting match would fail to compile as it would be matching on a constructor kind that doesn't exists. This should fix that issue by chaging the V_ctor_kind value into an F_ctor_kind fragment. Previously a polymorphic constructor-kind would have been represented by its mangled name, e.g. V_ctor_kind "zSome_unit" would now be represented as V_ctor_kind ("Some", unifiers, ty) where ty is a monomorphic version of the original constructor's type such that ctyp_unify original_ty ty = unifiers and the mangled name we generate is zencode_string ("Some_" ^ string_of_list "_" string_of_ctyp unifiers)
2018-07-09Changes for anonymisation. Ensure headers are in correct format. Remove some ↵Robert Norton
redundant files.
2018-06-29Constant folding improvementsAlasdair
2018-06-27Fix reading reals from strings in C libAlasdair Armstrong
2018-06-14rename all lem support files to sail2_foo to avoid conflict with sail1 in rmemJon French
2018-03-02Use sail_lib.lem values in C backendAlasdair Armstrong
Rather than just using strings to represent literals, now use value types from sail_lib.lem to represent them. This allows for expressions to be evaluated at compile time, which will be useful for future optimisations involving constant folding and propagation, and allows the intermediate bytecode to be interpreted using the same lem builtins that the shallow embedding uses. To get this to work I had to tweak the build process slightly to allow ml files to import lem files from gen_lib/. Hopefully this doesn't break anything!