Enum llvm_ir::constant::Constant [−][src]
See LLVM 12 docs on Constants. Constants can be either values, or expressions involving other constants (see LLVM 12 docs on Constant Expressions).
Variants
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)
Null(TypeRef)
The TypeRef
here must be to a PointerType
. See LLVM 12 docs on Simple Constants
AggregateZero(TypeRef)
A zero-initialized array or struct (or scalar).
Fields of Struct
Fields of Array
element_type: TypeRef
elements: Vec<ConstantRef>
Vector(Vec<ConstantRef>)
Undef(TypeRef)
Undef
can be used anywhere a constant is expected. See LLVM 12 docs on Undefined Values
Poison(TypeRef)
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)
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 Display for Constant
[src]
impl From<AShr> for Constant
[src]
impl From<Add> for Constant
[src]
impl From<AddrSpaceCast> for Constant
[src]
fn from(expr: AddrSpaceCast) -> Constant
[src]
impl From<And> for Constant
[src]
impl From<BitCast> for Constant
[src]
impl From<ExtractElement> for Constant
[src]
fn from(expr: ExtractElement) -> Constant
[src]
impl From<ExtractValue> for Constant
[src]
fn from(expr: ExtractValue) -> 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]
fn from(expr: GetElementPtr) -> Constant
[src]
impl From<ICmp> for Constant
[src]
impl From<InsertElement> for Constant
[src]
fn from(expr: InsertElement) -> Constant
[src]
impl From<InsertValue> for Constant
[src]
fn from(expr: InsertValue) -> 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]
fn from(expr: ShuffleVector) -> 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.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Sub
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Shl
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for LShr
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for AShr
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FAdd
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FSub
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FMul
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FDiv
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FRem
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for ExtractElement
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for InsertElement
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Mul
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for ShuffleVector
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for ExtractValue
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for InsertValue
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for GetElementPtr
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Trunc
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for ZExt
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for SExt
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FPTrunc
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FPExt
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FPToUI
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for UDiv
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FPToSI
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for UIToFP
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for SIToFP
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for PtrToInt
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for IntToPtr
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for BitCast
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for AddrSpaceCast
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for ICmp
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for FCmp
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Select
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for SDiv
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for URem
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for SRem
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for And
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Or
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl TryFrom<Constant> for Xor
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(constant: Constant) -> Result<Self, Self::Error>
[src]
impl Typed for Constant
[src]
Auto Trait Implementations
impl RefUnwindSafe for Constant
[src]
impl Send for Constant
[src]
impl Sync for Constant
[src]
impl Unpin for Constant
[src]
impl UnwindSafe for Constant
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,