Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ code-bin/
vendor/mlir/lib/

vendor/mlir
backup/
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,54 @@ vendor/solidity // vendor libs
- Run all suites: `zig build test`
- Fixture-based semantics tests live under `tests/fixtures/semantics/{valid,invalid}`.

## MLIR Integration

The Ora compiler includes comprehensive MLIR lowering capabilities:

### Features
- **Type Mapping:** All Ora types mapped to appropriate MLIR representations
- **Memory Regions:** Storage/memory/tstore semantics preserved in MLIR
- **Source Locations:** Complete source location tracking through MLIR
- **Error Handling:** Comprehensive error reporting with recovery
- **Pass Integration:** Works with MLIR's optimization pass infrastructure
- **Verification:** Contract preconditions and postconditions in MLIR

### MLIR CLI Usage

Generate MLIR output:
```bash
./zig-out/bin/ora compile --emit-mlir contract.ora
```

Verify MLIR correctness:
```bash
./zig-out/bin/ora compile --mlir-verify contract.ora
```

Run MLIR optimization passes:
```bash
./zig-out/bin/ora compile --mlir-passes="canonicalize,cse" contract.ora
```

### Example MLIR Output

For a simple Ora function:
```ora
fn add(a: u256, b: u256) -> u256 {
return a + b;
}
```

The MLIR output includes:
```mlir
func.func @add(%arg0: i256, %arg1: i256) -> i256 {
%0 = arith.addi %arg0, %arg1 : i256
return %0 : i256
}
```

See `docs/mlir-lowering.md` for comprehensive technical documentation.

## CLI usage

Use the installed executable:
Expand Down
Loading
Loading