gccrs: Intrinsically compile slice index referencing
Enables intrinsic code generation for slice indexing operations.
This commit enhances gccrs by implementing intrinsic code generation for slice indexing. It modifies the type checking and expression compilation for HIR::ArrayIndexExpr to correctly handle slice types. This ensures that operations like indexing into a slice, which were previously problematic, are now efficiently translated into machine code.
In Details
The changes in typecheck/rust-hir-type-check-expr.cc and backend/rust-compile-expr.cc add support for HIR::ArrayIndexExpr when the target type is a slice. This involves implementing intrinsic code generation for slice indexing, allowing expressions like slice[index] to be compiled efficiently, mirroring how Rust's standard library handles such operations.
- HIR::ArrayIndexExpr
- Represents an array index expression in the High-Level Intermediate Representation (HIR) of the Rust compiler.
- intrinsic code generation
- The process by which the compiler directly generates machine code for certain operations, often by using specialized processor instructions, rather than through general-purpose intermediate representation (IR) lowering.