Enum llvm_ir::constant::Constant[][src]

pub enum Constant {
Show 51 variants Int { bits: u32, value: u64, }, Float(Float), Null(TypeRef), AggregateZero(TypeRef), Struct { name: Option<String>, values: Vec<ConstantRef>, is_packed: bool, }, Array { element_type: TypeRef, elements: Vec<ConstantRef>, }, Vector(Vec<ConstantRef>), Undef(TypeRef), BlockAddress, GlobalReference { name: Name, ty: TypeRef, }, TokenNone, Add(Add), Sub(Sub), Mul(Mul), UDiv(UDiv), SDiv(SDiv), URem(URem), SRem(SRem), And(And), Or(Or), Xor(Xor), Shl(Shl), LShr(LShr), AShr(AShr), FAdd(FAdd), FSub(FSub), FMul(FMul), FDiv(FDiv), FRem(FRem), ExtractElement(ExtractElement), InsertElement(InsertElement), ShuffleVector(ShuffleVector), ExtractValue(ExtractValue), InsertValue(InsertValue), GetElementPtr(GetElementPtr), Trunc(Trunc), ZExt(ZExt), SExt(SExt), FPTrunc(FPTrunc), FPExt(FPExt), FPToUI(FPToUI), FPToSI(FPToSI), UIToFP(UIToFP), SIToFP(SIToFP), PtrToInt(PtrToInt), IntToPtr(IntToPtr), BitCast(BitCast), AddrSpaceCast(AddrSpaceCast), ICmp(ICmp), FCmp(FCmp), Select(Select),
}
Expand description

See LLVM 12 docs on Constants. Constants can be either values, or expressions involving other constants (see LLVM 12 docs on Constant Expressions).

Variants

Int

Fields of Int

bits: u32

Number of bits in the constant integer

value: u64

The constant value itself.

If bits == 64, this is the value.

If bits < 64, the constant value is zero-extended to fit in this field.

If bits > 64, the constant value is truncated to fit in this field; but if this truncation would change the value (i.e., if the value is >= 2^64 when interpreted as unsigned) then Module::from_bc_path() will fail. See #5.

Float(Float)

Tuple Fields of Float

0: Float
Null(TypeRef)

The TypeRef here must be to a PointerType. See LLVM 12 docs on Simple Constants

Tuple Fields of Null

0: TypeRef
AggregateZero(TypeRef)

A zero-initialized array or struct (or scalar).

Tuple Fields of AggregateZero

0: TypeRef
Struct

Fields of Struct

name: Option<String>values: Vec<ConstantRef>is_packed: bool
Array

Fields of Array

element_type: TypeRefelements: Vec<ConstantRef>
Vector(Vec<ConstantRef>)

Tuple Fields of Vector

0: Vec<ConstantRef>
Undef(TypeRef)

Undef can be used anywhere a constant is expected. See LLVM 12 docs on Undefined Values

Tuple Fields of Undef

0: TypeRef
BlockAddress

The address of the given (non-entry) BasicBlock. See LLVM 12 docs on Addresses of Basic Blocks. BlockAddress needs more fields, but the necessary getter functions are apparently not exposed in the LLVM C API (only the C++ API)

GlobalReference

Fields of GlobalReference

name: Namety: TypeRef
TokenNone
Add(Add)

Tuple Fields of Add

0: Add
Sub(Sub)

Tuple Fields of Sub

0: Sub
Mul(Mul)

Tuple Fields of Mul

0: Mul
UDiv(UDiv)

Tuple Fields of UDiv

0: UDiv
SDiv(SDiv)

Tuple Fields of SDiv

0: SDiv
URem(URem)

Tuple Fields of URem

0: URem
SRem(SRem)

Tuple Fields of SRem

0: SRem
And(And)

Tuple Fields of And

0: And
Or(Or)

Tuple Fields of Or

0: Or
Xor(Xor)

Tuple Fields of Xor

0: Xor
Shl(Shl)

Tuple Fields of Shl

0: Shl
LShr(LShr)

Tuple Fields of LShr

0: LShr
AShr(AShr)

Tuple Fields of AShr

0: AShr
FAdd(FAdd)

Tuple Fields of FAdd

0: FAdd
FSub(FSub)

Tuple Fields of FSub

0: FSub
FMul(FMul)

Tuple Fields of FMul

0: FMul
FDiv(FDiv)

Tuple Fields of FDiv

0: FDiv
FRem(FRem)

Tuple Fields of FRem

0: FRem
ExtractElement(ExtractElement)

Tuple Fields of ExtractElement

0: ExtractElement
InsertElement(InsertElement)

Tuple Fields of InsertElement

0: InsertElement
ShuffleVector(ShuffleVector)

Tuple Fields of ShuffleVector

0: ShuffleVector
ExtractValue(ExtractValue)

Tuple Fields of ExtractValue

0: ExtractValue
InsertValue(InsertValue)

Tuple Fields of InsertValue

0: InsertValue
GetElementPtr(GetElementPtr)

Tuple Fields of GetElementPtr

0: GetElementPtr
Trunc(Trunc)

Tuple Fields of Trunc

0: Trunc
ZExt(ZExt)

Tuple Fields of ZExt

0: ZExt
SExt(SExt)

Tuple Fields of SExt

0: SExt
FPTrunc(FPTrunc)

Tuple Fields of FPTrunc

0: FPTrunc
FPExt(FPExt)

Tuple Fields of FPExt

0: FPExt
FPToUI(FPToUI)

Tuple Fields of FPToUI

0: FPToUI
FPToSI(FPToSI)

Tuple Fields of FPToSI

0: FPToSI
UIToFP(UIToFP)

Tuple Fields of UIToFP

0: UIToFP
SIToFP(SIToFP)

Tuple Fields of SIToFP

0: SIToFP
PtrToInt(PtrToInt)

Tuple Fields of PtrToInt

0: PtrToInt
IntToPtr(IntToPtr)

Tuple Fields of IntToPtr

0: IntToPtr
BitCast(BitCast)

Tuple Fields of BitCast

0: BitCast
AddrSpaceCast(AddrSpaceCast)

Tuple Fields of AddrSpaceCast

0: AddrSpaceCast
ICmp(ICmp)

Tuple Fields of ICmp

0: ICmp
FCmp(FCmp)

Tuple Fields of FCmp

0: FCmp
Select(Select)

Tuple Fields of Select

0: Select

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.