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

pub enum Constant {
    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),
}

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

Variants

Int

Fields of Int

bits: u32value: u64
Float(Float)
Null(TypeRef)

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

AggregateZero(TypeRef)

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

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>)
Undef(TypeRef)

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

BlockAddress

The address of the given (non-entry) BasicBlock. See LLVM 10 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)
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)

Trait Implementations

impl AsRef<Constant> for ConstantRef[src]

impl Clone for Constant[src]

impl Debug for Constant[src]

impl From<AShr> for Constant[src]

impl From<Add> for Constant[src]

impl From<AddrSpaceCast> for Constant[src]

impl From<And> for Constant[src]

impl From<BitCast> for Constant[src]

impl From<ExtractElement> for Constant[src]

impl From<ExtractValue> for Constant[src]

impl From<FAdd> for Constant[src]

impl From<FCmp> for Constant[src]

impl From<FDiv> for Constant[src]

impl From<FMul> for Constant[src]

impl From<FPExt> for Constant[src]

impl From<FPToSI> for Constant[src]

impl From<FPToUI> for Constant[src]

impl From<FPTrunc> for Constant[src]

impl From<FRem> for Constant[src]

impl From<FSub> for Constant[src]

impl From<GetElementPtr> for Constant[src]

impl From<ICmp> for Constant[src]

impl From<InsertElement> for Constant[src]

impl From<InsertValue> for Constant[src]

impl From<IntToPtr> for Constant[src]

impl From<LShr> for Constant[src]

impl From<Mul> for Constant[src]

impl From<Or> for Constant[src]

impl From<PtrToInt> for Constant[src]

impl From<SDiv> for Constant[src]

impl From<SExt> for Constant[src]

impl From<SIToFP> for Constant[src]

impl From<SRem> for Constant[src]

impl From<Select> for Constant[src]

impl From<Shl> for Constant[src]

impl From<ShuffleVector> for Constant[src]

impl From<Sub> for Constant[src]

impl From<Trunc> for Constant[src]

impl From<UDiv> for Constant[src]

impl From<UIToFP> for Constant[src]

impl From<URem> for Constant[src]

impl From<Xor> for Constant[src]

impl From<ZExt> for Constant[src]

impl PartialEq<Constant> for Constant[src]

impl StructuralPartialEq for Constant[src]

impl TryFrom<Constant> for Add[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Sub[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Shl[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for LShr[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for AShr[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FAdd[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FSub[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FMul[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FDiv[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FRem[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for ExtractElement[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for InsertElement[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Mul[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for ShuffleVector[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for ExtractValue[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for InsertValue[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for GetElementPtr[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Trunc[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for ZExt[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for SExt[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FPTrunc[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FPExt[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FPToUI[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for UDiv[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FPToSI[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for UIToFP[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for SIToFP[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for PtrToInt[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for IntToPtr[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for BitCast[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for AddrSpaceCast[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for ICmp[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for FCmp[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Select[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for SDiv[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for URem[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for SRem[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for And[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Or[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Constant> for Xor[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl Typed for Constant[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.