-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
83 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CC = clang | ||
CFLAGS = -g -emit-llvm -frecord-command-line -O2 | ||
|
||
all: test.bc | ||
|
||
test.bc: test.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f test.bc |
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,10 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
const size_t LEN = 42; | ||
|
||
void zip_with_add(uint64_t c[LEN], const uint64_t a[LEN], const uint64_t b[LEN]) { | ||
for (size_t i = 0; i < LEN; i++) { | ||
c[i] = a[i] + b[i]; | ||
} | ||
} |
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,29 @@ | ||
enable_lax_pointer_ordering; | ||
|
||
let alloc_init_readonly ty v = do { | ||
p <- llvm_alloc_readonly ty; | ||
llvm_points_to p v; | ||
return p; | ||
}; | ||
|
||
let ptr_to_fresh_readonly n ty = do { | ||
x <- llvm_fresh_var n ty; | ||
p <- alloc_init_readonly ty (llvm_term x); | ||
return (x, p); | ||
}; | ||
|
||
let LEN = 42; | ||
|
||
let zip_with_add_spec = do { | ||
let array_ty = llvm_array LEN (llvm_int 64); | ||
c_ptr <- llvm_alloc array_ty; | ||
(a, a_ptr) <- ptr_to_fresh_readonly "a" array_ty; | ||
(b, b_ptr) <- ptr_to_fresh_readonly "b" array_ty; | ||
|
||
llvm_execute_func [c_ptr, a_ptr, b_ptr]; | ||
|
||
llvm_points_to c_ptr (llvm_term {{ zipWith`{LEN} (+) a b }}); | ||
}; | ||
|
||
mod <- llvm_load_module "test.bc"; | ||
llvm_verify mod "zip_with_add" [] false zip_with_add_spec z3; |
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,3 @@ | ||
set -e | ||
|
||
$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
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