-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crucible-llvm-syntax: Syntax for all LLVM expressions
- Loading branch information
1 parent
2c6c89c
commit 100d1dc
Showing
5 changed files
with
78 additions
and
17 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 |
---|---|---|
|
@@ -91,7 +91,6 @@ library | |
|
||
build-depends: | ||
base >= 4.13, | ||
bv-sized, | ||
crucible >= 0.1, | ||
crucible-llvm, | ||
crucible-syntax, | ||
|
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
(defun @test-ptr () (Ptr 64) | ||
(start start: | ||
(let n (null)) | ||
(return n))) | ||
(let blk0 (the Nat 0)) | ||
(let off0 (bv 64 0)) | ||
(let p (ptr 64 blk0 off0)) | ||
(let blk (ptr-block 64 p)) | ||
(let off (ptr-offset 64 p)) | ||
(assert! (equal? blk0 blk) "block numbers equal") | ||
(assert! (equal? off0 off) "offsets equal") | ||
(return p))) |
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 |
---|---|---|
@@ -1,14 +1,38 @@ | ||
(defun @test-ptr () (Ptr 64) | ||
(start start: (let n (null)) (return n))) | ||
(start start: | ||
(let blk0 (the Nat 0)) | ||
(let off0 (bv 64 0)) | ||
(let p (ptr 64 blk0 off0)) | ||
(let blk (ptr-block 64 p)) | ||
(let off (ptr-offset 64 p)) | ||
(assert! (equal? blk0 blk) "block numbers equal") | ||
(assert! (equal? off0 off) "offsets equal") | ||
(return p))) | ||
|
||
test-ptr | ||
%0 | ||
% 3:12 | ||
% 3:15 | ||
$0 = natLit(0) | ||
% 3:12 | ||
% 4:15 | ||
$1 = bVLit(64, BV 0) | ||
% 3:12 | ||
% 5:12 | ||
$2 = extensionApp(pointerExpr $0 $1) | ||
% 4:5 | ||
% 6:14 | ||
$3 = extensionApp(pointerBlock $2) | ||
% 7:14 | ||
$4 = extensionApp(pointerOffset $2) | ||
% 8:14 | ||
$5 = natEq($0, $3) | ||
% 8:32 | ||
$6 = stringLit("block numbers equal") | ||
% 8:5 | ||
assert($5, $6) | ||
% 9:14 | ||
$7 = baseIsEq(BaseBVRepr 64, $1, $4) | ||
% 9:32 | ||
$8 = stringLit("offsets equal") | ||
% 9:5 | ||
assert($7, $8) | ||
% 10:5 | ||
return $2 | ||
% no postdom |