-
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 #1890 from GaloisInc/bb/glob-manual-example
Fix global variable example in manual
- Loading branch information
Showing
8 changed files
with
53 additions
and
5 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
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
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,13 @@ | ||
m <- llvm_load_module "test-signed.bc"; | ||
|
||
f_spec <- llvm_verify m "f" [] true (do { | ||
y <- llvm_fresh_var "y" (llvm_int 32); | ||
llvm_execute_func [llvm_term y]; | ||
llvm_return (llvm_term {{ 1 + y : [32] }}); | ||
}) abc; | ||
|
||
g_spec <- llvm_llvm_verify m "g" [] true (do { | ||
z <- llvm_fresh_var "z" (llvm_int 32); | ||
llvm_execute_func [llvm_term z]; | ||
llvm_return (llvm_term {{ 2 + z : [32] }}); | ||
}) abc; |
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,11 @@ | ||
int x = 0; | ||
|
||
int f(int y) { | ||
x = x + 1; | ||
return x + y; | ||
} | ||
|
||
int g(int z) { | ||
x = x + 2; | ||
return x + z; | ||
} |
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,16 @@ | ||
m <- llvm_load_module "test-signed.bc"; | ||
|
||
|
||
let init_global name = do { | ||
llvm_alloc_global name; | ||
llvm_points_to (llvm_global name) | ||
(llvm_global_initializer name); | ||
}; | ||
|
||
f_spec <- llvm_verify m "f" [] true (do { | ||
y <- llvm_fresh_var "y" (llvm_int 32); | ||
init_global "x"; | ||
llvm_precond {{ y < 2^^31 - 1 }}; | ||
llvm_execute_func [llvm_term y]; | ||
llvm_return (llvm_term {{ 1 + y : [32] }}); | ||
}) abc; |
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