Skip to content

Commit 35c88e4

Browse files
committed
- Add volatile flag to Load/Store memory operations with instr_load_ex
and instr_store_ex methods - Add FunctionAttrs struct with 15 function-level attributes (nounwind, noreturn, cold, hot, willreturn, nosync, nofree, norecurse, readnone, readonly, writeonly, inlinehint, alwaysinline, noinline, minsize, optsize) and LLVM lowering support - Implement GEP type inference with compute_gep_result_type() helper, GepIndexKind enum, and GepTypeError. Update instr_gep() to auto-infer result type; add instr_gep_ex() for explicit type specification - Add comprehensive intrinsics system with Intrinsic enum supporting: - Memory: memcpy, memset, memmove - Overflow: sadd/uadd/ssub/usub/smul/umul.with.overflow - Math: sqrt, sin, cos, exp, log, fabs, floor, ceil, pow, fma, etc. - Bit manipulation: ctpop, ctlz, cttz, bitreverse, bswap, fshl, fshr - Other: expect, assume, trap, debugtrap - Update ROADMAP.md to reflect completed items
1 parent 00f1747 commit 35c88e4

File tree

8 files changed

+1614
-19
lines changed

8 files changed

+1614
-19
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,4 @@ The MCJIT execution engine only supports certain parameter/return types reliably
164164
- Prefer explicit types over inference for public APIs
165165
- Use `Location` for source mapping on all constructs
166166
- Clone-friendly types (most types derive Clone)
167+
- Use `cargo fmt` after changes

ROADMAP.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ This document outlines the planned features and improvements for IRVM.
2323
## Medium Priority (v0.3.0)
2424

2525
### Intrinsics System
26-
- [ ] Design intrinsics declaration mechanism
27-
- [ ] Implement `llvm.memcpy`, `llvm.memset`, `llvm.memmove`
28-
- [ ] Implement overflow intrinsics (`llvm.sadd.with.overflow`, etc.)
29-
- [ ] Implement math intrinsics (`llvm.sqrt`, `llvm.sin`, `llvm.cos`, etc.)
30-
- [ ] Implement bit manipulation intrinsics (`llvm.ctpop`, `llvm.ctlz`, `llvm.cttz`)
26+
- [x] Design intrinsics declaration mechanism
27+
- [x] Implement `llvm.memcpy`, `llvm.memset`, `llvm.memmove`
28+
- [x] Implement overflow intrinsics (`llvm.sadd.with.overflow`, etc.)
29+
- [x] Implement math intrinsics (`llvm.sqrt`, `llvm.sin`, `llvm.cos`, etc.)
30+
- [x] Implement bit manipulation intrinsics (`llvm.ctpop`, `llvm.ctlz`, `llvm.cttz`)
3131

3232
### Function & Call Attributes
33-
- [ ] Function attributes: `nounwind`, `noreturn`, `cold`, `hot`, `willreturn`, `nosync`, `nofree`
33+
- [x] Function attributes: `nounwind`, `noreturn`, `cold`, `hot`, `willreturn`, `nosync`, `nofree`
3434
- [ ] Parameter attributes: `nocapture`, `readonly`, `writeonly`, `dereferenceable(N)`
3535
- [ ] Return attributes: `noalias`, `noundef`, `dereferenceable(N)`
3636
- [ ] GC name support
3737
- [ ] Prefix/prologue data
3838

3939
### GEP Type Inference
40-
- [ ] Implement automatic result type computation for GEP
41-
- [ ] Add `compute_gep_result_type` helper function
42-
- [ ] Update `instr_gep` to infer result type automatically
43-
- [ ] Keep `instr_gep_ex` for explicit type specification
40+
- [x] Implement automatic result type computation for GEP
41+
- [x] Add `compute_gep_result_type` helper function
42+
- [x] Update `instr_gep` to infer result type automatically
43+
- [x] Keep `instr_gep_ex` for explicit type specification
4444

4545
### Memory Operation Enhancements
46-
- [ ] Add `volatile` flag to load/store
46+
- [x] Add `volatile` flag to load/store
4747
- [ ] Proper alignment validation
4848
- [ ] Non-temporal hints
4949

irvm-lower/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ mod test {
247247
&storage,
248248
)?;
249249

250-
let ptr_idx1 = func.blocks[entry].instr_gep(
250+
let ptr_idx1 = func.blocks[entry].instr_gep_ex(
251251
ptr_val,
252252
&[GepIndex::Const(1)],
253253
ptr_ty,

0 commit comments

Comments
 (0)