Summary
LLVM address generation accepts integer literals and a small set of lvalue expressions as array or pointer indices, then panics for other expression forms. Semantically valid indices such as arithmetic expressions, casts, and function results must not reach an unsupported backend panic.
Related issue
Relevant code
llvm/src/codegen/address.rs
- expression lowering and typed expression information
- semantic index validation
Scope
Use the normal typed integer expression lowering path for index operands, then normalize the resulting integer to the target index width. Keep address calculation and GEP invariants explicit.
Acceptance criteria
- Literals, variables, arithmetic, grouped expressions, casts, field results, and function-call results work as indices when semantically valid.
- Signed and unsigned integer widths are normalized deliberately.
- Non-integer indices are rejected by the frontend with a source diagnostic.
- No index expression can trigger
Index int expr not supported yet or an equivalent panic.
- Tests cover arrays, pointers, nested indexing, negative indices where permitted, and target-width differences.
- Existing opaque-pointer and GEP safety invariants remain documented and valid.
Summary
LLVM address generation accepts integer literals and a small set of lvalue expressions as array or pointer indices, then panics for other expression forms. Semantically valid indices such as arithmetic expressions, casts, and function results must not reach an unsupported backend panic.
Related issue
Relevant code
llvm/src/codegen/address.rsScope
Use the normal typed integer expression lowering path for index operands, then normalize the resulting integer to the target index width. Keep address calculation and GEP invariants explicit.
Acceptance criteria
Index int expr not supported yetor an equivalent panic.