Skip to content

Commit

Permalink
Add proof hint generation flag (#3821)
Browse files Browse the repository at this point in the history
This flag exists in `llvm-kompile` already, but we want consumers that
compile via the K frontend to be able to use the proof hint
instrumentation feature.
  • Loading branch information
Baltoli authored Nov 20, 2023
1 parent 5cdf6b3 commit 926981f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out.hint
22 changes: 22 additions & 0 deletions k-distribution/tests/regression-new/proof-instrumentation/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DEF=test
KOMPILE_BACKEND=llvm
KOMPILE_FLAGS+=--gen-glr-bison-parser --llvm-proof-hint-instrumentation
LLVM_KRUN_FLAGS=-d ./test-kompiled --proof-hints

check: out.hint
head -c4 out.hint | diff - <(echo -n 'HINT')

out.hint: test.kore
rm -f $@
$(LLVM_KRUN) $(LLVM_KRUN_FLAGS) \
-c PGM $< Foo korefile -o $@

test.kore: test.in kompile
./test-kompiled/parser_PGM $< > $@

include ../../../include/kframework/ktest.mak

clean:
rm -rf out.hint test.kore $(KOMPILED_DIR) .depend-tmp .depend .kompile-* .krun-* .kprove-* kore-exec.tar.gz

update-results: CHECK=> test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) K Team. All Rights Reserved.
module TEST-SYNTAX
syntax Foo ::= foo() | bar()
endmodule

module TEST
imports TEST-SYNTAX
rule foo() => bar()
endmodule
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ private void llvmKompile(String type, String executable) {
args.add(files.resolveKompiled("dt").getCanonicalPath());
args.add(type);

if (options.enableProofHints) {
args.add("--proof-hint-instrumentation");
}

// Arguments after this point are passed on to Clang.
args.add("--");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ public List<String> convert(String str) {
descriptionKey = "file",
hidden = true)
public String llvmKompileOutput = null;

@Parameter(
names = "--llvm-proof-hint-instrumentation",
description = "Emit proof hint instrumentation code into the generated interpreter",
hidden = true)
public boolean enableProofHints;
}

0 comments on commit 926981f

Please sign in to comment.