cranelift_frontend/variable.rs
1//! A basic `Variable` implementation.
2//!
3//! Frontends can use any indexing scheme they see fit and
4//! generate the appropriate `Variable` instances.
5//!
6//! Note: The `Variable` is used by Cranelift to index into densely allocated
7//! arrays containing information about your mutable variables
8//! Thus, make sure that Variable's indexes are allocated contiguously and
9//! starting at `0`.
10
11use cranelift_codegen::entity::entity_impl;
12
13/// An opaque reference to a variable.
14#[derive(Copy, Clone, PartialEq, Eq)]
15pub struct Variable(u32);
16
17entity_impl!(Variable, "var");