Skip to content

Commit

Permalink
crucible-llvm-syntax: README tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett committed Nov 1, 2023
1 parent dd5af77 commit 30fbe47
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions crucible-llvm-syntax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@ statements:

**Types**:

- `(Ptr n)` for a positive numeral `n` represents the type of LLVM pointers that are `n` bits wide. For example `(Ptr 8)` is the type of bytes.
- `(Ptr n)` for a positive numeral `n` represents the type of LLVM pointers that are `n` bits wide; for example `(Ptr 8)` is the type of bytes

**Primitive atoms**:

- `none : Alignment`: no alignment
- `i8 : LLVMType`
- `i16 : LLVMType`
- `i32 : LLVMType`
- `i64 : LLVMType`
- `ptr : LLVMType`
- `i8 : LLVMType`: [LLVM docs][int-type], corresponds to Crucible-LLVM's `IntType 8 :: MemType`
- `i16 : LLVMType`: [LLVM docs][int-type], corresponds to Crucible-LLVM's `IntType 16 :: MemType`
- `i32 : LLVMType`: [LLVM docs][int-type], corresponds to Crucible-LLVM's `IntType 32 :: MemType`
- `i64 : LLVMType`: [LLVM docs][int-type], corresponds to Crucible-LLVM's `IntType 64 :: MemType`
- `ptr : LLVMType`: [LLVM docs][ptr-type], corresponds to Crucible-LLVM's `IntType 64 :: PtrOpaqueType`

[int-type]: https://llvm.org/docs/LangRef.html#integer-type
[ptr-type]: https://llvm.org/docs/LangRef.html#pointer-type

**Statements**:

If the numeral representing `w` the pointer width and `n` is an arbitrary numeral,

- `ptr : Nat -> Bitvector w -> Ptr w`: construct a pointer from a block and offset
- `ptr : Nat -> Bitvector n -> Ptr n`: construct a pointer from a block and offset
- `ptr-block : Ptr n -> Nat`: get the block number of a pointer
- `ptr-offset : Ptr n -> Bitvector n`: get the offset of a pointer
- `ptr-ite : Bool -> Ptr n -> Ptr n -> Ptr n`: if-then-else for pointers
Expand Down

0 comments on commit 30fbe47

Please sign in to comment.