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

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

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

Variants

Int

Fields of Int

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

The Type here must be a PointerType. See LLVM 9 docs on Simple Constants

AggregateZero(Type)

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

Struct

Fields of Struct

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

Fields of Array

element_type: Typeelements: Vec<Constant>
Vector(Vec<Constant>)
Undef(Type)

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

BlockAddress

The address of the given (non-entry) BasicBlock. See LLVM 9 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: Type
TokenNone
Add(Box<Add>)
Sub(Box<Sub>)
Mul(Box<Mul>)
UDiv(Box<UDiv>)
SDiv(Box<SDiv>)
URem(Box<URem>)
SRem(Box<SRem>)
And(Box<And>)
Or(Box<Or>)
Xor(Box<Xor>)
Shl(Box<Shl>)
LShr(Box<LShr>)
AShr(Box<AShr>)
FAdd(Box<FAdd>)
FSub(Box<FSub>)
FMul(Box<FMul>)
FDiv(Box<FDiv>)
FRem(Box<FRem>)
ExtractElement(Box<ExtractElement>)
InsertElement(Box<InsertElement>)
ShuffleVector(Box<ShuffleVector>)
ExtractValue(Box<ExtractValue>)
InsertValue(Box<InsertValue>)
GetElementPtr(Box<GetElementPtr>)
Trunc(Box<Trunc>)
ZExt(Box<ZExt>)
SExt(Box<SExt>)
FPTrunc(Box<FPTrunc>)
FPExt(Box<FPExt>)
FPToUI(Box<FPToUI>)
FPToSI(Box<FPToSI>)
UIToFP(Box<UIToFP>)
SIToFP(Box<SIToFP>)
PtrToInt(Box<PtrToInt>)
IntToPtr(Box<IntToPtr>)
BitCast(Box<BitCast>)
AddrSpaceCast(Box<AddrSpaceCast>)
ICmp(Box<ICmp>)
FCmp(Box<FCmp>)
Select(Box<Select>)

Trait Implementations

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.