pub enum Constant {
Null,
Undef,
Integer(i64),
Float(u64),
Aggregate(Vec<ValueId>),
Data(Vec<u64>),
String(Vec<u8>),
Gep {
base: ValueId,
indices: Vec<ValueId>,
source: TypeId,
inbounds: bool,
},
Cast {
op: CastOp,
value: ValueId,
},
Binary {
op: BinaryOp,
lhs: ValueId,
rhs: ValueId,
flags: u64,
},
Compare {
predicate: u64,
lhs: ValueId,
rhs: ValueId,
},
}Expand description
A module-level constant.
Variants§
Null
The null value of the constant’s type (zero).
Undef
An undefined value.
Integer(i64)
An integer’s bits, sign-extended from its width.
Float(u64)
A float’s bits (half, float or double by its type).
Aggregate(Vec<ValueId>)
An array, structure or vector of other constants (value ids).
Data(Vec<u64>)
A constant array or vector of numbers, as stored (the bits of each element).
String(Vec<u8>)
An array of i8 given as text: its bytes, with the terminating zero a CST_CODE_CSTRING record implies.
Gep
A constant getelementptr: the base (a global) and its indices (module constants).
Fields
Cast
A constant cast of a module value (to the type of the constant).
Binary
A constant binary operation on module values.
Fields
§
flags: u64The record’s flags, as Instruction::flags.
Compare
A constant comparison of module values, by its LLVM predicate (as Op::Compare).
Trait Implementations§
impl StructuralPartialEq for Constant
Auto Trait Implementations§
impl Forget for Constant
impl Freeze for Constant
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnsafeUnpin for Constant
impl UnwindSafe for Constant
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