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