Documentation ¶
Overview ¶
Package constant implements values representing immutable LLVM IR constants.
Index ¶
- Variables
- type Array
- type BlockAddress
- type CharArray
- type Constant
- type DSOLocalEquivalent
- type ExprAShr
- type ExprAdd
- type ExprAddrSpaceCast
- type ExprAnd
- type ExprBitCast
- type ExprExtractElement
- type ExprExtractValue
- type ExprFAdd
- type ExprFCmp
- type ExprFDiv
- type ExprFMul
- type ExprFNeg
- type ExprFPExt
- type ExprFPToSI
- type ExprFPToUI
- type ExprFPTrunc
- type ExprFRem
- type ExprFSub
- type ExprGetElementPtr
- type ExprICmp
- type ExprInsertElement
- type ExprInsertValue
- type ExprIntToPtr
- type ExprLShr
- type ExprMul
- type ExprOr
- type ExprPtrToInt
- type ExprSDiv
- type ExprSExt
- type ExprSIToFP
- type ExprSRem
- type ExprSelect
- type ExprShl
- type ExprShuffleVector
- type ExprSub
- type ExprTrunc
- type ExprUDiv
- type ExprUIToFP
- type ExprURem
- type ExprXor
- type ExprZExt
- type Expression
- type Float
- type Index
- type Int
- type NoCFI
- type NoneToken
- type Null
- type Poison
- type Struct
- type Undef
- type Vector
- type ZeroInitializer
Constants ¶
This section is empty.
Variables ¶
var ( // None token constant. None = &NoneToken{} // none // Boolean constants. True = NewInt(types.I1, 1) // true False = NewInt(types.I1, 0) // false )
Convenience constants.
Functions ¶
This section is empty.
Types ¶
type Array ¶
Array is an LLVM IR array constant.
func NewArray ¶
NewArray returns a new array constant based on the given array type and elements. The array type is infered from the type of the elements if t is nil.
func (*Array) IsConstant ¶
func (*Array) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type BlockAddress ¶
type BlockAddress struct { // Parent function. Func Constant // *ir.Func // Basic block to take address of. Block value.Named // *ir.Block }
BlockAddress is an LLVM IR blockaddress constant.
func NewBlockAddress ¶
func NewBlockAddress(f Constant, block value.Named) *BlockAddress
NewBlockAddress returns a new blockaddress constant based on the given parent function and basic block.
func (*BlockAddress) Ident ¶
func (c *BlockAddress) Ident() string
Ident returns the identifier associated with the constant.
func (*BlockAddress) IsConstant ¶
func (*BlockAddress) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*BlockAddress) String ¶
func (c *BlockAddress) String() string
String returns the LLVM syntax representation of the constant as a type-value pair.
func (*BlockAddress) Type ¶
func (c *BlockAddress) Type() types.Type
Type returns the type of the constant.
type CharArray ¶
CharArray is an LLVM IR character array constant.
func NewCharArray ¶
NewCharArray returns a new character array constant based on the given character array contents.
func NewCharArrayFromString ¶
NewCharArrayFromString returns a new character array constant based on the given UTF-8 string contents.
func (*CharArray) IsConstant ¶
func (*CharArray) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Constant ¶
type Constant interface { value.Value // IsConstant ensures that only constants can be assigned to the // constant.Constant interface. IsConstant() }
Constant is an LLVM IR constant; a value that is immutable at runtime, such as an integer or floating-point literal, or the address of a function or global variable.
A Constant has one of the following underlying types.
Simple constants ¶
https://llvm.org/docs/LangRef.html#simple-constants
*constant.Int // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Int *constant.Float // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Float *constant.Null // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Null *constant.NoneToken // https://pkg.go.dev/github.com/llir/llvm/ir/constant#NoneToken
Complex constants ¶
https://llvm.org/docs/LangRef.html#complex-constants
*constant.Struct // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Struct *constant.Array // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Array *constant.CharArray // https://pkg.go.dev/github.com/llir/llvm/ir/constant#CharArray *constant.Vector // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Vector *constant.ZeroInitializer // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ZeroInitializer TODO: include metadata node?
Global variable and function addresses ¶
https://llvm.org/docs/LangRef.html#global-variable-and-function-addresses
*ir.Global // https://pkg.go.dev/github.com/llir/llvm/ir#Global *ir.Func // https://pkg.go.dev/github.com/llir/llvm/ir#Func *ir.Alias // https://pkg.go.dev/github.com/llir/llvm/ir#Alias *ir.IFunc // https://pkg.go.dev/github.com/llir/llvm/ir#IFunc
Undefined values ¶
https://llvm.org/docs/LangRef.html#undefined-values
*constant.Undef // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Undef
Poison values ¶
https://llvm.org/docs/LangRef.html#poison-values
*constant.Poison // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Poison
Addresses of basic blocks ¶
https://llvm.org/docs/LangRef.html#addresses-of-basic-blocks
*constant.BlockAddress // https://pkg.go.dev/github.com/llir/llvm/ir/constant#BlockAddress
Constant expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
constant.Expression // https://pkg.go.dev/github.com/llir/llvm/ir/constant#Expression
type DSOLocalEquivalent ¶ added in v0.3.6
type DSOLocalEquivalent struct { // Underlying function. Func Constant // *ir.Func }
DSOLocalEquivalent is an LLVM IR dso_local_equivalent constant; a constant representing a function which is functionally equivalent to a given function, but is always defined in the current linkage unit.
ref: https://llvm.org/docs/LangRef.html#dso-local-equivalent
func NewDSOLocalEquivalent ¶ added in v0.3.6
func NewDSOLocalEquivalent(f Constant) *DSOLocalEquivalent
NewDSOLocalEquivalent returns a new dso_local_equivalent constant based on the given function.
func (*DSOLocalEquivalent) Ident ¶ added in v0.3.6
func (c *DSOLocalEquivalent) Ident() string
Ident returns the identifier associated with the constant.
func (*DSOLocalEquivalent) IsConstant ¶ added in v0.3.6
func (*DSOLocalEquivalent) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*DSOLocalEquivalent) String ¶ added in v0.3.6
func (c *DSOLocalEquivalent) String() string
String returns the LLVM syntax representation of the constant as a type-value pair.
func (*DSOLocalEquivalent) Type ¶ added in v0.3.6
func (c *DSOLocalEquivalent) Type() types.Type
Type returns the type of the constant.
type ExprAShr ¶
type ExprAShr struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
// (optional) The result is a poison value if any of the bits shifted out are
// non-zero.
Exact bool
}
ExprAShr is an LLVM IR ashr expression.
func (*ExprAShr) IsConstant ¶
func (*ExprAShr) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprAShr) IsExpression ¶ added in v0.3.4
func (*ExprAShr) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprAdd ¶
type ExprAdd struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
// (optional) Integer overflow flags.
OverflowFlags []enum.OverflowFlag
}
ExprAdd is an LLVM IR add expression.
func (*ExprAdd) IsConstant ¶
func (*ExprAdd) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprAdd) IsExpression ¶ added in v0.3.4
func (*ExprAdd) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprAddrSpaceCast ¶
type ExprAddrSpaceCast struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprAddrSpaceCast is an LLVM IR addrspacecast expression.
func NewAddrSpaceCast ¶
func NewAddrSpaceCast(from Constant, to types.Type) *ExprAddrSpaceCast
NewAddrSpaceCast returns a new addrspacecast expression based on the given source value and target type.
func (*ExprAddrSpaceCast) Ident ¶
func (e *ExprAddrSpaceCast) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprAddrSpaceCast) IsConstant ¶
func (*ExprAddrSpaceCast) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprAddrSpaceCast) IsExpression ¶ added in v0.3.4
func (*ExprAddrSpaceCast) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprAddrSpaceCast) String ¶
func (e *ExprAddrSpaceCast) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprAddrSpaceCast) Type ¶
func (e *ExprAddrSpaceCast) Type() types.Type
Type returns the type of the constant expression.
type ExprAnd ¶
type ExprAnd struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
}
ExprAnd is an LLVM IR and expression.
func (*ExprAnd) IsConstant ¶
func (*ExprAnd) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprAnd) IsExpression ¶ added in v0.3.4
func (*ExprAnd) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprBitCast ¶
type ExprBitCast struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprBitCast is an LLVM IR bitcast expression.
func NewBitCast ¶
func NewBitCast(from Constant, to types.Type) *ExprBitCast
NewBitCast returns a new bitcast expression based on the given source value and target type.
func (*ExprBitCast) Ident ¶
func (e *ExprBitCast) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprBitCast) IsConstant ¶
func (*ExprBitCast) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprBitCast) IsExpression ¶ added in v0.3.4
func (*ExprBitCast) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprBitCast) String ¶
func (e *ExprBitCast) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprBitCast) Type ¶
func (e *ExprBitCast) Type() types.Type
Type returns the type of the constant expression.
type ExprExtractElement ¶
type ExprExtractElement struct { // Vector. X Constant // Element index. Index Constant // Type of result produced by the constant expression. Typ types.Type }
ExprExtractElement is an LLVM IR extractelement expression.
func NewExtractElement ¶
func NewExtractElement(x, index Constant) *ExprExtractElement
NewExtractElement returns a new extractelement expression based on the given vector and element index.
func (*ExprExtractElement) Ident ¶
func (e *ExprExtractElement) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprExtractElement) IsConstant ¶
func (*ExprExtractElement) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprExtractElement) IsExpression ¶ added in v0.3.4
func (*ExprExtractElement) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprExtractElement) String ¶
func (e *ExprExtractElement) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprExtractElement) Type ¶
func (e *ExprExtractElement) Type() types.Type
Type returns the type of the constant expression.
type ExprExtractValue ¶
type ExprExtractValue struct { // Aggregate value. X Constant // Element indices. Indices []uint64 // Type of result produced by the constant expression. Typ types.Type }
ExprExtractValue is an LLVM IR extractvalue expression.
func NewExtractValue ¶
func NewExtractValue(x Constant, indices ...uint64) *ExprExtractValue
NewExtractValue returns a new extractvalue expression based on the given aggregate value and indicies.
func (*ExprExtractValue) Ident ¶
func (e *ExprExtractValue) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprExtractValue) IsConstant ¶
func (*ExprExtractValue) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprExtractValue) IsExpression ¶ added in v0.3.4
func (*ExprExtractValue) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprExtractValue) String ¶
func (e *ExprExtractValue) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprExtractValue) Type ¶
func (e *ExprExtractValue) Type() types.Type
Type returns the type of the constant expression.
type ExprFAdd ¶
type ExprFAdd struct {
// Operands.
X, Y Constant // floating-point scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprFAdd is an LLVM IR fadd expression.
func (*ExprFAdd) IsConstant ¶
func (*ExprFAdd) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFAdd) IsExpression ¶ added in v0.3.4
func (*ExprFAdd) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFCmp ¶
type ExprFCmp struct { // Floating-point comparison predicate. Pred enum.FPred // Floating-point scalar or vector operands. X, Y Constant // Type of result produced by the constant expression. Typ types.Type }
ExprFCmp is an LLVM IR fcmp expression.
func NewFCmp ¶
NewFCmp returns a new fcmp expression based on the given floating-point comparison predicate and floating-point scalar or vector operands.
func (*ExprFCmp) IsConstant ¶
func (*ExprFCmp) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFCmp) IsExpression ¶ added in v0.3.4
func (*ExprFCmp) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFDiv ¶
type ExprFDiv struct {
// Operands.
X, Y Constant // floating-point scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprFDiv is an LLVM IR fdiv expression.
func (*ExprFDiv) IsConstant ¶
func (*ExprFDiv) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFDiv) IsExpression ¶ added in v0.3.4
func (*ExprFDiv) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFMul ¶
type ExprFMul struct {
// Operands.
X, Y Constant // floating-point scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprFMul is an LLVM IR fmul expression.
func (*ExprFMul) IsConstant ¶
func (*ExprFMul) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFMul) IsExpression ¶ added in v0.3.4
func (*ExprFMul) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFNeg ¶
type ExprFNeg struct { // Operand. X Constant // floating-point scalar or vector constant // Type of result produced by the constant expression. Typ types.Type }
ExprFNeg is an LLVM IR fneg expression.
func (*ExprFNeg) IsConstant ¶
func (*ExprFNeg) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFNeg) IsExpression ¶ added in v0.3.4
func (*ExprFNeg) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFPExt ¶
type ExprFPExt struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprFPExt is an LLVM IR fpext expression.
func NewFPExt ¶
NewFPExt returns a new fpext expression based on the given source value and target type.
func (*ExprFPExt) IsConstant ¶
func (*ExprFPExt) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFPExt) IsExpression ¶ added in v0.3.4
func (*ExprFPExt) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFPToSI ¶
type ExprFPToSI struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprFPToSI is an LLVM IR fptosi expression.
func NewFPToSI ¶
func NewFPToSI(from Constant, to types.Type) *ExprFPToSI
NewFPToSI returns a new fptosi expression based on the given source value and target type.
func (*ExprFPToSI) Ident ¶
func (e *ExprFPToSI) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprFPToSI) IsConstant ¶
func (*ExprFPToSI) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFPToSI) IsExpression ¶ added in v0.3.4
func (*ExprFPToSI) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprFPToSI) String ¶
func (e *ExprFPToSI) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprFPToSI) Type ¶
func (e *ExprFPToSI) Type() types.Type
Type returns the type of the constant expression.
type ExprFPToUI ¶
type ExprFPToUI struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprFPToUI is an LLVM IR fptoui expression.
func NewFPToUI ¶
func NewFPToUI(from Constant, to types.Type) *ExprFPToUI
NewFPToUI returns a new fptoui expression based on the given source value and target type.
func (*ExprFPToUI) Ident ¶
func (e *ExprFPToUI) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprFPToUI) IsConstant ¶
func (*ExprFPToUI) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFPToUI) IsExpression ¶ added in v0.3.4
func (*ExprFPToUI) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprFPToUI) String ¶
func (e *ExprFPToUI) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprFPToUI) Type ¶
func (e *ExprFPToUI) Type() types.Type
Type returns the type of the constant expression.
type ExprFPTrunc ¶
type ExprFPTrunc struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprFPTrunc is an LLVM IR fptrunc expression.
func NewFPTrunc ¶
func NewFPTrunc(from Constant, to types.Type) *ExprFPTrunc
NewFPTrunc returns a new fptrunc expression based on the given source value and target type.
func (*ExprFPTrunc) Ident ¶
func (e *ExprFPTrunc) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprFPTrunc) IsConstant ¶
func (*ExprFPTrunc) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFPTrunc) IsExpression ¶ added in v0.3.4
func (*ExprFPTrunc) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprFPTrunc) String ¶
func (e *ExprFPTrunc) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprFPTrunc) Type ¶
func (e *ExprFPTrunc) Type() types.Type
Type returns the type of the constant expression.
type ExprFRem ¶
type ExprFRem struct {
// Operands.
X, Y Constant // floating-point scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprFRem is an LLVM IR frem expression.
func (*ExprFRem) IsConstant ¶
func (*ExprFRem) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFRem) IsExpression ¶ added in v0.3.4
func (*ExprFRem) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprFSub ¶
type ExprFSub struct {
// Operands.
X, Y Constant // floating-point scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprFSub is an LLVM IR fsub expression.
func (*ExprFSub) IsConstant ¶
func (*ExprFSub) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprFSub) IsExpression ¶ added in v0.3.4
func (*ExprFSub) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprGetElementPtr ¶
type ExprGetElementPtr struct { // Element type. ElemType types.Type // Source address. Src Constant // Element indicies. Indices []Constant // *Int, *Vector or *Index // Type of result produced by the constant expression. Typ types.Type // *types.PointerType or *types.VectorType (with elements of pointer type) // (optional) The result is a poison value if the calculated pointer is not // an in bounds address of the allocated source object. InBounds bool }
ExprGetElementPtr is an LLVM IR getelementptr expression.
func NewGetElementPtr ¶
func NewGetElementPtr(elemType types.Type, src Constant, indices ...Constant) *ExprGetElementPtr
NewGetElementPtr returns a new getelementptr expression based on the given element type, source address and element indices.
func (*ExprGetElementPtr) Ident ¶
func (e *ExprGetElementPtr) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprGetElementPtr) IsConstant ¶
func (*ExprGetElementPtr) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprGetElementPtr) IsExpression ¶ added in v0.3.4
func (*ExprGetElementPtr) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprGetElementPtr) String ¶
func (e *ExprGetElementPtr) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprGetElementPtr) Type ¶
func (e *ExprGetElementPtr) Type() types.Type
Type returns the type of the constant expression.
type ExprICmp ¶
type ExprICmp struct { // Integer comparison predicate. Pred enum.IPred // Integer scalar or vector operands. X, Y Constant // Type of result produced by the constant expression. Typ types.Type }
ExprICmp is an LLVM IR icmp expression.
func NewICmp ¶
NewICmp returns a new icmp expression based on the given integer comparison predicate and integer scalar or vector operands.
func (*ExprICmp) IsConstant ¶
func (*ExprICmp) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprICmp) IsExpression ¶ added in v0.3.4
func (*ExprICmp) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprInsertElement ¶
type ExprInsertElement struct { // Vector. X Constant // Element to insert. Elem Constant // Element index. Index Constant // Type of result produced by the constant expression. Typ types.Type }
ExprInsertElement is an LLVM IR insertelement expression.
func NewInsertElement ¶
func NewInsertElement(x, elem, index Constant) *ExprInsertElement
NewInsertElement returns a new insertelement expression based on the given vector, element and element index.
func (*ExprInsertElement) Ident ¶
func (e *ExprInsertElement) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprInsertElement) IsConstant ¶
func (*ExprInsertElement) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprInsertElement) IsExpression ¶ added in v0.3.4
func (*ExprInsertElement) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprInsertElement) String ¶
func (e *ExprInsertElement) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprInsertElement) Type ¶
func (e *ExprInsertElement) Type() types.Type
Type returns the type of the constant expression.
type ExprInsertValue ¶
type ExprInsertValue struct { // Aggregate value. X Constant // Element to insert. Elem Constant // Element indices. Indices []uint64 // Type of result produced by the constant expression. Typ types.Type }
ExprInsertValue is an LLVM IR insertvalue expression.
func NewInsertValue ¶
func NewInsertValue(x, elem Constant, indices ...uint64) *ExprInsertValue
NewInsertValue returns a new insertvalue expression based on the given aggregate value, element and indicies.
func (*ExprInsertValue) Ident ¶
func (e *ExprInsertValue) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprInsertValue) IsConstant ¶
func (*ExprInsertValue) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprInsertValue) IsExpression ¶ added in v0.3.4
func (*ExprInsertValue) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprInsertValue) String ¶
func (e *ExprInsertValue) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprInsertValue) Type ¶
func (e *ExprInsertValue) Type() types.Type
Type returns the type of the constant expression.
type ExprIntToPtr ¶
type ExprIntToPtr struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprIntToPtr is an LLVM IR inttoptr expression.
func NewIntToPtr ¶
func NewIntToPtr(from Constant, to types.Type) *ExprIntToPtr
NewIntToPtr returns a new inttoptr expression based on the given source value and target type.
func (*ExprIntToPtr) Ident ¶
func (e *ExprIntToPtr) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprIntToPtr) IsConstant ¶
func (*ExprIntToPtr) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprIntToPtr) IsExpression ¶ added in v0.3.4
func (*ExprIntToPtr) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprIntToPtr) String ¶
func (e *ExprIntToPtr) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprIntToPtr) Type ¶
func (e *ExprIntToPtr) Type() types.Type
Type returns the type of the constant expression.
type ExprLShr ¶
type ExprLShr struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
// (optional) The result is a poison value if any of the bits shifted out are
// non-zero.
Exact bool
}
ExprLShr is an LLVM IR lshr expression.
func (*ExprLShr) IsConstant ¶
func (*ExprLShr) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprLShr) IsExpression ¶ added in v0.3.4
func (*ExprLShr) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprMul ¶
type ExprMul struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
// (optional) Integer overflow flags.
OverflowFlags []enum.OverflowFlag
}
ExprMul is an LLVM IR mul expression.
func (*ExprMul) IsConstant ¶
func (*ExprMul) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprMul) IsExpression ¶ added in v0.3.4
func (*ExprMul) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprOr ¶
type ExprOr struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
}
ExprOr is an LLVM IR or expression.
func (*ExprOr) IsConstant ¶
func (*ExprOr) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprOr) IsExpression ¶ added in v0.3.4
func (*ExprOr) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprPtrToInt ¶
type ExprPtrToInt struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprPtrToInt is an LLVM IR ptrtoint expression.
func NewPtrToInt ¶
func NewPtrToInt(from Constant, to types.Type) *ExprPtrToInt
NewPtrToInt returns a new ptrtoint expression based on the given source value and target type.
func (*ExprPtrToInt) Ident ¶
func (e *ExprPtrToInt) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprPtrToInt) IsConstant ¶
func (*ExprPtrToInt) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprPtrToInt) IsExpression ¶ added in v0.3.4
func (*ExprPtrToInt) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprPtrToInt) String ¶
func (e *ExprPtrToInt) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprPtrToInt) Type ¶
func (e *ExprPtrToInt) Type() types.Type
Type returns the type of the constant expression.
type ExprSDiv ¶
type ExprSDiv struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
// (optional) The result is a poison value if the result would be rounded.
Exact bool
}
ExprSDiv is an LLVM IR sdiv expression.
func (*ExprSDiv) IsConstant ¶
func (*ExprSDiv) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSDiv) IsExpression ¶ added in v0.3.4
func (*ExprSDiv) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprSExt ¶
type ExprSExt struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprSExt is an LLVM IR sext expression.
func NewSExt ¶
NewSExt returns a new sext expression based on the given source value and target type.
func (*ExprSExt) IsConstant ¶
func (*ExprSExt) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSExt) IsExpression ¶ added in v0.3.4
func (*ExprSExt) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprSIToFP ¶
type ExprSIToFP struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprSIToFP is an LLVM IR sitofp expression.
func NewSIToFP ¶
func NewSIToFP(from Constant, to types.Type) *ExprSIToFP
NewSIToFP returns a new sitofp expression based on the given source value and target type.
func (*ExprSIToFP) Ident ¶
func (e *ExprSIToFP) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprSIToFP) IsConstant ¶
func (*ExprSIToFP) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSIToFP) IsExpression ¶ added in v0.3.4
func (*ExprSIToFP) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprSIToFP) String ¶
func (e *ExprSIToFP) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprSIToFP) Type ¶
func (e *ExprSIToFP) Type() types.Type
Type returns the type of the constant expression.
type ExprSRem ¶
type ExprSRem struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprSRem is an LLVM IR srem expression.
func (*ExprSRem) IsConstant ¶
func (*ExprSRem) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSRem) IsExpression ¶ added in v0.3.4
func (*ExprSRem) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprSelect ¶
type ExprSelect struct { // Selection condition. Cond Constant // Operands. X, Y Constant // Type of result produced by the constant expression. Typ types.Type }
ExprSelect is an LLVM IR select expression.
func NewSelect ¶
func NewSelect(cond, x, y Constant) *ExprSelect
NewSelect returns a new select expression based on the given selection condition and operands.
func (*ExprSelect) Ident ¶
func (e *ExprSelect) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprSelect) IsConstant ¶
func (*ExprSelect) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSelect) IsExpression ¶ added in v0.3.4
func (*ExprSelect) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprSelect) String ¶
func (e *ExprSelect) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprSelect) Type ¶
func (e *ExprSelect) Type() types.Type
Type returns the type of the constant expression.
type ExprShl ¶
type ExprShl struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
// (optional) Integer overflow flags.
OverflowFlags []enum.OverflowFlag
}
ExprShl is an LLVM IR shl expression.
func (*ExprShl) IsConstant ¶
func (*ExprShl) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprShl) IsExpression ¶ added in v0.3.4
func (*ExprShl) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprShuffleVector ¶
type ExprShuffleVector struct {
// Vectors.
X, Y Constant
// Shuffle mask.
Mask Constant
// Type of result produced by the constant expression.
Typ types.Type
}
ExprShuffleVector is an LLVM IR shufflevector expression.
func NewShuffleVector ¶
func NewShuffleVector(x, y, mask Constant) *ExprShuffleVector
NewShuffleVector returns a new shufflevector expression based on the given vectors and shuffle mask.
func (*ExprShuffleVector) Ident ¶
func (e *ExprShuffleVector) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprShuffleVector) IsConstant ¶
func (*ExprShuffleVector) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprShuffleVector) IsExpression ¶ added in v0.3.4
func (*ExprShuffleVector) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprShuffleVector) String ¶
func (e *ExprShuffleVector) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprShuffleVector) Type ¶
func (e *ExprShuffleVector) Type() types.Type
Type returns the type of the constant expression.
type ExprSub ¶
type ExprSub struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
// (optional) Integer overflow flags.
OverflowFlags []enum.OverflowFlag
}
ExprSub is an LLVM IR sub expression.
func (*ExprSub) IsConstant ¶
func (*ExprSub) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprSub) IsExpression ¶ added in v0.3.4
func (*ExprSub) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprTrunc ¶
type ExprTrunc struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprTrunc is an LLVM IR trunc expression.
func NewTrunc ¶
NewTrunc returns a new trunc expression based on the given source value and target type.
func (*ExprTrunc) IsConstant ¶
func (*ExprTrunc) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprTrunc) IsExpression ¶ added in v0.3.4
func (*ExprTrunc) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprUDiv ¶
type ExprUDiv struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
// (optional) The result is a poison value if X is not a multiple of Y.
Exact bool
}
ExprUDiv is an LLVM IR udiv expression.
func (*ExprUDiv) IsConstant ¶
func (*ExprUDiv) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprUDiv) IsExpression ¶ added in v0.3.4
func (*ExprUDiv) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprUIToFP ¶
type ExprUIToFP struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprUIToFP is an LLVM IR uitofp expression.
func NewUIToFP ¶
func NewUIToFP(from Constant, to types.Type) *ExprUIToFP
NewUIToFP returns a new uitofp expression based on the given source value and target type.
func (*ExprUIToFP) Ident ¶
func (e *ExprUIToFP) Ident() string
Ident returns the identifier associated with the constant expression.
func (*ExprUIToFP) IsConstant ¶
func (*ExprUIToFP) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprUIToFP) IsExpression ¶ added in v0.3.4
func (*ExprUIToFP) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
func (*ExprUIToFP) String ¶
func (e *ExprUIToFP) String() string
String returns the LLVM syntax representation of the constant expression as a type-value pair.
func (*ExprUIToFP) Type ¶
func (e *ExprUIToFP) Type() types.Type
Type returns the type of the constant expression.
type ExprURem ¶
type ExprURem struct {
// Operands.
X, Y Constant // integer scalar or vector constants
// Type of result produced by the constant expression.
Typ types.Type
}
ExprURem is an LLVM IR urem expression.
func (*ExprURem) IsConstant ¶
func (*ExprURem) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprURem) IsExpression ¶ added in v0.3.4
func (*ExprURem) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprXor ¶
type ExprXor struct {
// Operands.
X, Y Constant // integer scalars or vectors
// Type of result produced by the constant expression.
Typ types.Type
}
ExprXor is an LLVM IR xor expression.
func (*ExprXor) IsConstant ¶
func (*ExprXor) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprXor) IsExpression ¶ added in v0.3.4
func (*ExprXor) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type ExprZExt ¶
type ExprZExt struct { // Value before conversion. From Constant // Type after conversion. To types.Type }
ExprZExt is an LLVM IR zext expression.
func NewZExt ¶
NewZExt returns a new zext expression based on the given source value and target type.
func (*ExprZExt) IsConstant ¶
func (*ExprZExt) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ExprZExt) IsExpression ¶ added in v0.3.4
func (*ExprZExt) IsExpression()
IsExpression ensures that only constants expressions can be assigned to the constant.Expression interface.
type Expression ¶
type Expression interface { Constant // IsExpression ensures that only constants expressions can be assigned to // the constant.Expression interface. IsExpression() }
Expression is an LLVM IR constant expression.
An Expression has one of the following underlying types.
Unary expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprFNeg // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFNeg
Binary expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprAdd // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprAdd *constant.ExprFAdd // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFAdd *constant.ExprSub // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSub *constant.ExprFSub // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFSub *constant.ExprMul // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprMul *constant.ExprFMul // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFMul *constant.ExprUDiv // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprUDiv *constant.ExprSDiv // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSDiv *constant.ExprFDiv // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFDiv *constant.ExprURem // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprURem *constant.ExprSRem // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSRem *constant.ExprFRem // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFRem
Bitwise expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprShl // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprShl *constant.ExprLShr // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprLShr *constant.ExprAShr // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprAShr *constant.ExprAnd // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprAnd *constant.ExprOr // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprOr *constant.ExprXor // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprXor
Vector expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprExtractElement // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprExtractElement *constant.ExprInsertElement // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprInsertElement *constant.ExprShuffleVector // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprShuffleVector
Aggregate expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprExtractValue // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprExtractValue *constant.ExprInsertValue // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprInsertValue
Memory expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprGetElementPtr // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprGetElementPtr
Conversion expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprTrunc // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprTrunc *constant.ExprZExt // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprZExt *constant.ExprSExt // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSExt *constant.ExprFPTrunc // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFPTrunc *constant.ExprFPExt // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFPExt *constant.ExprFPToUI // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFPToUI *constant.ExprFPToSI // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFPToSI *constant.ExprUIToFP // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprUIToFP *constant.ExprSIToFP // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSIToFP *constant.ExprPtrToInt // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprPtrToInt *constant.ExprIntToPtr // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprIntToPtr *constant.ExprBitCast // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprBitCast *constant.ExprAddrSpaceCast // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprAddrSpaceCast
Other expressions ¶
https://llvm.org/docs/LangRef.html#constant-expressions
*constant.ExprICmp // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprICmp *constant.ExprFCmp // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprFCmp *constant.ExprSelect // https://pkg.go.dev/github.com/llir/llvm/ir/constant#ExprSelect
type Float ¶
type Float struct { // Floating-point type. Typ *types.FloatType // Floating-point constant. X *big.Float // NaN specifies whether the floating-point constant is Not-a-Number. NaN bool }
Float is an LLVM IR floating-point constant.
func NewFloat ¶
NewFloat returns a new floating-point constant based on the given floating-point type and double precision floating-point value.
func NewFloatFromString ¶
NewFloatFromString returns a new floating-point constant based on the given floating-point type and floating-point string.
The floating-point string may be expressed in one of the following forms.
- fraction floating-point literal [+-]? [0-9]+ [.] [0-9]*
- scientific notation floating-point literal [+-]? [0-9]+ [.] [0-9]* [eE] [+-]? [0-9]+
- hexadecimal floating-point literal 0x[0-9A-Fa-f]{16} // HexFP 0xK[0-9A-Fa-f]{20} // HexFP80 0xL[0-9A-Fa-f]{32} // HexFP128 0xM[0-9A-Fa-f]{32} // HexPPC128 0xH[0-9A-Fa-f]{4} // HexHalf
func (*Float) IsConstant ¶
func (*Float) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Index ¶
type Index struct { // Element index. Constant // (optional) States that the element index is not out the bounds of the // allocated object. If inrange is stated but the element index is out of // bounds, the behaviour is undefined. InRange bool }
Index is an index of a getelementptr constant expression.
type Int ¶
Int is an LLVM IR integer constant.
func NewInt ¶
NewInt returns a new integer constant based on the given integer type and 64-bit interger value.
func NewIntFromString ¶
NewIntFromString returns a new integer constant based on the given integer type and string.
The integer string may be expressed in one of the following forms.
- boolean literal true | false
- integer literal [-]?[0-9]+
- hexadecimal integer literal [us]0x[0-9A-Fa-f]+
func (*Int) IsConstant ¶
func (*Int) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type NoCFI ¶ added in v0.3.6
type NoCFI struct { // Underlying function. Func Constant // *ir.Func }
NoCFI is an LLVM IR no_cfi constant; a constant representing a function which does not get replaced with a reference to the CFI jump table (control-flow integrity).
ref: https://llvm.org/docs/LangRef.html#no-cfi
func (*NoCFI) IsConstant ¶ added in v0.3.6
func (*NoCFI) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type NoneToken ¶
type NoneToken struct { }
NoneToken is an LLVM IR none token constant.
func (*NoneToken) IsConstant ¶
func (*NoneToken) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Null ¶
type Null struct { // Pointer type. Typ *types.PointerType }
Null is an LLVM IR null pointer constant.
func NewNull ¶
func NewNull(typ *types.PointerType) *Null
NewNull returns a new null pointer constant based on the given pointer type.
func (*Null) IsConstant ¶
func (*Null) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Poison ¶ added in v0.3.4
Poison is an LLVM IR poison value.
func (*Poison) IsConstant ¶ added in v0.3.4
func (*Poison) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Struct ¶
type Struct struct { // Struct type. Typ *types.StructType // Struct fields. Fields []Constant }
Struct is an LLVM IR struct constant.
func NewStruct ¶
func NewStruct(t *types.StructType, fields ...Constant) *Struct
NewStruct returns a new struct constant based on the given struct type and fields. The struct type is infered from the type of the fields if t is nil.
func (*Struct) IsConstant ¶
func (*Struct) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Undef ¶
Undef is an LLVM IR undefined value.
func (*Undef) IsConstant ¶
func (*Undef) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type Vector ¶
type Vector struct { // Vector type. Typ *types.VectorType // Vector elements. Elems []Constant }
Vector is an LLVM IR vector constant.
func NewVector ¶
func NewVector(t *types.VectorType, elems ...Constant) *Vector
NewVector returns a new vector constant based on the given vector type and elements. The vector type is infered from the type of the elements if t is nil.
func (*Vector) IsConstant ¶
func (*Vector) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
type ZeroInitializer ¶
ZeroInitializer is an LLVM IR zeroinitializer constant.
func NewZeroInitializer ¶
func NewZeroInitializer(typ types.Type) *ZeroInitializer
NewZeroInitializer returns a new zeroinitializer constant based on the given type.
func (*ZeroInitializer) Ident ¶
func (c *ZeroInitializer) Ident() string
Ident returns the identifier associated with the constant.
func (*ZeroInitializer) IsConstant ¶
func (*ZeroInitializer) IsConstant()
IsConstant ensures that only constants can be assigned to the constant.Constant interface.
func (*ZeroInitializer) String ¶
func (c *ZeroInitializer) String() string
String returns the LLVM syntax representation of the constant as a type-value pair.
func (*ZeroInitializer) Type ¶
func (c *ZeroInitializer) Type() types.Type
Type returns the type of the constant.
Source Files ¶
- const_array.go
- const_blockaddress.go
- const_dso_local_equivalent.go
- const_float.go
- const_int.go
- const_no_cfi.go
- const_none.go
- const_null.go
- const_poison.go
- const_struct.go
- const_undef.go
- const_vector.go
- const_zeroinitializer.go
- constant.go
- expr_aggregate.go
- expr_binary.go
- expr_bitwise.go
- expr_conversion.go
- expr_memory.go
- expr_other.go
- expr_unary.go
- expr_vector.go
- expression.go
- sumtype.go