Enum llvm_ir::operand::Operand [−][src]
pub enum Operand { LocalOperand { name: Name, ty: TypeRef, }, ConstantOperand(ConstantRef), MetadataOperand, }
Variants
e.g., i32 %foo
ConstantOperand(ConstantRef)
includes GlobalReference
for things like @foo
Implementations
Get a reference to the Constant
, if the operand is a constant;
otherwise, returns None
.
This allows nested matching on Operand
. Instead of the following code
(which doesn’t compile because you can’t directly match on ConstantRef
)
ⓘ
if let Operand::ConstantOperand(Constant::Float(Float::Double(val))) = op
you can write this:
ⓘ
if let Some(Constant::Float(Float::Double(val))) = op.as_constant()
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Operand
impl UnwindSafe for Operand
Blanket Implementations
Mutably borrows from an owned value. Read more