-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1679 from GaloisInc/rwd/goal-metadata
Goal metadata
- Loading branch information
Showing
28 changed files
with
1,088 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.PHONY: all clean | ||
|
||
CC ?= clang | ||
CFLAGS ?= -O0 -emit-llvm | ||
SAW ?= saw | ||
|
||
all: test.bc | ||
$(SAW) test.saw | ||
|
||
clean: | ||
rm -f *.bc *.ll *.log | ||
|
||
%.bc: %.c | ||
$(CC) $(CFLAGS) -g -c -o $@ $^ | ||
|
||
%.ll: %.c | ||
$(CC) $(CFLAGS) -g -c -S -o $@ $^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This is a simple test of the "goal tagging" instructions. | ||
|
||
The test is setup to produce two tagged goals, and the tags are used | ||
by the proof tactic uses to select a proving method. Any additional | ||
goals are ignored, and should lead to a proof failure. This test | ||
ensures the goals are being correctly tagged and filtered. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
unsigned int f(unsigned int i) | ||
{ | ||
return (i+1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
; ModuleID = 'test.c' | ||
source_filename = "test.c" | ||
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-apple-macosx11.0.0" | ||
|
||
; Function Attrs: noinline nounwind optnone ssp uwtable | ||
define i32 @f(i32 %0) #0 !dbg !9 { | ||
%2 = alloca i32, align 4 | ||
store i32 %0, i32* %2, align 4 | ||
call void @llvm.dbg.declare(metadata i32* %2, metadata !13, metadata !DIExpression()), !dbg !14 | ||
%3 = load i32, i32* %2, align 4, !dbg !15 | ||
%4 = add i32 %3, 1, !dbg !16 | ||
ret i32 %4, !dbg !17 | ||
} | ||
|
||
; Function Attrs: nounwind readnone speculatable willreturn | ||
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 | ||
|
||
attributes #0 = { noinline nounwind optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "darwin-stkchk-strong-link" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "probe-stack"="___chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } | ||
attributes #1 = { nounwind readnone speculatable willreturn } | ||
|
||
!llvm.module.flags = !{!0, !1, !2, !3, !4} | ||
!llvm.dbg.cu = !{!5} | ||
!llvm.ident = !{!8} | ||
|
||
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 12, i32 1]} | ||
!1 = !{i32 7, !"Dwarf Version", i32 4} | ||
!2 = !{i32 2, !"Debug Info Version", i32 3} | ||
!3 = !{i32 1, !"wchar_size", i32 4} | ||
!4 = !{i32 7, !"PIC Level", i32 2} | ||
!5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "Apple clang version 12.0.5 (clang-1205.0.22.11)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !7, nameTableKind: None, sysroot: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk", sdk: "MacOSX12.1.sdk") | ||
!6 = !DIFile(filename: "test.c", directory: "/Users/rdockins/code/saw-script/intTests/test_goal_tags_01") | ||
!7 = !{} | ||
!8 = !{!"Apple clang version 12.0.5 (clang-1205.0.22.11)"} | ||
!9 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 2, type: !10, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !7) | ||
!10 = !DISubroutineType(types: !11) | ||
!11 = !{!12, !12} | ||
!12 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) | ||
!13 = !DILocalVariable(name: "i", arg: 1, scope: !9, file: !6, line: 2, type: !12) | ||
!14 = !DILocation(line: 2, column: 29, scope: !9) | ||
!15 = !DILocation(line: 4, column: 11, scope: !9) | ||
!16 = !DILocation(line: 4, column: 12, scope: !9) | ||
!17 = !DILocation(line: 4, column: 3, scope: !9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
enable_experimental; | ||
|
||
let f_spec : CrucibleSetup () = llvm_setup_with_tag "f spec" do { | ||
i <- llvm_fresh_var "i" (llvm_int 32); | ||
llvm_precond {{i < 512}}; | ||
llvm_execute_func [llvm_term i]; | ||
|
||
j <- llvm_fresh_var "j" (llvm_int 32); | ||
llvm_return (llvm_term j); | ||
llvm_setup_with_tag "post bound" | ||
(llvm_postcond {{ j <= 512 }}); | ||
llvm_setup_with_tag "post eq" | ||
(llvm_postcond {{ j == i+1 }}); | ||
}; | ||
|
||
let tac : ProofScript () = do { | ||
isBound <- goal_has_tags ["post bound", "f spec"]; | ||
isEq <- goal_has_tags ["post eq", "f spec"]; | ||
|
||
if isBound then do { | ||
print_goal_summary; | ||
yices; | ||
} else if isEq then do { | ||
print_goal_summary; | ||
z3; | ||
} else do { | ||
// empty tactic should fail here if there are any goals | ||
// not handled by the above | ||
return (); | ||
}; | ||
}; | ||
|
||
let main : TopLevel () = do { | ||
m <- llvm_load_module "test.bc"; | ||
llvm_verify m "f" [] false f_spec tac; | ||
print "done"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
$SAW test.saw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.