summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-04-12Interpreter: remove debug printing (oops)Jon French
2019-04-12update libsail.mllib with more jib modulesJon French
2019-03-14fix typo in interpreter excl_res intrinsicJon French
2019-03-14Merge branch 'sail2' into rmem_interpreterJon French
2019-03-13Pretty_print_sail: don't use colour to highlight E_internal_valueJon French
2019-03-13Interpreter: return frame rather than eval-looping analyse_instructionJon French
This is in order to allow register reads etc to be handled by RMEM
2019-03-13Interpreter: handling for E_consJon French
2019-03-13Interpreter: error handling when calling primopsJon French
2019-03-13Refactor interpreter monad to include pp in effect requests/failuresJon French
2019-03-13fix is_true/is_false use of == for web-interface new-interpreterJon French
2019-03-13Debugging: string_of_value internal values in string_of_expJon French
2019-03-13Finish toFromInterp backend, adding Lem modeJon French
2019-03-13Remove prover reference from typecheck env when marshalling out defsJon French
2019-03-13package and install Sail as an ocamlfind libraryJon French
2019-03-13C: Improve Jib IR, add SSA representationAlasdair Armstrong
Add a CL_void l-expression so we don't have redundant unit-typed variables everywhere, and add an optimization in Jib_optimize called optimize_unit which introduces these. Remove the basic control-flow graph in Jib_util and add a new mutable control-flow graph type in Jib_ssa which allows the IR to be converted into SSA form. The mutable graph allows for more efficient updates, and includes both back and forwards references making it much more convenient to traverse. Having an SSA representation should make some optimizations much simpler, and is also probably more natural for SMT generation where variables have to be defined once using declare-const anyway. Debug option -ddump_flow_graphs now outputs SSA'd graphs of the functions in a specification.
2019-03-13Tell Lem that records parametrised over Ints need the len typeclass annotationsBrian Campbell
2019-03-12Coq: fix parametrized record typesBrian Campbell
2019-03-12Coq: fix some boolean issues seen in armBrian Campbell
Fixes bad precedence issues, removes an out-of-date special case that's not necessary, and solves more goals.
2019-03-11Improve ocamldoc commentsAlasdair Armstrong
Check in a slightly nicer stylesheet for OCamldoc generated documentation in etc. Most just add a maximum width and increase the font size because the default looks absolutely terrible on high-DPI monitors. Move val_spec_ids out of initial_check and into ast_util where it probably belongs. Rename some functions in util.ml to better match the OCaml stdlib.
2019-03-09C: Fix miscompilation of constrained struct field accessAlasdair
For a Int-parameterised struct F('x: Int) = ... the optimizer would attempt to optimize field access in cases where 'x was known to constrain the types of the struct fields only locally. Which would create a type error in the generated C. Now we always use the type from the global struct type. However, we previously weren't using struct type quantifiers to optimize the field representation, which we now do. Also rename some utility functions to better match the List functions in the OCaml stdlib.
2019-03-09Adds missing bits for DC/ICShaked Flur
2019-03-08Rewriter: Cleanup old sizeof rewritesAlasdair Armstrong
Shouldn't affect anything as this is done by the typechecker now. Also remove some unfinished tracing code from c_backend.ml
2019-03-08C: Refactor C backendAlasdair Armstrong
Main change is splitting apart the Sail->IR compilation stage and the C code generation and optimization phase. Rather than variously calling the intermediate language either bytecode (when it's not really) or simply IR, we give it a name: Jib (a type of Sail). Most of the types are still prefixed by c/C, and I don't think it's worth changing this. The various parts of the C backend are now in the src/jib/ subdirectory src/jib/anf.ml - Sail->ANF translation src/jib/jib_util.ml - various Jib AST processing and helper functions (formerly bytecode_util) src/jib/jib_compile.ml - Sail->Jib translation (using Sail->ANF) src/jib/c_backend.ml - Jib->C code generator and optimizations Further, bytecode.ott is now jib.ott and generates jib.ml (which still lives in src/ for now) The optimizations in c_backend.ml should eventually be moved in a separate jib_optimization file. The Sail->Jib compilation can be parameterised by two functions - one is a custom ANF->ANF optimization pass that can be specified on a per Jib backend basis, and the other is the rule for translating Sail types in Jib types. This can be more or less precise depending on how precise we want to be about bit-widths etc, i.e. we only care about <64 and >64 for C, but for SMT generation we would want to be as precise as possible. Additional improvements: The Jib IR is now agnostic about whether arguments are allocated on the heap vs the stack and this is handled by the C code generator. jib.ott now has some more comments explaining various parts of the Jib AST. A Set module and comparison function for ctyps is defined, and some functions now return ctyp sets rather than lists to avoid repeated work.
2019-03-08Fix: Never consider single variable types to be ambiguousAlasdair
2019-03-07Remove more dead branchesThomas Bauereiss
2019-03-07Also remove impossible if-branchesThomas Bauereiss
2019-03-07Fix bug in a mono rewrite helper functionThomas Bauereiss
2019-03-07C: Make instrs_graph return just control flow graphAlasdair Armstrong
Previously instrs_graph would return the control-flow graph, as well as some data-flow by including reads and writes to variables represented as a node type in the graph (G_id). However, this was not particularly useful, and since the graph isn't in SSA form (so identifiers are non-unique) potentially inaccurate too. This simplifies the code so instrs_graph just returns control flow dependencies, which in turn simplifies the instr_reads and instr_writes functions.
2019-03-07Add a rewrite to remove impossible cases on integer literalsBrian Campbell
(e.g., for the dual 32/64 bit RISC-V model) Apply this rewrite in Coq backend.
2019-03-07Simplify handling of referenced variables in constant propagationBrian Campbell
2019-03-07Extract constant propagation and related functions from monomorphisation.Brian Campbell
This shouldn't change any functionality.
2019-03-06Add an -ir option to print the intermediate representation of a fileAlasdair Armstrong
2019-03-06Improve AST slicingAlasdair Armstrong
2019-03-06Add option to slice out printing and tracing functions when generating CAlasdair Armstrong
Make instruction dependency graph use graph.ml Expose incremental graph building functions for performance in graph.mli
2019-03-05Fix missing case in specializationAlasdair
2019-03-05More optimizations and improvments for C generationAlasdair Armstrong
Add some comments in constant_fold.ml
2019-03-05Coq: use more local type information when constructing tuplesBrian Campbell
2019-03-05Coq: some debugging messagesBrian Campbell
2019-03-05Coq: output type-level Int definitionsBrian Campbell
2019-03-05Additional optimizations for C compilationAlasdair
2019-03-04Fix aarch64_small test XML for jenkinsAlasdair Armstrong
Rename rewrite_split_fun_constr_pats to rewrite_split_fun_ctor_pats as constr is commonly used as an abbreviation for constraint rather than constructor, and add a more descriptive comment.
2019-03-04Fix execute splitting to work when constructors have constraints.Alasdair Armstrong
Previously any constraints on constructors were just outright dropped when splitting the execute function in Lem generation. Now we get the constraints and type signature for each execute clause from the type given by Env.get_union_constructor, rather than by inferring the type of the pattern in each function clause. Currently this can still fail in the case where we have union U('x: Int), C1('x) = { ctor: {'y. C2('x, 'y), T('x, 'y)} } and val execute : forall 'z, C3('z). U('z) -> unit when C3 implies C1, and the body of an excute clause relies on the fact that C3 is stronger than C1, as each split function execute_ctor is only guaranteed to be constrained by some subset of C1. This seems unlikely to happen in practice though. Also fix a bug when binding P as int('T) against int('T) and similar cases, where the new type variable would cause the old type variable to become shadowed, but the constraint that the bound type variable and the old type variable are equal would not take this into account.
2019-03-04Type_check: functions env/typ_of_tannotJon French
2019-03-04Merge branch 'sail2' into rmem_interpreterJon French
2019-03-04Marshalling: remove prover before marshallingJon French
2019-03-04Interpreter: remove useless string-to-rk/wk/bk functions, they're much ↵Jon French
better suited in RMEM
2019-03-04Do not store type synonyms as functions in the environmentAlasdair Armstrong
2019-03-04fix old extern type usage in SpecializeJon French
2019-03-04Merge branch 'sail2' into rmem_interpreterJon French
2019-03-04Type_check: make prover reference in env an option defaulting to NoneJon French
Also: * Rename add_prover to set_prover * Make set_prover public This is to support being able to marshal out typecheck envs. RMEM (or other users) can temporarily set the prover reference to None to avoid attempting to marshal a functional value, and then reset it to Some (Type_check.prove ...) on unmarshalling.