pub enum Const {
Int(i64),
Float(f64),
Bool(bool),
}Expand description
A constant operand loaded by Op::Const.
The three cases mirror the IR’s three constant instructions
(Iconst, Fconst,
Bconst) and carry the same payloads, so a constant is
reproduced exactly rather than widened or reinterpreted.
§Examples
use codegen_lang::Const;
assert_eq!(Const::Int(-7).to_string(), "-7");
assert_eq!(Const::Bool(true).to_string(), "true");Variants§
Int(i64)
A signed-integer constant.
Float(f64)
A floating-point constant.
Bool(bool)
A boolean constant.
Trait Implementations§
impl Copy for Const
Source§impl<'de> Deserialize<'de> for Const
impl<'de> Deserialize<'de> for Const
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Const
Auto Trait Implementations§
impl Freeze for Const
impl RefUnwindSafe for Const
impl Send for Const
impl Sync for Const
impl Unpin for Const
impl UnsafeUnpin for Const
impl UnwindSafe for Const
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more