From ea2ff78cf675298df64e8ebacca7156b68f3c5c8 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Fri, 2 Mar 2018 19:17:51 +0000 Subject: Use sail_lib.lem values in C backend 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! --- src/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 8bf4802a..3e0b9841 100644 --- a/src/Makefile +++ b/src/Makefile @@ -82,7 +82,7 @@ ast.ml: ast.lem sed -i -f ast.sed ast.ml bytecode.ml: bytecode.lem - lem -ocaml bytecode.lem + lem -ocaml bytecode.lem -lib . -lib gen_lib/ sed -i -f ast.sed bytecode.ml lem_interp/interp_ast.lem: ../language/l2.ott @@ -234,8 +234,8 @@ _build/%_trimmed.sail: _build/%_all.sail count: _build/cheri_trimmed.sail _build/mips_trimmed.sail wc -l $^ -%.ml: %.lem - $(LEM) -only_changed_output -ocaml -lib lem_interp/ $< +# %.ml: %.lem +# $(LEM) -only_changed_output -ocaml -lib lem_interp/ $< #run_mips.native: _build/mips.ml _build/mips_extras.ml _build/run_with_elf.ml interpreter # env OCAMLRUNPARAM=l=100M ocamlfind ocamlopt $(OCAML_OPTS) -g -package num -package str -package unix -I $(ELFDIR)/contrib/ocaml-uint/_build/lib -I $(LEMLIBOCAML) -I $(ZARITH_DIR) -I _build/lem_interp/ -I $(ELFDIR)/src -I $(ELFDIR)/src/adaptors -I $(ELFDIR)/src/abis/mips64 -I _build -linkpkg $(ZARITH_LIB) $(LEMLIBOCAML)/extract.cmxa $(ELFDIR)/contrib/ocaml-uint/_build/lib/uint.cmxa $(ELFDIR)/src/linksem.cmxa _build/pprint/src/PPrintLib.cmxa _build/lem_interp/extract.cmxa _build/mips.ml _build/mips_extras.ml _build/run_with_elf.ml -o run_mips.native @@ -280,6 +280,7 @@ clean: -rm -rf tex-doc -rm -rf lem lib -rm -rf sail.docdir + -rm -f gen_lib/*.ml -rm -f ast.ml -rm -f ast.lem -rm -f bytecode.ml -- cgit v1.2.3