Documentation ¶
Overview ¶
Package types declares the data types of LLVM IR.
Index ¶
- Variables
- func Equal(t, u Type) bool
- func IsFloat(t Type) bool
- func IsInt(t Type) bool
- func IsPointer(t Type) bool
- type AddrSpace
- type ArrayType
- type FloatKind
- type FloatType
- type FuncType
- type IntType
- type LabelType
- type MMXType
- type MetadataType
- type PointerType
- type StructType
- type TokenType
- type Type
- type VectorType
- type VoidType
Constants ¶
This section is empty.
Variables ¶
var ( // Basic types. Void = &VoidType{} // void MMX = &MMXType{} // x86_mmx Label = &LabelType{} // label Token = &TokenType{} // token Metadata = &MetadataType{} // metadata // Integer types. I1 = &IntType{BitSize: 1} // i1 I8 = &IntType{BitSize: 8} // i8 I16 = &IntType{BitSize: 16} // i16 I32 = &IntType{BitSize: 32} // i32 I64 = &IntType{BitSize: 64} // i64 I128 = &IntType{BitSize: 128} // i128 // Floating-point types. Half = &FloatType{Kind: FloatKindHalf} // half Float = &FloatType{Kind: FloatKindFloat} // float Double = &FloatType{Kind: FloatKindDouble} // double X86FP80 = &FloatType{Kind: FloatKindX86FP80} // x86_fp80 FP128 = &FloatType{Kind: FloatKindFP128} // fp128 PPCFP128 = &FloatType{Kind: FloatKindPPCFP128} // ppc_fp128 // Integer pointer types. I1Ptr = &PointerType{ElemType: I1} // i1* I8Ptr = &PointerType{ElemType: I8} // i8* I16Ptr = &PointerType{ElemType: I16} // i16* I32Ptr = &PointerType{ElemType: I32} // i32* I64Ptr = &PointerType{ElemType: I64} // i64* I128Ptr = &PointerType{ElemType: I128} // i128* )
Convenience types.
Functions ¶
Types ¶
type ArrayType ¶
type ArrayType struct { // Type name; or empty if not present. TypeName string // Array length. Len uint64 // Element type. ElemType Type }
ArrayType is an LLVM IR array type.
type FloatKind ¶
type FloatKind uint8
FloatKind represents the set of floating-point kinds.
const ( // 16-bit floating-point type (IEEE 754 half precision). FloatKindHalf FloatKind = iota // half // 32-bit floating-point type (IEEE 754 single precision). FloatKindFloat // float // 64-bit floating-point type (IEEE 754 double precision). FloatKindDouble // double // 128-bit floating-point type (IEEE 754 quadruple precision). FloatKindFP128 // fp128 // 80-bit floating-point type (x86 extended precision). FloatKindX86FP80 // x86_fp80 // 128-bit floating point type (IBM extended double). FloatKindPPCFP128 // ppc_fp128 )
Floating-point kinds.
type FloatType ¶
type FloatType struct { // Type name; or empty if not present. TypeName string // Floating-point kind. Kind FloatKind }
FloatType is an LLVM IR floating-point type.
type FuncType ¶
type FuncType struct { // Type name; or empty if not present. TypeName string // Return type. RetType Type // Function parameters. Params []Type // Variable number of function arguments. Variadic bool }
FuncType is an LLVM IR function type.
func NewFunc ¶
NewFunc returns a new function type based on the given return type and function parameter types.
type IntType ¶
type IntType struct { // Type name; or empty if not present. TypeName string // Integer size in number of bits. BitSize uint64 }
IntType is an LLVM IR integer type.
type LabelType ¶
type LabelType struct { // Type name; or empty if not present. TypeName string }
LabelType is an LLVM IR label type, which is used for basic block values.
type MMXType ¶
type MMXType struct { // Type name; or empty if not present. TypeName string }
MMXType is an LLVM IR MMX type.
type MetadataType ¶
type MetadataType struct { // Type name; or empty if not present. TypeName string }
MetadataType is an LLVM IR metadata type.
func (*MetadataType) Def ¶
func (t *MetadataType) Def() string
Def returns the LLVM syntax representation of the definition of the type.
func (*MetadataType) Equal ¶
func (t *MetadataType) Equal(u Type) bool
Equal reports whether t and u are of equal type.
func (*MetadataType) Name ¶
func (t *MetadataType) Name() string
Name returns the type name of the type.
func (*MetadataType) SetName ¶
func (t *MetadataType) SetName(name string)
SetName sets the type name of the type.
func (*MetadataType) String ¶
func (t *MetadataType) String() string
String returns the string representation of the metadata type.
type PointerType ¶
type PointerType struct { // Type name; or empty if not present. TypeName string // Element type. ElemType Type // Address space; or zero value for default address space. AddrSpace AddrSpace }
PointerType is an LLVM IR pointer type.
func NewPointer ¶
func NewPointer(elemType Type) *PointerType
NewPointer returns a new pointer type based on the given element type.
func (*PointerType) Def ¶
func (t *PointerType) Def() string
Def returns the LLVM syntax representation of the definition of the type.
func (*PointerType) Equal ¶
func (t *PointerType) Equal(u Type) bool
Equal reports whether t and u are of equal type.
func (*PointerType) Name ¶
func (t *PointerType) Name() string
Name returns the type name of the type.
func (*PointerType) SetName ¶
func (t *PointerType) SetName(name string)
SetName sets the type name of the type.
func (*PointerType) String ¶
func (t *PointerType) String() string
String returns the string representation of the pointer type.
type StructType ¶
type StructType struct { // Type name; or empty if not present. TypeName string // Packed memory layout. Packed bool // Struct fields. Fields []Type // Opaque struct type. Opaque bool }
StructType is an LLVM IR structure type. Identified (named) struct types are uniqued by type names, not by structural identity.
func NewStruct ¶
func NewStruct(fields ...Type) *StructType
NewStruct returns a new struct type based on the given field types.
func (*StructType) Def ¶
func (t *StructType) Def() string
Def returns the LLVM syntax representation of the definition of the type.
func (*StructType) Equal ¶
func (t *StructType) Equal(u Type) bool
Equal reports whether t and u are of equal type.
func (*StructType) Name ¶
func (t *StructType) Name() string
Name returns the type name of the type.
func (*StructType) SetName ¶
func (t *StructType) SetName(name string)
SetName sets the type name of the type.
func (*StructType) String ¶
func (t *StructType) String() string
String returns the string representation of the structure type.
type TokenType ¶
type TokenType struct { // Type name; or empty if not present. TypeName string }
TokenType is an LLVM IR token type.
type Type ¶
type Type interface { fmt.Stringer // Def returns the LLVM syntax representation of the definition of the type. Def() string // Equal reports whether t and u are of equal type. Equal(u Type) bool // Name returns the type name of the type. Name() string // SetName sets the type name of the type. SetName(name string) }
Type is an LLVM IR type.
A Type has one of the following underlying types.
*types.VoidType // https://godoc.org/github.com/llir/llvm/ir/types#VoidType *types.FuncType // https://godoc.org/github.com/llir/llvm/ir/types#FuncType *types.IntType // https://godoc.org/github.com/llir/llvm/ir/types#IntType *types.FloatType // https://godoc.org/github.com/llir/llvm/ir/types#FloatType *types.MMXType // https://godoc.org/github.com/llir/llvm/ir/types#MMXType *types.PointerType // https://godoc.org/github.com/llir/llvm/ir/types#PointerType *types.VectorType // https://godoc.org/github.com/llir/llvm/ir/types#VectorType *types.LabelType // https://godoc.org/github.com/llir/llvm/ir/types#LabelType *types.TokenType // https://godoc.org/github.com/llir/llvm/ir/types#TokenType *types.MetadataType // https://godoc.org/github.com/llir/llvm/ir/types#MetadataType *types.ArrayType // https://godoc.org/github.com/llir/llvm/ir/types#ArrayType *types.StructType // https://godoc.org/github.com/llir/llvm/ir/types#StructType
type VectorType ¶
type VectorType struct { // Type name; or empty if not present. TypeName string // Vector length. Len uint64 // Element type. ElemType Type }
VectorType is an LLVM IR vector type.
func NewVector ¶
func NewVector(len uint64, elemType Type) *VectorType
NewVector returns a new vector type based on the given vector length and element type.
func (*VectorType) Def ¶
func (t *VectorType) Def() string
Def returns the LLVM syntax representation of the definition of the type.
func (*VectorType) Equal ¶
func (t *VectorType) Equal(u Type) bool
Equal reports whether t and u are of equal type.
func (*VectorType) Name ¶
func (t *VectorType) Name() string
Name returns the type name of the type.
func (*VectorType) SetName ¶
func (t *VectorType) SetName(name string)
SetName sets the type name of the type.
func (*VectorType) String ¶
func (t *VectorType) String() string
String returns the string representation of the vector type.
type VoidType ¶
type VoidType struct { // Type name; or empty if not present. TypeName string }
VoidType is an LLVM IR void type.