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 core::u32;
12use cranelift_codegen::entity::entity_impl;
13
14/// An opaque reference to a variable.
15#[derive(Copy, Clone, PartialEq, Eq)]
16pub struct Variable(u32);
17
18entity_impl!(Variable, "var");