minirust
minirust copied to clipboard
Add more intrinsics
Rust intrinsics are basically primitive operations of the language. So I think it makes most sense to add them as (unary or binary) operators to MiniRust, or possibly as statements of they don't return anything. The unary vs binary split is a bit annoying but maybe not too bad...
So, we should probably make a list of intrinsics that we should support. I'm just going to start writing down a few but this is surely not exhaustive yet.
- [x] offset and wrapping_offset
- [ ] offset_from
Other intrinsics can probably be implemented as regular MiniRust functions and don't need to be primitives -- we can define their semantics via lower-level MiniRust code:
- [ ] unchecked_{add,sub,mul,div,shl,shr}, exact_div
- [ ] copy, copy_nonoverlapping
unchecked_add is also required for the minimizer to transpile range loops like
for i in 0..n {}