summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-09-17Rewrites.rewrite_defs_mapping_patterns: emit an explicit type annotation on ↵Jon French
the generated pattern so re-typechecking works
2018-09-14Sail_lib.string_of_bits: print in decimal (properly, with bigints) rather ↵Jon French
than binary
2018-09-14(oops, should have been with "more hex_bits_N monomorphs")Jon French
2018-09-14Sail_lib.int_of_string_opt: use Big_int.of_string rather than OCaml ↵Jon French
int_of_string This fixes e.g. problems with 64-bit bitmask immediates in ARM assembly.
2018-09-14More monomorphisations for hex_bits_N...Jon French
I got bored of this so I wrote a Python script to generate all of them between 1 and 33, plus 48 and 64. It's in a comment. We should really get around to making the typechecker work with polymorphic mappings...
2018-09-14Sail_lib and RISCV prelude: functions for bitwise operations on intsJon French
2018-09-14Type_check: allow mappings to contain escape effectsJon French
2018-09-13C: Fix an issue with assigning to unitialized variables at end of blocksAlasdair Armstrong
Assigning to an uninitialized variable as the last statement in a block is almost certainly a type, and if that occurs then the lift_assign re-write will introduce empty blocks causing this error to occur. Now when we see such an empty block when converting to A-normal form we turn it into unit, and emit a warning stating that an empty block has been found as well as the probable cause (uninitialized variable).
2018-09-13Coq: real built-ins for AArch64Brian Campbell
2018-09-12Jenkins: Fix deprecation warningsAlasdair Armstrong
Now that Jenkins is updated to a newer version of OCaml we can finally fix some warning with more recent versions of OCaml than 4.02.3. Also fix a Lem test case that was failing.
2018-09-12Coq: fix type annotations for early returnBrian Campbell
2018-09-12Coq: avoid some use of pattern binders to help Coq's type checkerBrian Campbell
2018-09-12Coq: print more type information for existentially typed vectorsBrian Campbell
2018-09-11Coq: some basic handling for more existentialsBrian Campbell
2018-09-11Coq: remove a bunch of Lem-ismsBrian Campbell
In particular, the complicated "what nexps are in scope" test can be replaced by a simple "are the nvars in scope" check.
2018-09-10Various fixesAlasdair Armstrong
C: Don't print usage message and quit when called with no arguments, as this is used for testing C output OCaml: Fix generation of datatypes with multiple type arguments OCaml: Generate P_cons pattern correctly C: Fix constant propagation to not propagate letbindings with type annotations. This behaviour could cause type errors due to how type variables are introduced. Now we only propagate letbindings when the type of the propagated variable is guaranteed to be the same as the inferred type of the binding. Tests: Add OCaml tests to the C end-to-end tests (which really shouldn't be in test/c/ any more, something like test/compile might be better). Currently some issues with reals there like interpreter. Tests: Rename list.sail -> list_test.sail because ocaml doesn't want to compile files called list.ml.
2018-09-06C: Fix a bug with shadowing in nested let-bindingsAlasdair
2018-09-06Allow options to be set in the interactive modeAlasdair Armstrong
Also allow options to be set via a pragma in Sail files
2018-09-04C: add an option to control generation of main().Prashanth Mundkur
2018-09-04C: split out setup/init and teardown functions from main().Prashanth Mundkur
2018-09-04C: Tweaks to RISC-V to get compiling to CAlasdair Armstrong
Revert a change to string_of_bits because it broke all the RISC-V tests in OCaml. string_of_int (int_of_string x) is not valid because x may not fit within an integer.
2018-09-04Improve error messages for include and ifdef statementsAlasdair Armstrong
2018-09-04Add a rewrite to minimise the number of functions marked as recursiveBrian Campbell
Particularly useful when execute has been split up (e.g., on RISC-V). Only enabled on Coq for now.
2018-09-04Coq: fix early returns with rich typesBrian Campbell
2018-09-03Coq: get top-level value definitions to work nicely againBrian Campbell
Also required some solver fixes: - make sure that ArithFacts are always cleared to avoid loops - extract_properties should do the goal first because it might add extra work to do in the hypotheses - unfolding should come before extract_properties
2018-09-03Coq: rework generation of dependent pairs so that they are onlyBrian Campbell
constructed when a function call, cast, or binder demands them, removing some ambiguous corner cases. Also - Don't simplify nexps before printing (note that we usually end up needing a (8 * x) / 8 lemma as a result) - More extraction of properties in the goal - Splitting of conditionals/matches in goals (which can occur more often because of the new positions of build_ex in definitions) - Try simple solving first to improve speed / reduce proof sizes / help fill in metavariables (because manipulating the goal can interfere with instantiating them) - Update RISC-V patch
2018-08-31rewrite_defs_pat_string_append: only guard the innermost recursive pattern, ↵Jon French
and use the original ids rather than fresh ones; both to allow referring to matched ids in guards
2018-08-31mappings: Support for unidirectional mapping clausesJon French
2018-08-31riscv prelude: yet more manual monomorphisations for hex_bitsJon French
2018-08-31fix some compiler warningsJon French
2018-08-31sync and centralise the two .merlin filesJon French
2018-08-30C: Fix a bug where function argument type becomes more specific due to flow ↵Alasdair Armstrong
typing Added a regression test as c/test/downcast_fn.sail
2018-08-30Allow additional includes to be specified for C backend.Prashanth Mundkur
2018-08-30C: Fix an issue with struct field being generalised inside polymorphic ↵Alasdair Armstrong
constructors Add a new printing function for debugging that recursively prints constructor types. Fix an interpreter bug when pattern matching on constructors with tuple types.
2018-08-29C: Fix some issues with tuples as arguments to polymorphic constructorsAlasdair Armstrong
Now all we need to do is make sure the RISC-V builtins are mapped to the correct C functions, and RISC-V in C should work (hopefully). We're still missing some of the functions in sail.c for the mappings so those have to be implemented.
2018-08-28fix some compiler not-matched warnings about Typ_bidir and Typ_internal_unknownJon French
2018-08-28add __POS__ argument to Err_unreachable for better error reportingJon French
2018-08-24Fix rewriter issuesAlasdair Armstrong
Allow pat_lits rewrite to map L_unit to wildcard patterns, rather than introducing eq_unit tests as guards. Add a fold_function and fold_funcl functions in rewriter.ml that apply the pattern and expression algebras to top-level functions, which means that they correctly get applied to top-level function patterns when they are used. Currently modifying the re-writing passes to do this introduces some bugs which needs investigated further. The current situation is that top-level patterns and patterns elsewhere are often treated differently because rewrite_exp doesn't (and indeed cannot, due to how the re-writer is structured) rewrite top level patterns. Fix pattern completeness check for unit literals Fix a bug in Sail->ANF transform where blocks were always annotated with type unit incorrectly. This caused issues in pattern literal re-writes where the guard was a block returning a boolean. A test case for this is added as test/c/and_block.sail. Fix a bug caused by nested polymorphic function calls and matching in top-level patterns. Test case is test/c/tl_poly_match.sail. Pass location info through codegen_conversion for better error reporting
2018-08-24parser: emit actual unit for an ident() pattern, not wildcard which causes ↵Jon French
unnecessary problems with mappings/pat_to_exp
2018-08-24fix a couple of pretty print inaccuraciesJon French
2018-08-24support for P_or and P_not patterns in rewrite_defs_mapping_patternsJon French
2018-08-24rewrite_defs_mapping_patterns: support for referring to mapping arguments in ↵Jon French
guards
2018-08-24pat_to_exp support for vector and string concat patterns; fix typing in ↵Jon French
exp_of_mpat
2018-08-24rewrite_defs_pat_lits: rewrite away fewer lits when generating ocaml, for ↵Jon French
cleaner generated code and reduced compiler warnings
2018-08-23Fix interpreter after re-writer changeAlasdair Armstrong
Interpreter used a re-write (vector concat removal) that is dependent on the vector_string_to_bit_list rewriting pass. This fixes the interpreter to work without either vector concat removal, or turning bitstrings into vector literals like [bitzero, bitzero, bitone]. This has the upside of reducing the number of steps the interpreter needs for working with bitvectors so should improve interpreter performance. We also now test all the C compilation tests behave the same using the interpreter. Currently the real number tests fail due to limitations of Lem's rational library (this must be fixed in Lem). This required supporting configuration registers in the interpreter. As such the interpreter was refactored to more cleanly process registers when building an initial global state. The functions are also collected into the global state, which removes the need to search for them in the AST every time a function call happens. This should not only improve performance, but also removes the need to pass an AST into the interpretation functions.
2018-08-23Move vector_string_to_bit_list from its odd place in Rewriter.rewrite_pat to ↵Jon French
an explicit rewrite step in Rewrites, just before pat_lits
2018-08-22Fix a bug in nested vector concatenation patternsAlasdair Armstrong
2018-08-22Revert "rewrite_defs_pat_lits: add an explicit type annotation around ↵Jon French
generated id pattern" This reverts commit 9fdd1ecbed32ebb408256628b6661ccbf5f16c18.
2018-08-22rewrite_defs_pat_lits: add an explicit type annotation around generated id ↵Jon French
pattern
2018-08-21C: Correctly handle the kinds of patterns generated by mappingsAlasdair Armstrong
This change allows the RISC-V spec to compile to C, but more testing is needed to ensure it works correctly.