llvm

package module
v0.0.0-...-c8914dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2014 License: MIT Imports: 6 Imported by: 4

README

GoLLVM

This project has moved to llvm.org. Any contributions or bug reports should be sent there. Please refer to the Go bindings readme for more information.

LLVM bindings for The Go Programming Language.

Build Status

Prerequisites

  • Go 1.2+.
  • CMake (to build LLVM).

The author has only built and tested with Linux, but there is no particular reason why GoLLVM should not work with other operating systems.

Building LLVM

The development version of GoLLVM is tied to a specific revision of LLVM SVN trunk. We also make releases which are synchronized with LLVM releases. Those releases are available in branches named vMN, where M is the major number of the LLVM release and N is the minor number.

The script update\_llvm.sh in this directory can be used to build the required revision of LLVM and prepare it to be used by GoLLVM. If you receive an error message from go build like this:

./analysis.go:4:84: fatal error: llvm-c/Analysis.h: No such file or directory
 #include <llvm-c/Analysis.h> // If you are getting an error here read README.md

or like this:

./llvm_dep.go:5: undefined: run_update_llvm_sh_to_get_revision_NNNNNN

it means that LLVM needs to be built or updated by running the script.

$ ./update_llvm.sh

Any command line arguments supplied to the script are passed to LLVM's CMake build system. A good set of arguments to use during development are:

$ ./update_llvm.sh -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD=host -DBUILD_SHARED_LIBS=ON

Note that CMake keeps a cache of build settings so once you have built LLVM there is no need to pass these arguments again after updating.

Alternatively, you can build LLVM yourself or use a version provided by your distribution, but you must then set the CGO_CFLAGS and CGO_LDFLAGS environment variables:

$ export CGO_CFLAGS=`llvm-config --cflags`
$ export CGO_LDFLAGS="`llvm-config --ldflags` -Wl,-L`llvm-config --libdir` -lLLVM-`llvm-config --version`"
$ go get -tags byollvm github.com/go-llvm/llvm

Documentation

Index

Constants

View Source
const (
	FlagPrivate = 1 << iota
	FlagProtected
	FlagFwdDecl
	FlagAppleBlock
	FlagBlockByrefStruct
	FlagVirtual
	FlagArtificial
	FlagExplicit
	FlagPrototyped
	FlagObjcClassComplete
	FlagObjectPointer
	FlagVector
	FlagStaticMember
	FlagIndirectVariable
)
View Source
const (
	LLVMDebugVersion = (12 << 16)
)
View Source
const Version = "3.6.0svn"

Variables

This section is empty.

Functions

func DefaultTargetTriple

func DefaultTargetTriple() (triple string)

func InitializeAllAsmParsers

func InitializeAllAsmParsers()

func InitializeAllAsmPrinters

func InitializeAllAsmPrinters()

func InitializeAllTargetInfos

func InitializeAllTargetInfos()

InitializeAllTargetInfos - The main program should call this function if it wants access to all available targets that LLVM is configured to support.

func InitializeAllTargetMCs

func InitializeAllTargetMCs()

func InitializeAllTargets

func InitializeAllTargets()

InitializeAllTargets - The main program should call this function if it wants to link in all available targets that LLVM is configured to support.

func InitializeNativeAsmPrinter

func InitializeNativeAsmPrinter() error

func InitializeNativeTarget

func InitializeNativeTarget() error

InitializeNativeTarget - The main program should call this function to initialize the native target corresponding to the host. This is useful for JIT applications to ensure that the target gets linked in correctly.

func LinkInInterpreter

func LinkInInterpreter()

func LinkInMCJIT

func LinkInMCJIT()

func LoadLibraryPermanently

func LoadLibraryPermanently(lib string) error

Loads a dynamic library such that it may be used as an LLVM plugin. See llvm::sys::DynamicLibrary::LoadLibraryPermanently.

func MDKindID

func MDKindID(name string) (id int)

func ParseCommandLineOptions

func ParseCommandLineOptions(args []string, overview string)

Parse the given arguments using the LLVM command line parser. See llvm::cl::ParseCommandLineOptions.

func VerifyFunction

func VerifyFunction(f Value, a VerifierFailureAction) error

Verifies that a single function is valid, taking the specified action. Useful for debugging.

func VerifyModule

func VerifyModule(m Module, a VerifierFailureAction) error

Verifies that a module is valid, taking the specified action if not. Optionally returns a human-readable description of any invalid constructs.

func ViewFunctionCFG

func ViewFunctionCFG(f Value)

Open up a ghostview window that displays the CFG of the current function. Useful for debugging.

func ViewFunctionCFGOnly

func ViewFunctionCFGOnly(f Value)

func WriteBitcodeToFile

func WriteBitcodeToFile(m Module, file *os.File) error

Types

type Attribute

type Attribute uint64
const (
	NoneAttribute               Attribute = 0
	ZExtAttribute               Attribute = C.LLVMZExtAttribute
	SExtAttribute               Attribute = C.LLVMSExtAttribute
	NoReturnAttribute           Attribute = C.LLVMNoReturnAttribute
	InRegAttribute              Attribute = C.LLVMInRegAttribute
	StructRetAttribute          Attribute = C.LLVMStructRetAttribute
	NoUnwindAttribute           Attribute = C.LLVMNoUnwindAttribute
	NoAliasAttribute            Attribute = C.LLVMNoAliasAttribute
	ByValAttribute              Attribute = C.LLVMByValAttribute
	NestAttribute               Attribute = C.LLVMNestAttribute
	ReadNoneAttribute           Attribute = C.LLVMReadNoneAttribute
	ReadOnlyAttribute           Attribute = C.LLVMReadOnlyAttribute
	NoInlineAttribute           Attribute = C.LLVMNoInlineAttribute
	AlwaysInlineAttribute       Attribute = C.LLVMAlwaysInlineAttribute
	OptimizeForSizeAttribute    Attribute = C.LLVMOptimizeForSizeAttribute
	StackProtectAttribute       Attribute = C.LLVMStackProtectAttribute
	StackProtectReqAttribute    Attribute = C.LLVMStackProtectReqAttribute
	Alignment                   Attribute = C.LLVMAlignment
	NoCaptureAttribute          Attribute = C.LLVMNoCaptureAttribute
	NoRedZoneAttribute          Attribute = C.LLVMNoRedZoneAttribute
	NoImplicitFloatAttribute    Attribute = C.LLVMNoImplicitFloatAttribute
	NakedAttribute              Attribute = C.LLVMNakedAttribute
	InlineHintAttribute         Attribute = C.LLVMInlineHintAttribute
	StackAlignment              Attribute = C.LLVMStackAlignment
	ReturnsTwiceAttribute       Attribute = C.LLVMReturnsTwice
	UWTableAttribute            Attribute = C.LLVMUWTable
	NonLazyBindAttribute        Attribute = 1 << 31
	SanitizeAddressAttribute    Attribute = 1 << 32
	MinSizeAttribute            Attribute = 1 << 33
	NoDuplicateAttribute        Attribute = 1 << 34
	StackProtectStrongAttribute Attribute = 1 << 35
	SanitizeThreadAttribute     Attribute = 1 << 36
	SanitizeMemoryAttribute     Attribute = 1 << 37
	NoBuiltinAttribute          Attribute = 1 << 38
	ReturnedAttribute           Attribute = 1 << 39
	ColdAttribute               Attribute = 1 << 40
	BuiltinAttribute            Attribute = 1 << 41
	OptimizeNoneAttribute       Attribute = 1 << 42
	InAllocaAttribute           Attribute = 1 << 43
	NonNullAttribute            Attribute = 1 << 44
	JumpTableAttribute          Attribute = 1 << 45
)

type BasicBlock

type BasicBlock struct {
	C C.LLVMBasicBlockRef
}

func AddBasicBlock

func AddBasicBlock(f Value, name string) (bb BasicBlock)

func InsertBasicBlock

func InsertBasicBlock(ref BasicBlock, name string) (bb BasicBlock)

func NextBasicBlock

func NextBasicBlock(bb BasicBlock) (rbb BasicBlock)

func PrevBasicBlock

func PrevBasicBlock(bb BasicBlock) (rbb BasicBlock)

func (BasicBlock) AsValue

func (bb BasicBlock) AsValue() (v Value)

Operations on basic blocks

func (BasicBlock) EraseFromParent

func (bb BasicBlock) EraseFromParent()

func (BasicBlock) FirstInstruction

func (bb BasicBlock) FirstInstruction() (v Value)

func (BasicBlock) IsNil

func (c BasicBlock) IsNil() bool

func (BasicBlock) LastInstruction

func (bb BasicBlock) LastInstruction() (v Value)

func (BasicBlock) MoveAfter

func (bb BasicBlock) MoveAfter(pos BasicBlock)

func (BasicBlock) MoveBefore

func (bb BasicBlock) MoveBefore(pos BasicBlock)

func (BasicBlock) Parent

func (bb BasicBlock) Parent() (v Value)

type Builder

type Builder struct {
	C C.LLVMBuilderRef
}

func NewBuilder

func NewBuilder() (b Builder)

func (Builder) ClearInsertionPoint

func (b Builder) ClearInsertionPoint()

func (Builder) CreateAShr

func (b Builder) CreateAShr(lhs, rhs Value, name string) (v Value)

func (Builder) CreateAdd

func (b Builder) CreateAdd(lhs, rhs Value, name string) (v Value)

Arithmetic

func (Builder) CreateAggregateRet

func (b Builder) CreateAggregateRet(vs []Value) (rv Value)

func (Builder) CreateAlloca

func (b Builder) CreateAlloca(t Type, name string) (v Value)

func (Builder) CreateAnd

func (b Builder) CreateAnd(lhs, rhs Value, name string) (v Value)

func (Builder) CreateArrayAlloca

func (b Builder) CreateArrayAlloca(t Type, val Value, name string) (v Value)

func (Builder) CreateArrayMalloc

func (b Builder) CreateArrayMalloc(t Type, val Value, name string) (v Value)

func (Builder) CreateBinOp

func (b Builder) CreateBinOp(op Opcode, lhs, rhs Value, name string) (v Value)

func (Builder) CreateBitCast

func (b Builder) CreateBitCast(val Value, t Type, name string) (v Value)

func (Builder) CreateBr

func (b Builder) CreateBr(bb BasicBlock) (rv Value)

func (Builder) CreateCall

func (b Builder) CreateCall(fn Value, args []Value, name string) (v Value)

func (Builder) CreateCast

func (b Builder) CreateCast(val Value, op Opcode, t Type, name string) (v Value)

func (Builder) CreateCondBr

func (b Builder) CreateCondBr(ifv Value, thenb, elseb BasicBlock) (rv Value)

func (Builder) CreateExactSDiv

func (b Builder) CreateExactSDiv(lhs, rhs Value, name string) (v Value)

func (Builder) CreateExtractElement

func (b Builder) CreateExtractElement(vec, i Value, name string) (v Value)

func (Builder) CreateExtractValue

func (b Builder) CreateExtractValue(agg Value, i int, name string) (v Value)

func (Builder) CreateFAdd

func (b Builder) CreateFAdd(lhs, rhs Value, name string) (v Value)

func (Builder) CreateFCmp

func (b Builder) CreateFCmp(pred FloatPredicate, lhs, rhs Value, name string) (v Value)

func (Builder) CreateFDiv

func (b Builder) CreateFDiv(lhs, rhs Value, name string) (v Value)

func (Builder) CreateFMul

func (b Builder) CreateFMul(lhs, rhs Value, name string) (v Value)

func (Builder) CreateFNeg

func (b Builder) CreateFNeg(v Value, name string) (rv Value)

func (Builder) CreateFPCast

func (b Builder) CreateFPCast(val Value, t Type, name string) (v Value)

func (Builder) CreateFPExt

func (b Builder) CreateFPExt(val Value, t Type, name string) (v Value)

func (Builder) CreateFPToSI

func (b Builder) CreateFPToSI(val Value, t Type, name string) (v Value)

func (Builder) CreateFPToUI

func (b Builder) CreateFPToUI(val Value, t Type, name string) (v Value)

func (Builder) CreateFPTrunc

func (b Builder) CreateFPTrunc(val Value, t Type, name string) (v Value)

func (Builder) CreateFRem

func (b Builder) CreateFRem(lhs, rhs Value, name string) (v Value)

func (Builder) CreateFSub

func (b Builder) CreateFSub(lhs, rhs Value, name string) (v Value)

func (Builder) CreateFree

func (b Builder) CreateFree(p Value) (v Value)

func (Builder) CreateGEP

func (b Builder) CreateGEP(p Value, indices []Value, name string) (v Value)

func (Builder) CreateGlobalString

func (b Builder) CreateGlobalString(str, name string) (v Value)

func (Builder) CreateGlobalStringPtr

func (b Builder) CreateGlobalStringPtr(str, name string) (v Value)

func (Builder) CreateICmp

func (b Builder) CreateICmp(pred IntPredicate, lhs, rhs Value, name string) (v Value)

Comparisons

func (Builder) CreateInBoundsGEP

func (b Builder) CreateInBoundsGEP(p Value, indices []Value, name string) (v Value)

func (Builder) CreateIndirectBr

func (b Builder) CreateIndirectBr(addr Value, numDests int) (rv Value)

func (Builder) CreateInsertElement

func (b Builder) CreateInsertElement(vec, elt, i Value, name string) (v Value)

func (Builder) CreateInsertValue

func (b Builder) CreateInsertValue(agg, elt Value, i int, name string) (v Value)

func (Builder) CreateIntCast

func (b Builder) CreateIntCast(val Value, t Type, name string) (v Value)

func (Builder) CreateIntToPtr

func (b Builder) CreateIntToPtr(val Value, t Type, name string) (v Value)

func (Builder) CreateInvoke

func (b Builder) CreateInvoke(fn Value, args []Value, then, catch BasicBlock, name string) (rv Value)

func (Builder) CreateIsNotNull

func (b Builder) CreateIsNotNull(val Value, name string) (v Value)

func (Builder) CreateIsNull

func (b Builder) CreateIsNull(val Value, name string) (v Value)

func (Builder) CreateLShr

func (b Builder) CreateLShr(lhs, rhs Value, name string) (v Value)

func (Builder) CreateLandingPad

func (b Builder) CreateLandingPad(t Type, personality Value, nclauses int, name string) (l Value)

func (Builder) CreateLoad

func (b Builder) CreateLoad(p Value, name string) (v Value)

func (Builder) CreateMalloc

func (b Builder) CreateMalloc(t Type, name string) (v Value)

func (Builder) CreateMul

func (b Builder) CreateMul(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNSWAdd

func (b Builder) CreateNSWAdd(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNSWMul

func (b Builder) CreateNSWMul(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNSWNeg

func (b Builder) CreateNSWNeg(v Value, name string) (rv Value)

func (Builder) CreateNSWSub

func (b Builder) CreateNSWSub(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNUWAdd

func (b Builder) CreateNUWAdd(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNUWMul

func (b Builder) CreateNUWMul(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNUWNeg

func (b Builder) CreateNUWNeg(v Value, name string) (rv Value)

func (Builder) CreateNUWSub

func (b Builder) CreateNUWSub(lhs, rhs Value, name string) (v Value)

func (Builder) CreateNeg

func (b Builder) CreateNeg(v Value, name string) (rv Value)

func (Builder) CreateNot

func (b Builder) CreateNot(v Value, name string) (rv Value)

func (Builder) CreateOr

func (b Builder) CreateOr(lhs, rhs Value, name string) (v Value)

func (Builder) CreatePHI

func (b Builder) CreatePHI(t Type, name string) (v Value)

Miscellaneous instructions

func (Builder) CreatePointerCast

func (b Builder) CreatePointerCast(val Value, t Type, name string) (v Value)

func (Builder) CreatePtrDiff

func (b Builder) CreatePtrDiff(lhs, rhs Value, name string) (v Value)

func (Builder) CreatePtrToInt

func (b Builder) CreatePtrToInt(val Value, t Type, name string) (v Value)

func (Builder) CreateResume

func (b Builder) CreateResume(ex Value) (v Value)

func (Builder) CreateRet

func (b Builder) CreateRet(v Value) (rv Value)

func (Builder) CreateRetVoid

func (b Builder) CreateRetVoid() (rv Value)

Terminators

func (Builder) CreateSDiv

func (b Builder) CreateSDiv(lhs, rhs Value, name string) (v Value)

func (Builder) CreateSExt

func (b Builder) CreateSExt(val Value, t Type, name string) (v Value)

func (Builder) CreateSExtOrBitCast

func (b Builder) CreateSExtOrBitCast(val Value, t Type, name string) (v Value)

func (Builder) CreateSIToFP

func (b Builder) CreateSIToFP(val Value, t Type, name string) (v Value)

func (Builder) CreateSRem

func (b Builder) CreateSRem(lhs, rhs Value, name string) (v Value)

func (Builder) CreateSelect

func (b Builder) CreateSelect(ifv, thenv, elsev Value, name string) (v Value)

func (Builder) CreateShl

func (b Builder) CreateShl(lhs, rhs Value, name string) (v Value)

func (Builder) CreateShuffleVector

func (b Builder) CreateShuffleVector(v1, v2, mask Value, name string) (v Value)

func (Builder) CreateStore

func (b Builder) CreateStore(val Value, p Value) (v Value)

func (Builder) CreateStructGEP

func (b Builder) CreateStructGEP(p Value, i int, name string) (v Value)

func (Builder) CreateSub

func (b Builder) CreateSub(lhs, rhs Value, name string) (v Value)

func (Builder) CreateSwitch

func (b Builder) CreateSwitch(v Value, elseb BasicBlock, numCases int) (rv Value)

func (Builder) CreateTrunc

func (b Builder) CreateTrunc(val Value, t Type, name string) (v Value)

Casts

func (Builder) CreateTruncOrBitCast

func (b Builder) CreateTruncOrBitCast(val Value, t Type, name string) (v Value)

func (Builder) CreateUDiv

func (b Builder) CreateUDiv(lhs, rhs Value, name string) (v Value)

func (Builder) CreateUIToFP

func (b Builder) CreateUIToFP(val Value, t Type, name string) (v Value)

func (Builder) CreateURem

func (b Builder) CreateURem(lhs, rhs Value, name string) (v Value)

func (Builder) CreateUnreachable

func (b Builder) CreateUnreachable() (rv Value)

func (Builder) CreateVAArg

func (b Builder) CreateVAArg(list Value, t Type, name string) (v Value)

func (Builder) CreateXor

func (b Builder) CreateXor(lhs, rhs Value, name string) (v Value)

func (Builder) CreateZExt

func (b Builder) CreateZExt(val Value, t Type, name string) (v Value)

func (Builder) CreateZExtOrBitCast

func (b Builder) CreateZExtOrBitCast(val Value, t Type, name string) (v Value)

func (Builder) CurrentDebugLocation

func (b Builder) CurrentDebugLocation() (v Value)

func (Builder) Dispose

func (b Builder) Dispose()

func (Builder) GetInsertBlock

func (b Builder) GetInsertBlock() (bb BasicBlock)

func (Builder) Insert

func (b Builder) Insert(instr Value)

func (Builder) InsertDeclare

func (b Builder) InsertDeclare(module Module, storage Value, md Value) Value

func (Builder) InsertWithName

func (b Builder) InsertWithName(instr Value, name string)

func (Builder) IsNil

func (c Builder) IsNil() bool

func (Builder) SetCurrentDebugLocation

func (b Builder) SetCurrentDebugLocation(v Value)

Metadata

func (Builder) SetInsertPoint

func (b Builder) SetInsertPoint(block BasicBlock, instr Value)

func (Builder) SetInsertPointAtEnd

func (b Builder) SetInsertPointAtEnd(block BasicBlock)

func (Builder) SetInsertPointBefore

func (b Builder) SetInsertPointBefore(instr Value)

func (Builder) SetInstDebugLocation

func (b Builder) SetInstDebugLocation(v Value)

type ByteOrdering

type ByteOrdering C.enum_LLVMByteOrdering
const (
	BigEndian    ByteOrdering = C.LLVMBigEndian
	LittleEndian ByteOrdering = C.LLVMLittleEndian
)

type CallConv

type CallConv C.LLVMCallConv
const (
	CCallConv           CallConv = C.LLVMCCallConv
	FastCallConv        CallConv = C.LLVMFastCallConv
	ColdCallConv        CallConv = C.LLVMColdCallConv
	X86StdcallCallConv  CallConv = C.LLVMX86StdcallCallConv
	X86FastcallCallConv CallConv = C.LLVMX86FastcallCallConv
)

type CodeGenFileType

type CodeGenFileType C.LLVMCodeGenFileType
const (
	AssemblyFile CodeGenFileType = C.LLVMAssemblyFile
	ObjectFile   CodeGenFileType = C.LLVMObjectFile
)

type CodeGenOptLevel

type CodeGenOptLevel C.LLVMCodeGenOptLevel
const (
	CodeGenLevelNone       CodeGenOptLevel = C.LLVMCodeGenLevelNone
	CodeGenLevelLess       CodeGenOptLevel = C.LLVMCodeGenLevelLess
	CodeGenLevelDefault    CodeGenOptLevel = C.LLVMCodeGenLevelDefault
	CodeGenLevelAggressive CodeGenOptLevel = C.LLVMCodeGenLevelAggressive
)

type CodeModel

type CodeModel C.LLVMCodeModel
const (
	CodeModelDefault    CodeModel = C.LLVMCodeModelDefault
	CodeModelJITDefault CodeModel = C.LLVMCodeModelJITDefault
	CodeModelSmall      CodeModel = C.LLVMCodeModelSmall
	CodeModelKernel     CodeModel = C.LLVMCodeModelKernel
	CodeModelMedium     CodeModel = C.LLVMCodeModelMedium
	CodeModelLarge      CodeModel = C.LLVMCodeModelLarge
)

type Context

type Context struct {
	C C.LLVMContextRef
}

I'm using these weird structs here, because *Ref types are pointers and Go's spec says that I can't use a pointer as a receiver base type.

func GlobalContext

func GlobalContext() Context

func NewContext

func NewContext() Context

func (Context) AddBasicBlock

func (c Context) AddBasicBlock(f Value, name string) (bb BasicBlock)

func (Context) ConstString

func (c Context) ConstString(str string, addnull bool) (v Value)

Operations on composite constants

func (Context) ConstStruct

func (c Context) ConstStruct(constVals []Value, packed bool) (v Value)

func (Context) Dispose

func (c Context) Dispose()

func (Context) DoubleType

func (c Context) DoubleType() (t Type)

func (Context) FP128Type

func (c Context) FP128Type() (t Type)

func (Context) FloatType

func (c Context) FloatType() (t Type)

Operations on real types

func (Context) InsertBasicBlock

func (c Context) InsertBasicBlock(ref BasicBlock, name string) (bb BasicBlock)

func (Context) Int16Type

func (c Context) Int16Type() (t Type)

func (Context) Int1Type

func (c Context) Int1Type() (t Type)

Operations on integer types

func (Context) Int32Type

func (c Context) Int32Type() (t Type)

func (Context) Int64Type

func (c Context) Int64Type() (t Type)

func (Context) Int8Type

func (c Context) Int8Type() (t Type)

func (Context) IntType

func (c Context) IntType(numbits int) (t Type)

func (Context) IsNil

func (c Context) IsNil() bool

func (Context) LabelType

func (c Context) LabelType() (t Type)

func (Context) MDKindID

func (c Context) MDKindID(name string) (id int)

func (Context) MDNode

func (c Context) MDNode(vals []Value) (v Value)

func (Context) MDString

func (c Context) MDString(str string) (v Value)

Operations on metadata

func (Context) NewBuilder

func (c Context) NewBuilder() (b Builder)

func (Context) NewModule

func (c Context) NewModule(name string) (m Module)

func (Context) PPCFP128Type

func (c Context) PPCFP128Type() (t Type)

func (Context) StructCreateNamed

func (c Context) StructCreateNamed(name string) (t Type)

func (Context) StructType

func (c Context) StructType(elementTypes []Type, packed bool) (t Type)

Operations on struct types

func (Context) VoidType

func (c Context) VoidType() (t Type)

Operations on other types

func (Context) X86FP80Type

func (c Context) X86FP80Type() (t Type)

type DIArrayType

type DIArrayType struct {
	SizeInBits  uint64
	AlignInBits uint64
	ElementType Value
	Subscripts  []DISubrange
}

DIArrayType holds the values for creating array type debug metadata.

type DIBasicType

type DIBasicType struct {
	Name        string
	SizeInBits  uint64
	AlignInBits uint64
	Encoding    DwarfTypeEncoding
}

DIBasicType holds the values for creating basic type debug metadata.

type DIBuilder

type DIBuilder struct {
	// contains filtered or unexported fields
}

DIBuilder is a wrapper for the LLVM DIBuilder class.

func NewDIBuilder

func NewDIBuilder(m Module) *DIBuilder

NewDIBuilder creates a new DIBuilder, associated with the given module.

func (*DIBuilder) CreateArrayType

func (d *DIBuilder) CreateArrayType(t DIArrayType) Value

CreateArrayType creates struct type debug metadata.

func (*DIBuilder) CreateBasicType

func (d *DIBuilder) CreateBasicType(t DIBasicType) Value

CreateBasicType creates basic type debug metadata.

func (*DIBuilder) CreateCompileUnit

func (d *DIBuilder) CreateCompileUnit(cu DICompileUnit) Value

CreateCompileUnit creates compile unit debug metadata.

func (*DIBuilder) CreateFile

func (d *DIBuilder) CreateFile(filename, dir string) Value

CreateCompileUnit creates file debug metadata.

func (*DIBuilder) CreateFunction

func (d *DIBuilder) CreateFunction(diScope Value, f DIFunction) Value

CreateCompileUnit creates function debug metadata.

func (*DIBuilder) CreateLexicalBlock

func (d *DIBuilder) CreateLexicalBlock(diScope Value, b DILexicalBlock) Value

CreateCompileUnit creates lexical block debug metadata.

func (*DIBuilder) CreateLexicalBlockFile

func (d *DIBuilder) CreateLexicalBlockFile(diScope Value, diFile Value,
	discriminator int) Value

func (*DIBuilder) CreateLocalVariable

func (d *DIBuilder) CreateLocalVariable(scope Value, v DILocalVariable) Value

CreateLocalVariable creates local variable debug metadata.

func (*DIBuilder) CreateMemberType

func (d *DIBuilder) CreateMemberType(scope Value, t DIMemberType) Value

CreateMemberType creates struct type debug metadata.

func (*DIBuilder) CreatePointerType

func (d *DIBuilder) CreatePointerType(t DIPointerType) Value

CreateBasicType creates basic type debug metadata.

func (*DIBuilder) CreateStructType

func (d *DIBuilder) CreateStructType(scope Value, t DIStructType) Value

CreateStructType creates struct type debug metadata.

func (*DIBuilder) CreateSubroutineType

func (d *DIBuilder) CreateSubroutineType(t DISubroutineType) Value

CreateSubroutineType creates subroutine type debug metadata.

func (*DIBuilder) CreateTypedef

func (d *DIBuilder) CreateTypedef(t DITypedef) Value

CreateTypedef creates typedef type debug metadata.

func (*DIBuilder) Destroy

func (d *DIBuilder) Destroy()

Destroy destroys the DIBuilder.

func (*DIBuilder) Finalize

func (d *DIBuilder) Finalize()

FInalize finalizes the debug information generated by the DIBuilder.

func (*DIBuilder) InsertDeclareAtEnd

func (d *DIBuilder) InsertDeclareAtEnd(v, diVarInfo Value, bb BasicBlock) Value

InsertDeclareAtEnd inserts a call to llvm.dbg.declare at the end of the specified basic block for the given value and associated debug metadata.

type DICompileUnit

type DICompileUnit struct {
	Language       DwarfLang
	File           string
	Dir            string
	Producer       string
	Optimized      bool
	Flags          string
	RuntimeVersion int
}

DICompileUnit holds the values for creating compile unit debug metadata.

type DIFunction

type DIFunction struct {
	Name         string
	LinkageName  string
	File         Value
	Line         int
	Type         Value
	LocalToUnit  bool
	IsDefinition bool
	ScopeLine    int
	Flags        int
	Optimized    bool
	Function     Value
}

DIFunction holds the values for creating function debug metadata.

type DILexicalBlock

type DILexicalBlock struct {
	File   Value
	Line   int
	Column int
}

DILexicalBlock holds the values for creating lexical block debug metadata.

type DILocalVariable

type DILocalVariable struct {
	Tag            dwarf.Tag
	Name           string
	File           Value
	Line           int
	Type           Value
	AlwaysPreserve bool
	Flags          int

	// ArgNo is the 1-based index of the argument in the function's
	// parameter list if it is an argument, or 0 otherwise.
	ArgNo int
}

DILocalVariable holds the values for creating local variable debug metadata.

type DIMemberType

type DIMemberType struct {
	Name         string
	File         Value
	Line         int
	SizeInBits   uint64
	AlignInBits  uint64
	OffsetInBits uint64
	Flags        int
	Type         Value
}

DIMemberType holds the values for creating member type debug metadata.

type DIPointerType

type DIPointerType struct {
	Pointee     Value
	SizeInBits  uint64
	AlignInBits uint64 // optional
	Name        string // optional
}

DIPointerType holds the values for creating pointer type debug metadata.

type DIStructType

type DIStructType struct {
	Name        string
	File        Value
	Line        int
	SizeInBits  uint64
	AlignInBits uint64
	Flags       int
	DerivedFrom Value
	Elements    []Value
}

DIStructType holds the values for creating struct type debug metadata.

type DISubrange

type DISubrange struct {
	Lo    int64
	Count int64
}

DISubrange describes an integer value range.

type DISubroutineType

type DISubroutineType struct {
	// File is the file in which the subroutine type is defined.
	File Value

	// Parameters contains the subroutine parameter types,
	// including the return type at the 0th index.
	Parameters []Value
}

DISubroutineType holds the values for creating subroutine type debug metadata.

type DITypedef

type DITypedef struct {
	Type    Value
	Name    string
	File    Value
	Line    int
	Context Value
}

DITypedef holds the values for creating typedef type debug metadata.

type DwarfLang

type DwarfLang uint32

type DwarfTag

type DwarfTag uint32
const (
	DW_TAG_lexical_block   DwarfTag = 0x0b
	DW_TAG_compile_unit    DwarfTag = 0x11
	DW_TAG_variable        DwarfTag = 0x34
	DW_TAG_base_type       DwarfTag = 0x24
	DW_TAG_pointer_type    DwarfTag = 0x0F
	DW_TAG_structure_type  DwarfTag = 0x13
	DW_TAG_subroutine_type DwarfTag = 0x15
	DW_TAG_file_type       DwarfTag = 0x29
	DW_TAG_subprogram      DwarfTag = 0x2E
	DW_TAG_auto_variable   DwarfTag = 0x100
	DW_TAG_arg_variable    DwarfTag = 0x101
)

type DwarfTypeEncoding

type DwarfTypeEncoding uint32
const (
	DW_ATE_address         DwarfTypeEncoding = 0x01
	DW_ATE_boolean         DwarfTypeEncoding = 0x02
	DW_ATE_complex_float   DwarfTypeEncoding = 0x03
	DW_ATE_float           DwarfTypeEncoding = 0x04
	DW_ATE_signed          DwarfTypeEncoding = 0x05
	DW_ATE_signed_char     DwarfTypeEncoding = 0x06
	DW_ATE_unsigned        DwarfTypeEncoding = 0x07
	DW_ATE_unsigned_char   DwarfTypeEncoding = 0x08
	DW_ATE_imaginary_float DwarfTypeEncoding = 0x09
	DW_ATE_packed_decimal  DwarfTypeEncoding = 0x0a
	DW_ATE_numeric_string  DwarfTypeEncoding = 0x0b
	DW_ATE_edited          DwarfTypeEncoding = 0x0c
	DW_ATE_signed_fixed    DwarfTypeEncoding = 0x0d
	DW_ATE_unsigned_fixed  DwarfTypeEncoding = 0x0e
	DW_ATE_decimal_float   DwarfTypeEncoding = 0x0f
	DW_ATE_UTF             DwarfTypeEncoding = 0x10
	DW_ATE_lo_user         DwarfTypeEncoding = 0x80
	DW_ATE_hi_user         DwarfTypeEncoding = 0xff
)

type ExecutionEngine

type ExecutionEngine struct {
	C C.LLVMExecutionEngineRef
}

func NewExecutionEngine

func NewExecutionEngine(m Module) (ee ExecutionEngine, err error)

func NewInterpreter

func NewInterpreter(m Module) (ee ExecutionEngine, err error)

func NewMCJITCompiler

func NewMCJITCompiler(m Module, options MCJITCompilerOptions) (ee ExecutionEngine, err error)

func (ExecutionEngine) AddGlobalMapping

func (ee ExecutionEngine) AddGlobalMapping(global Value, addr unsafe.Pointer)

func (ExecutionEngine) AddModule

func (ee ExecutionEngine) AddModule(m Module)

func (ExecutionEngine) Dispose

func (ee ExecutionEngine) Dispose()

func (ExecutionEngine) FindFunction

func (ee ExecutionEngine) FindFunction(name string) (f Value)

func (ExecutionEngine) FreeMachineCodeForFunction

func (ee ExecutionEngine) FreeMachineCodeForFunction(f Value)

func (ExecutionEngine) PointerToGlobal

func (ee ExecutionEngine) PointerToGlobal(global Value) unsafe.Pointer

func (ExecutionEngine) RecompileAndRelinkFunction

func (ee ExecutionEngine) RecompileAndRelinkFunction(f Value) unsafe.Pointer

func (ExecutionEngine) RemoveModule

func (ee ExecutionEngine) RemoveModule(m Module)

func (ExecutionEngine) RunFunction

func (ee ExecutionEngine) RunFunction(f Value, args []GenericValue) (g GenericValue)

func (ExecutionEngine) RunStaticConstructors

func (ee ExecutionEngine) RunStaticConstructors()

func (ExecutionEngine) RunStaticDestructors

func (ee ExecutionEngine) RunStaticDestructors()

func (ExecutionEngine) TargetData

func (ee ExecutionEngine) TargetData() (td TargetData)

type GenericValue

type GenericValue struct {
	C C.LLVMGenericValueRef
}

func NewGenericValueFromFloat

func NewGenericValueFromFloat(t Type, n float64) (g GenericValue)

func NewGenericValueFromInt

func NewGenericValueFromInt(t Type, n uint64, signed bool) (g GenericValue)

func NewGenericValueFromPointer

func NewGenericValueFromPointer(p unsafe.Pointer) (g GenericValue)

func (GenericValue) Dispose

func (g GenericValue) Dispose()

func (GenericValue) Float

func (g GenericValue) Float(t Type) float64

func (GenericValue) Int

func (g GenericValue) Int(signed bool) uint64

func (GenericValue) IntWidth

func (g GenericValue) IntWidth() int

func (GenericValue) Pointer

func (g GenericValue) Pointer() unsafe.Pointer

type LandingPadClause

type LandingPadClause C.LLVMLandingPadClauseTy
const (
	LandingPadCatch  LandingPadClause = C.LLVMLandingPadCatch
	LandingPadFilter LandingPadClause = C.LLVMLandingPadFilter
)

type Linkage

type Linkage C.LLVMLinkage
const (
	ExternalLinkage            Linkage = C.LLVMExternalLinkage
	AvailableExternallyLinkage Linkage = C.LLVMAvailableExternallyLinkage
	LinkOnceAnyLinkage         Linkage = C.LLVMLinkOnceAnyLinkage
	LinkOnceODRLinkage         Linkage = C.LLVMLinkOnceODRLinkage
	WeakAnyLinkage             Linkage = C.LLVMWeakAnyLinkage
	WeakODRLinkage             Linkage = C.LLVMWeakODRLinkage
	AppendingLinkage           Linkage = C.LLVMAppendingLinkage
	InternalLinkage            Linkage = C.LLVMInternalLinkage
	PrivateLinkage             Linkage = C.LLVMPrivateLinkage
	DLLImportLinkage           Linkage = C.LLVMDLLImportLinkage
	DLLExportLinkage           Linkage = C.LLVMDLLExportLinkage
	ExternalWeakLinkage        Linkage = C.LLVMExternalWeakLinkage
	GhostLinkage               Linkage = C.LLVMGhostLinkage
	CommonLinkage              Linkage = C.LLVMCommonLinkage
	LinkerPrivateLinkage       Linkage = C.LLVMLinkerPrivateLinkage
	LinkerPrivateWeakLinkage   Linkage = C.LLVMLinkerPrivateWeakLinkage
)

type MCJITCompilerOptions

type MCJITCompilerOptions struct {
	OptLevel           uint
	CodeModel          CodeModel
	NoFramePointerElim bool
	EnableFastISel     bool
}

type MemoryBuffer

type MemoryBuffer struct {
	C C.LLVMMemoryBufferRef
}

func NewMemoryBufferFromFile

func NewMemoryBufferFromFile(path string) (b MemoryBuffer, err error)

func NewMemoryBufferFromStdin

func NewMemoryBufferFromStdin() (b MemoryBuffer, err error)

func WriteBitcodeToMemoryBuffer

func WriteBitcodeToMemoryBuffer(m Module) MemoryBuffer

func (MemoryBuffer) Bytes

func (b MemoryBuffer) Bytes() []byte

func (MemoryBuffer) Dispose

func (b MemoryBuffer) Dispose()

func (MemoryBuffer) IsNil

func (c MemoryBuffer) IsNil() bool

type Module

type Module struct {
	C C.LLVMModuleRef
}

func NewModule

func NewModule(name string) (m Module)

Create and destroy modules. See llvm::Module::Module.

func ParseBitcodeFile

func ParseBitcodeFile(name string) (Module, error)

ParseBitcodeFile parses the LLVM IR (bitcode) in the file with the specified name, and returns a new LLVM module.

func (Module) AddNamedMetadataOperand

func (m Module) AddNamedMetadataOperand(name string, operand Value)

func (Module) Context

func (m Module) Context() (c Context)

func (Module) DataLayout

func (m Module) DataLayout() string

Data layout. See Module::getDataLayout.

func (Module) Dispose

func (m Module) Dispose()

See llvm::Module::~Module

func (Module) Dump

func (m Module) Dump()

See Module::dump.

func (Module) FirstFunction

func (m Module) FirstFunction() (v Value)

func (Module) FirstGlobal

func (m Module) FirstGlobal() (v Value)

func (Module) GetTypeByName

func (m Module) GetTypeByName(name string) (t Type)

func (Module) IsNil

func (c Module) IsNil() bool

func (Module) LastFunction

func (m Module) LastFunction() (v Value)

func (Module) LastGlobal

func (m Module) LastGlobal() (v Value)

func (Module) NamedFunction

func (m Module) NamedFunction(name string) (v Value)

func (Module) NamedGlobal

func (m Module) NamedGlobal(name string) (v Value)

func (Module) SetDataLayout

func (m Module) SetDataLayout(layout string)

func (Module) SetInlineAsm

func (m Module) SetInlineAsm(asm string)

See Module::setModuleInlineAsm.

func (Module) SetTarget

func (m Module) SetTarget(target string)

func (Module) String

func (m Module) String() string

func (Module) Target

func (m Module) Target() string

Target triple. See Module::getTargetTriple.

type ModuleProvider

type ModuleProvider struct {
	C C.LLVMModuleProviderRef
}

func NewModuleProviderForModule

func NewModuleProviderForModule(m Module) (mp ModuleProvider)

Changes the type of M so it can be passed to FunctionPassManagers and the JIT. They take ModuleProviders for historical reasons.

func (ModuleProvider) Dispose

func (mp ModuleProvider) Dispose()

Destroys the module M.

func (ModuleProvider) IsNil

func (c ModuleProvider) IsNil() bool

type Opcode

type Opcode C.LLVMOpcode
const (
	Ret         Opcode = C.LLVMRet
	Br          Opcode = C.LLVMBr
	Switch      Opcode = C.LLVMSwitch
	IndirectBr  Opcode = C.LLVMIndirectBr
	Invoke      Opcode = C.LLVMInvoke
	Unreachable Opcode = C.LLVMUnreachable

	// Standard Binary Operators
	Add  Opcode = C.LLVMAdd
	FAdd Opcode = C.LLVMFAdd
	Sub  Opcode = C.LLVMSub
	FSub Opcode = C.LLVMFSub
	Mul  Opcode = C.LLVMMul
	FMul Opcode = C.LLVMFMul
	UDiv Opcode = C.LLVMUDiv
	SDiv Opcode = C.LLVMSDiv
	FDiv Opcode = C.LLVMFDiv
	URem Opcode = C.LLVMURem
	SRem Opcode = C.LLVMSRem
	FRem Opcode = C.LLVMFRem

	// Logical Operators
	Shl  Opcode = C.LLVMShl
	LShr Opcode = C.LLVMLShr
	AShr Opcode = C.LLVMAShr
	And  Opcode = C.LLVMAnd
	Or   Opcode = C.LLVMOr
	Xor  Opcode = C.LLVMXor

	// Memory Operators
	Alloca        Opcode = C.LLVMAlloca
	Load          Opcode = C.LLVMLoad
	Store         Opcode = C.LLVMStore
	GetElementPtr Opcode = C.LLVMGetElementPtr

	// Cast Operators
	Trunc    Opcode = C.LLVMTrunc
	ZExt     Opcode = C.LLVMZExt
	SExt     Opcode = C.LLVMSExt
	FPToUI   Opcode = C.LLVMFPToUI
	FPToSI   Opcode = C.LLVMFPToSI
	UIToFP   Opcode = C.LLVMUIToFP
	SIToFP   Opcode = C.LLVMSIToFP
	FPTrunc  Opcode = C.LLVMFPTrunc
	FPExt    Opcode = C.LLVMFPExt
	PtrToInt Opcode = C.LLVMPtrToInt
	IntToPtr Opcode = C.LLVMIntToPtr
	BitCast  Opcode = C.LLVMBitCast

	// Other Operators
	ICmp   Opcode = C.LLVMICmp
	FCmp   Opcode = C.LLVMFCmp
	PHI    Opcode = C.LLVMPHI
	Call   Opcode = C.LLVMCall
	Select Opcode = C.LLVMSelect
	// UserOp1
	// UserOp2
	VAArg          Opcode = C.LLVMVAArg
	ExtractElement Opcode = C.LLVMExtractElement
	InsertElement  Opcode = C.LLVMInsertElement
	ShuffleVector  Opcode = C.LLVMShuffleVector
	ExtractValue   Opcode = C.LLVMExtractValue
	InsertValue    Opcode = C.LLVMInsertValue
)

type PassManager

type PassManager struct {
	C C.LLVMPassManagerRef
}

func NewFunctionPassManagerForModule

func NewFunctionPassManagerForModule(m Module) (pm PassManager)

Constructs a new function-by-function pass pipeline over the module provider. It does not take ownership of the module provider. This type of pipeline is suitable for code generation and JIT compilation tasks. See llvm::FunctionPassManager::FunctionPassManager.

func NewPassManager

func NewPassManager() (pm PassManager)

Constructs a new whole-module pass pipeline. This type of pipeline is suitable for link-time optimization and whole-module transformations. See llvm::PassManager::PassManager.

func (PassManager) Add

func (pm PassManager) Add(td TargetData)

Adds target data information to a pass manager. This does not take ownership of the target data. See the method llvm::PassManagerBase::add.

func (PassManager) AddAddressSanitizerFunctionPass

func (pm PassManager) AddAddressSanitizerFunctionPass()

func (PassManager) AddAddressSanitizerModulePass

func (pm PassManager) AddAddressSanitizerModulePass()

func (PassManager) AddAggressiveDCEPass

func (pm PassManager) AddAggressiveDCEPass()

func (PassManager) AddArgumentPromotionPass

func (pm PassManager) AddArgumentPromotionPass()

func (PassManager) AddCFGSimplificationPass

func (pm PassManager) AddCFGSimplificationPass()

func (PassManager) AddConstantMergePass

func (pm PassManager) AddConstantMergePass()

func (PassManager) AddConstantPropagationPass

func (pm PassManager) AddConstantPropagationPass()

func (PassManager) AddDataFlowSanitizerPass

func (pm PassManager) AddDataFlowSanitizerPass(abilist string)

func (PassManager) AddDeadArgEliminationPass

func (pm PassManager) AddDeadArgEliminationPass()

func (PassManager) AddDeadStoreEliminationPass

func (pm PassManager) AddDeadStoreEliminationPass()

func (PassManager) AddDemoteMemoryToRegisterPass

func (pm PassManager) AddDemoteMemoryToRegisterPass()

func (PassManager) AddFunctionAttrsPass

func (pm PassManager) AddFunctionAttrsPass()

func (PassManager) AddFunctionInliningPass

func (pm PassManager) AddFunctionInliningPass()

func (PassManager) AddGVNPass

func (pm PassManager) AddGVNPass()

func (PassManager) AddGlobalDCEPass

func (pm PassManager) AddGlobalDCEPass()

func (PassManager) AddGlobalOptimizerPass

func (pm PassManager) AddGlobalOptimizerPass()

func (PassManager) AddIPConstantPropagationPass

func (pm PassManager) AddIPConstantPropagationPass()

func (PassManager) AddIPSCCPPass

func (pm PassManager) AddIPSCCPPass()

func (PassManager) AddIndVarSimplifyPass

func (pm PassManager) AddIndVarSimplifyPass()

func (PassManager) AddInstructionCombiningPass

func (pm PassManager) AddInstructionCombiningPass()

func (PassManager) AddInternalizePass

func (pm PassManager) AddInternalizePass(allButMain bool)

func (PassManager) AddJumpThreadingPass

func (pm PassManager) AddJumpThreadingPass()

func (PassManager) AddLICMPass

func (pm PassManager) AddLICMPass()

func (PassManager) AddLoopDeletionPass

func (pm PassManager) AddLoopDeletionPass()

func (PassManager) AddLoopRotatePass

func (pm PassManager) AddLoopRotatePass()

func (PassManager) AddLoopUnrollPass

func (pm PassManager) AddLoopUnrollPass()

func (PassManager) AddLoopUnswitchPass

func (pm PassManager) AddLoopUnswitchPass()

func (PassManager) AddMemCpyOptPass

func (pm PassManager) AddMemCpyOptPass()

func (PassManager) AddMemorySanitizerPass

func (pm PassManager) AddMemorySanitizerPass()

func (PassManager) AddPromoteMemoryToRegisterPass

func (pm PassManager) AddPromoteMemoryToRegisterPass()

func (PassManager) AddPruneEHPass

func (pm PassManager) AddPruneEHPass()

func (PassManager) AddReassociatePass

func (pm PassManager) AddReassociatePass()

func (PassManager) AddSCCPPass

func (pm PassManager) AddSCCPPass()

func (PassManager) AddScalarReplAggregatesPass

func (pm PassManager) AddScalarReplAggregatesPass()

func (PassManager) AddScalarReplAggregatesPassWithThreshold

func (pm PassManager) AddScalarReplAggregatesPassWithThreshold(threshold int)

func (PassManager) AddSimplifyLibCallsPass

func (pm PassManager) AddSimplifyLibCallsPass()

func (PassManager) AddStripDeadPrototypesPass

func (pm PassManager) AddStripDeadPrototypesPass()

func (PassManager) AddTailCallEliminationPass

func (pm PassManager) AddTailCallEliminationPass()

func (PassManager) AddThreadSanitizerPass

func (pm PassManager) AddThreadSanitizerPass()

func (PassManager) AddVerifierPass

func (pm PassManager) AddVerifierPass()

func (PassManager) Dispose

func (pm PassManager) Dispose()

Frees the memory of a pass pipeline. For function pipelines, does not free the module provider. See llvm::PassManagerBase::~PassManagerBase.

func (PassManager) FinalizeFunc

func (pm PassManager) FinalizeFunc() bool

Finalizes all of the function passes scheduled in in the function pass manager. Returns 1 if any of the passes modified the module, 0 otherwise. See llvm::FunctionPassManager::doFinalization.

func (PassManager) InitializeFunc

func (pm PassManager) InitializeFunc() bool

Initializes all of the function passes scheduled in the function pass manager. Returns 1 if any of the passes modified the module, 0 otherwise. See llvm::FunctionPassManager::doInitialization.

func (PassManager) IsNil

func (c PassManager) IsNil() bool

func (PassManager) Run

func (pm PassManager) Run(m Module) bool

Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass manager. Returns 1 if any of the passes modified the module, 0 otherwise. See llvm::PassManager::run(Module&).

func (PassManager) RunFunc

func (pm PassManager) RunFunc(f Value) bool

Executes all of the function passes scheduled in the function pass manager on the provided function. Returns 1 if any of the passes modified the function, false otherwise. See llvm::FunctionPassManager::run(Function&).

type PassManagerBuilder

type PassManagerBuilder struct {
	C C.LLVMPassManagerBuilderRef
}

func NewPassManagerBuilder

func NewPassManagerBuilder() (pmb PassManagerBuilder)

func (PassManagerBuilder) Dispose

func (pmb PassManagerBuilder) Dispose()

func (PassManagerBuilder) Populate

func (pmb PassManagerBuilder) Populate(pm PassManager)

func (PassManagerBuilder) PopulateFunc

func (pmb PassManagerBuilder) PopulateFunc(pm PassManager)

func (PassManagerBuilder) SetOptLevel

func (pmb PassManagerBuilder) SetOptLevel(level int)

func (PassManagerBuilder) SetSizeLevel

func (pmb PassManagerBuilder) SetSizeLevel(level int)

type RelocMode

type RelocMode C.LLVMRelocMode
const (
	RelocDefault      RelocMode = C.LLVMRelocDefault
	RelocStatic       RelocMode = C.LLVMRelocStatic
	RelocPIC          RelocMode = C.LLVMRelocPIC
	RelocDynamicNoPic RelocMode = C.LLVMRelocDynamicNoPic
)

type Target

type Target struct {
	C C.LLVMTargetRef
}

func FirstTarget

func FirstTarget() Target

func GetTargetFromTriple

func GetTargetFromTriple(triple string) (t Target, err error)

func (Target) CreateTargetMachine

func (t Target) CreateTargetMachine(Triple string, CPU string, Features string,
	Level CodeGenOptLevel, Reloc RelocMode,
	CodeModel CodeModel) (tm TargetMachine)

CreateTargetMachine creates a new TargetMachine.

func (Target) Description

func (t Target) Description() string

func (Target) Name

func (t Target) Name() string

func (Target) NextTarget

func (t Target) NextTarget() Target

type TargetData

type TargetData struct {
	C C.LLVMTargetDataRef
}

func NewTargetData

func NewTargetData(rep string) (td TargetData)

Creates target data from a target layout string. See the constructor llvm::TargetData::TargetData.

func (TargetData) ABITypeAlignment

func (td TargetData) ABITypeAlignment(t Type) int

Computes the ABI alignment of a type in bytes for a target. See the method llvm::TargetData::getABITypeAlignment.

func (TargetData) ByteOrder

func (td TargetData) ByteOrder() ByteOrdering

Returns the byte order of a target, either BigEndian or LittleEndian. See the method llvm::TargetData::isLittleEndian.

func (TargetData) CallFrameTypeAlignment

func (td TargetData) CallFrameTypeAlignment(t Type) int

Computes the call frame alignment of a type in bytes for a target. See the method llvm::TargetData::getCallFrameTypeAlignment.

func (TargetData) Dispose

func (td TargetData) Dispose()

Deallocates a TargetData. See the destructor llvm::TargetData::~TargetData.

func (TargetData) ElementContainingOffset

func (td TargetData) ElementContainingOffset(t Type, offset uint64) int

Computes the structure element that contains the byte offset for a target. See the method llvm::StructLayout::getElementContainingOffset.

func (TargetData) ElementOffset

func (td TargetData) ElementOffset(t Type, element int) uint64

Computes the byte offset of the indexed struct element for a target. See the method llvm::StructLayout::getElementOffset.

func (TargetData) IntPtrType

func (td TargetData) IntPtrType() (t Type)

Returns the integer type that is the same size as a pointer on a target. See the method llvm::TargetData::getIntPtrType.

func (TargetData) PointerSize

func (td TargetData) PointerSize() int

Returns the pointer size in bytes for a target. See the method llvm::TargetData::getPointerSize.

func (TargetData) PrefTypeAlignment

func (td TargetData) PrefTypeAlignment(t Type) int

Computes the preferred alignment of a type in bytes for a target. See the method llvm::TargetData::getPrefTypeAlignment.

func (TargetData) PreferredAlignment

func (td TargetData) PreferredAlignment(g Value) int

Computes the preferred alignment of a global variable in bytes for a target. See the method llvm::TargetData::getPreferredAlignment.

func (TargetData) String

func (td TargetData) String() (s string)

Converts target data to a target layout string. The string must be disposed with LLVMDisposeMessage. See the constructor llvm::TargetData::TargetData.

func (TargetData) TypeAllocSize

func (td TargetData) TypeAllocSize(t Type) uint64

Computes the ABI size of a type in bytes for a target. See the method llvm::TargetData::getTypeAllocSize.

func (TargetData) TypeSizeInBits

func (td TargetData) TypeSizeInBits(t Type) uint64

Computes the size of a type in bytes for a target. See the method llvm::TargetData::getTypeSizeInBits.

func (TargetData) TypeStoreSize

func (td TargetData) TypeStoreSize(t Type) uint64

Computes the storage size of a type in bytes for a target. See the method llvm::TargetData::getTypeStoreSize.

type TargetMachine

type TargetMachine struct {
	C C.LLVMTargetMachineRef
}

func (TargetMachine) AddAnalysisPasses

func (tm TargetMachine) AddAnalysisPasses(pm PassManager)

func (TargetMachine) Dispose

func (tm TargetMachine) Dispose()

Dispose releases resources related to the TargetMachine.

func (TargetMachine) EmitToMemoryBuffer

func (tm TargetMachine) EmitToMemoryBuffer(m Module, ft CodeGenFileType) (MemoryBuffer, error)

func (TargetMachine) TargetData

func (tm TargetMachine) TargetData() TargetData

TargetData returns the TargetData for the machine.

func (TargetMachine) Triple

func (tm TargetMachine) Triple() string

Triple returns the triple describing the machine (arch-vendor-os).

type Type

type Type struct {
	C C.LLVMTypeRef
}

func ArrayType

func ArrayType(elementType Type, elementCount int) (t Type)

Operations on array, pointer, and vector types (sequence types)

func DoubleType

func DoubleType() (t Type)

func FP128Type

func FP128Type() (t Type)

func FloatType

func FloatType() (t Type)

func FunctionType

func FunctionType(returnType Type, paramTypes []Type, isVarArg bool) (t Type)

Operations on function types

func Int16Type

func Int16Type() (t Type)

func Int1Type

func Int1Type() (t Type)

func Int32Type

func Int32Type() (t Type)

func Int64Type

func Int64Type() (t Type)

func Int8Type

func Int8Type() (t Type)

func IntType

func IntType(numbits int) (t Type)

func LabelType

func LabelType() (t Type)

func PPCFP128Type

func PPCFP128Type() (t Type)

func PointerType

func PointerType(elementType Type, addressSpace int) (t Type)

func StructType

func StructType(elementTypes []Type, packed bool) (t Type)

func VectorType

func VectorType(elementType Type, elementCount int) (t Type)

func VoidType

func VoidType() (t Type)

func X86FP80Type

func X86FP80Type() (t Type)

func (Type) ArrayLength

func (t Type) ArrayLength() int

func (Type) Context

func (t Type) Context() (c Context)

See llvm::LLVMType::getContext.

func (Type) ElementType

func (t Type) ElementType() (rt Type)

func (Type) IntTypeWidth

func (t Type) IntTypeWidth() int

func (Type) IsFunctionVarArg

func (t Type) IsFunctionVarArg() bool

func (Type) IsNil

func (c Type) IsNil() bool

func (Type) IsStructPacked

func (t Type) IsStructPacked() bool

func (Type) ParamTypes

func (t Type) ParamTypes() []Type

func (Type) ParamTypesCount

func (t Type) ParamTypesCount() int

func (Type) PointerAddressSpace

func (t Type) PointerAddressSpace() int

func (Type) ReturnType

func (t Type) ReturnType() (rt Type)

func (Type) String

func (t Type) String() string

func (Type) StructElementTypes

func (t Type) StructElementTypes() []Type

func (Type) StructElementTypesCount

func (t Type) StructElementTypesCount() int

func (Type) StructName

func (t Type) StructName() string

func (Type) StructSetBody

func (t Type) StructSetBody(elementTypes []Type, packed bool)

func (Type) TypeKind

func (t Type) TypeKind() TypeKind

See llvm::LLVMTypeKind::getTypeID.

func (Type) VectorSize

func (t Type) VectorSize() int

type TypeKind

type TypeKind C.LLVMTypeKind
const (
	VoidTypeKind      TypeKind = C.LLVMVoidTypeKind
	FloatTypeKind     TypeKind = C.LLVMFloatTypeKind
	DoubleTypeKind    TypeKind = C.LLVMDoubleTypeKind
	X86_FP80TypeKind  TypeKind = C.LLVMX86_FP80TypeKind
	FP128TypeKind     TypeKind = C.LLVMFP128TypeKind
	PPC_FP128TypeKind TypeKind = C.LLVMPPC_FP128TypeKind
	LabelTypeKind     TypeKind = C.LLVMLabelTypeKind
	IntegerTypeKind   TypeKind = C.LLVMIntegerTypeKind
	FunctionTypeKind  TypeKind = C.LLVMFunctionTypeKind
	StructTypeKind    TypeKind = C.LLVMStructTypeKind
	ArrayTypeKind     TypeKind = C.LLVMArrayTypeKind
	PointerTypeKind   TypeKind = C.LLVMPointerTypeKind
	VectorTypeKind    TypeKind = C.LLVMVectorTypeKind
	MetadataTypeKind  TypeKind = C.LLVMMetadataTypeKind
)

func (TypeKind) String

func (t TypeKind) String() string

type Use

type Use struct {
	C C.LLVMUseRef
}

func (Use) IsNil

func (c Use) IsNil() bool

func (Use) NextUse

func (u Use) NextUse() (ru Use)

func (Use) UsedValue

func (u Use) UsedValue() (v Value)

func (Use) User

func (u Use) User() (v Value)

type Value

type Value struct {
	C C.LLVMValueRef
}

func AddAlias

func AddAlias(m Module, t Type, aliasee Value, name string) (v Value)

Operations on aliases

func AddFunction

func AddFunction(m Module, name string, ft Type) (v Value)

Operations on functions

func AddGlobal

func AddGlobal(m Module, t Type, name string) (v Value)

Operations on global variables

func AddGlobalInAddressSpace

func AddGlobalInAddressSpace(m Module, t Type, name string, addressSpace int) (v Value)

func AlignOf

func AlignOf(t Type) (v Value)

func BlockAddress

func BlockAddress(f Value, bb BasicBlock) (v Value)

func ConstAShr

func ConstAShr(lhs, rhs Value) (v Value)

func ConstAdd

func ConstAdd(lhs, rhs Value) (v Value)

func ConstAllOnes

func ConstAllOnes(t Type) (v Value)

func ConstAnd

func ConstAnd(lhs, rhs Value) (v Value)

func ConstArray

func ConstArray(t Type, constVals []Value) (v Value)

func ConstBitCast

func ConstBitCast(v Value, t Type) (rv Value)

func ConstExactSDiv

func ConstExactSDiv(lhs, rhs Value) (v Value)

func ConstExtractElement

func ConstExtractElement(vec, i Value) (rv Value)

func ConstExtractValue

func ConstExtractValue(agg Value, indices []uint32) (rv Value)

func ConstFAdd

func ConstFAdd(lhs, rhs Value) (v Value)

func ConstFCmp

func ConstFCmp(pred FloatPredicate, lhs, rhs Value) (v Value)

func ConstFDiv

func ConstFDiv(lhs, rhs Value) (v Value)

func ConstFMul

func ConstFMul(lhs, rhs Value) (v Value)

func ConstFNeg

func ConstFNeg(v Value) (rv Value)

func ConstFPCast

func ConstFPCast(v Value, t Type) (rv Value)

func ConstFPExt

func ConstFPExt(v Value, t Type) (rv Value)

func ConstFPToSI

func ConstFPToSI(v Value, t Type) (rv Value)

func ConstFPToUI

func ConstFPToUI(v Value, t Type) (rv Value)

func ConstFPTrunc

func ConstFPTrunc(v Value, t Type) (rv Value)

func ConstFRem

func ConstFRem(lhs, rhs Value) (v Value)

func ConstFSub

func ConstFSub(lhs, rhs Value) (v Value)

func ConstFloat

func ConstFloat(t Type, n float64) (v Value)

func ConstFloatFromString

func ConstFloatFromString(t Type, str string) (v Value)

func ConstGEP

func ConstGEP(v Value, indices []Value) (rv Value)

func ConstICmp

func ConstICmp(pred IntPredicate, lhs, rhs Value) (v Value)

func ConstInBoundsGEP

func ConstInBoundsGEP(v Value, indices []Value) (rv Value)

func ConstInsertElement

func ConstInsertElement(vec, elem, i Value) (rv Value)

func ConstInsertValue

func ConstInsertValue(agg, val Value, indices []uint32) (rv Value)

func ConstInt

func ConstInt(t Type, n uint64, signExtend bool) (v Value)

Operations on scalar constants

func ConstIntCast

func ConstIntCast(v Value, t Type, signed bool) (rv Value)

func ConstIntFromString

func ConstIntFromString(t Type, str string, radix int) (v Value)

func ConstIntToPtr

func ConstIntToPtr(v Value, t Type) (rv Value)

func ConstLShr

func ConstLShr(lhs, rhs Value) (v Value)

func ConstMul

func ConstMul(lhs, rhs Value) (v Value)

func ConstNSWAdd

func ConstNSWAdd(lhs, rhs Value) (v Value)

func ConstNSWMul

func ConstNSWMul(lhs, rhs Value) (v Value)

func ConstNSWNeg

func ConstNSWNeg(v Value) (rv Value)

func ConstNSWSub

func ConstNSWSub(lhs, rhs Value) (v Value)

func ConstNUWAdd

func ConstNUWAdd(lhs, rhs Value) (v Value)

func ConstNUWMul

func ConstNUWMul(lhs, rhs Value) (v Value)

func ConstNUWNeg

func ConstNUWNeg(v Value) (rv Value)

func ConstNUWSub

func ConstNUWSub(lhs, rhs Value) (v Value)

func ConstNamedStruct

func ConstNamedStruct(t Type, constVals []Value) (v Value)

func ConstNeg

func ConstNeg(v Value) (rv Value)

func ConstNot

func ConstNot(v Value) (rv Value)

func ConstNull

func ConstNull(t Type) (v Value)

Operations on constants of any type

func ConstOr

func ConstOr(lhs, rhs Value) (v Value)

func ConstPointerCast

func ConstPointerCast(v Value, t Type) (rv Value)

func ConstPointerNull

func ConstPointerNull(t Type) (v Value)

func ConstPtrToInt

func ConstPtrToInt(v Value, t Type) (rv Value)

func ConstSDiv

func ConstSDiv(lhs, rhs Value) (v Value)

func ConstSExt

func ConstSExt(v Value, t Type) (rv Value)

func ConstSExtOrBitCast

func ConstSExtOrBitCast(v Value, t Type) (rv Value)

func ConstSIToFP

func ConstSIToFP(v Value, t Type) (rv Value)

func ConstSRem

func ConstSRem(lhs, rhs Value) (v Value)

func ConstSelect

func ConstSelect(cond, iftrue, iffalse Value) (rv Value)

func ConstShl

func ConstShl(lhs, rhs Value) (v Value)

func ConstShuffleVector

func ConstShuffleVector(veca, vecb, mask Value) (rv Value)

func ConstString

func ConstString(str string, addnull bool) (v Value)

func ConstStruct

func ConstStruct(constVals []Value, packed bool) (v Value)

func ConstSub

func ConstSub(lhs, rhs Value) (v Value)

func ConstTrunc

func ConstTrunc(v Value, t Type) (rv Value)

func ConstTruncOrBitCast

func ConstTruncOrBitCast(v Value, t Type) (rv Value)

func ConstUDiv

func ConstUDiv(lhs, rhs Value) (v Value)

func ConstUIToFP

func ConstUIToFP(v Value, t Type) (rv Value)

func ConstURem

func ConstURem(lhs, rhs Value) (v Value)

func ConstVector

func ConstVector(scalarConstVals []Value, packed bool) (v Value)

func ConstXor

func ConstXor(lhs, rhs Value) (v Value)

func ConstZExt

func ConstZExt(v Value, t Type) (rv Value)

func ConstZExtOrBitCast

func ConstZExtOrBitCast(v Value, t Type) (rv Value)

func MDNode

func MDNode(vals []Value) (v Value)

func MDString

func MDString(str string) (v Value)

func NextFunction

func NextFunction(v Value) (rv Value)

func NextGlobal

func NextGlobal(v Value) (rv Value)

func NextInstruction

func NextInstruction(v Value) (rv Value)

func NextParam

func NextParam(v Value) (rv Value)

func PrevFunction

func PrevFunction(v Value) (rv Value)

func PrevGlobal

func PrevGlobal(v Value) (rv Value)

func PrevInstruction

func PrevInstruction(v Value) (rv Value)

func PrevParam

func PrevParam(v Value) (rv Value)

func SizeOf

func SizeOf(t Type) (v Value)

func Undef

func Undef(t Type) (v Value)

func (Value) AddAttribute

func (v Value) AddAttribute(a Attribute)

func (Value) AddCase

func (v Value) AddCase(on Value, dest BasicBlock)

Add a case to the switch instruction

func (Value) AddClause

func (l Value) AddClause(v Value)

func (Value) AddDest

func (v Value) AddDest(dest BasicBlock)

Add a destination to the indirectbr instruction

func (Value) AddFunctionAttr

func (v Value) AddFunctionAttr(a Attribute)

func (Value) AddIncoming

func (v Value) AddIncoming(vals []Value, blocks []BasicBlock)

Operations on phi nodes

func (Value) AddInstrAttribute

func (v Value) AddInstrAttribute(i int, a Attribute)

func (Value) AddTargetDependentFunctionAttr

func (v Value) AddTargetDependentFunctionAttr(attr, value string)

func (Value) Alignment

func (v Value) Alignment() int

func (Value) AsBasicBlock

func (v Value) AsBasicBlock() (bb BasicBlock)

func (Value) Attribute

func (v Value) Attribute() Attribute

func (Value) BasicBlocks

func (v Value) BasicBlocks() []BasicBlock

func (Value) BasicBlocksCount

func (v Value) BasicBlocksCount() int

func (Value) Dump

func (v Value) Dump()

func (Value) EntryBasicBlock

func (v Value) EntryBasicBlock() (bb BasicBlock)

func (Value) EraseFromParentAsFunction

func (v Value) EraseFromParentAsFunction()

func (Value) EraseFromParentAsGlobal

func (v Value) EraseFromParentAsGlobal()

func (Value) FirstBasicBlock

func (v Value) FirstBasicBlock() (bb BasicBlock)

func (Value) FirstParam

func (v Value) FirstParam() (rv Value)

func (Value) FirstUse

func (v Value) FirstUse() (u Use)

Operations on Uses

func (Value) FunctionAttr

func (v Value) FunctionAttr() Attribute

func (Value) FunctionCallConv

func (v Value) FunctionCallConv() CallConv

func (Value) GC

func (v Value) GC() string

func (Value) GlobalParent

func (v Value) GlobalParent() (m Module)

Operations on global variables, functions, and aliases (globals)

func (Value) HasMetadata

func (v Value) HasMetadata() bool

func (Value) IncomingBlock

func (v Value) IncomingBlock(i int) (bb BasicBlock)

func (Value) IncomingCount

func (v Value) IncomingCount() int

func (Value) IncomingValue

func (v Value) IncomingValue(i int) (rv Value)

func (Value) Initializer

func (v Value) Initializer() (rv Value)

func (Value) InstructionCallConv

func (v Value) InstructionCallConv() CallConv

func (Value) InstructionOpcode

func (v Value) InstructionOpcode() Opcode

func (Value) InstructionParent

func (v Value) InstructionParent() (bb BasicBlock)

Operations on instructions

func (Value) IntrinsicID

func (v Value) IntrinsicID() int

func (Value) IsAAllocaInst

func (v Value) IsAAllocaInst() (rv Value)

func (Value) IsAArgument

func (v Value) IsAArgument() (rv Value)

Conversion functions. Generated using preprocess statements above. Return the input value if it is an instance of the specified class, otherwise NULL. See llvm::dyn_cast_or_null<>.

func (Value) IsABasicBlock

func (v Value) IsABasicBlock() (rv Value)

func (Value) IsABinaryOperator

func (v Value) IsABinaryOperator() (rv Value)

func (Value) IsABitCastInst

func (v Value) IsABitCastInst() (rv Value)

func (Value) IsABranchInst

func (v Value) IsABranchInst() (rv Value)

func (Value) IsACallInst

func (v Value) IsACallInst() (rv Value)

func (Value) IsACastInst

func (v Value) IsACastInst() (rv Value)

func (Value) IsACmpInst

func (v Value) IsACmpInst() (rv Value)

func (Value) IsAConstant

func (v Value) IsAConstant() (rv Value)

func (Value) IsAConstantAggregateZero

func (v Value) IsAConstantAggregateZero() (rv Value)

func (Value) IsAConstantArray

func (v Value) IsAConstantArray() (rv Value)

func (Value) IsAConstantExpr

func (v Value) IsAConstantExpr() (rv Value)

func (Value) IsAConstantFP

func (v Value) IsAConstantFP() (rv Value)

func (Value) IsAConstantInt

func (v Value) IsAConstantInt() (rv Value)

func (Value) IsAConstantPointerNull

func (v Value) IsAConstantPointerNull() (rv Value)

func (Value) IsAConstantStruct

func (v Value) IsAConstantStruct() (rv Value)

func (Value) IsAConstantVector

func (v Value) IsAConstantVector() (rv Value)

func (Value) IsADbgDeclareInst

func (v Value) IsADbgDeclareInst() (rv Value)

func (Value) IsADbgInfoIntrinsic

func (v Value) IsADbgInfoIntrinsic() (rv Value)

func (Value) IsAExtractElementInst

func (v Value) IsAExtractElementInst() (rv Value)

func (Value) IsAExtractValueInst

func (v Value) IsAExtractValueInst() (rv Value)

func (Value) IsAFCmpInst

func (v Value) IsAFCmpInst() (rv Value)

func (Value) IsAFPExtInst

func (v Value) IsAFPExtInst() (rv Value)

func (Value) IsAFPToSIInst

func (v Value) IsAFPToSIInst() (rv Value)

func (Value) IsAFPToUIInst

func (v Value) IsAFPToUIInst() (rv Value)

func (Value) IsAFPTruncInst

func (v Value) IsAFPTruncInst() (rv Value)

func (Value) IsAFunction

func (v Value) IsAFunction() (rv Value)

func (Value) IsAGetElementPtrInst

func (v Value) IsAGetElementPtrInst() (rv Value)

func (Value) IsAGlobalAlias

func (v Value) IsAGlobalAlias() (rv Value)

func (Value) IsAGlobalValue

func (v Value) IsAGlobalValue() (rv Value)

func (Value) IsAGlobalVariable

func (v Value) IsAGlobalVariable() (rv Value)

func (Value) IsAICmpInst

func (v Value) IsAICmpInst() (rv Value)

func (Value) IsAInlineAsm

func (v Value) IsAInlineAsm() (rv Value)

func (Value) IsAInsertElementInst

func (v Value) IsAInsertElementInst() (rv Value)

func (Value) IsAInsertValueInst

func (v Value) IsAInsertValueInst() (rv Value)

func (Value) IsAInstruction

func (v Value) IsAInstruction() (rv Value)

func (Value) IsAIntToPtrInst

func (v Value) IsAIntToPtrInst() (rv Value)

func (Value) IsAIntrinsicInst

func (v Value) IsAIntrinsicInst() (rv Value)

func (Value) IsAInvokeInst

func (v Value) IsAInvokeInst() (rv Value)

func (Value) IsALoadInst

func (v Value) IsALoadInst() (rv Value)

func (Value) IsAMemCpyInst

func (v Value) IsAMemCpyInst() (rv Value)

func (Value) IsAMemIntrinsic

func (v Value) IsAMemIntrinsic() (rv Value)

func (Value) IsAMemMoveInst

func (v Value) IsAMemMoveInst() (rv Value)

func (Value) IsAMemSetInst

func (v Value) IsAMemSetInst() (rv Value)

func (Value) IsAPHINode

func (v Value) IsAPHINode() (rv Value)

func (Value) IsAPtrToIntInst

func (v Value) IsAPtrToIntInst() (rv Value)

func (Value) IsAReturnInst

func (v Value) IsAReturnInst() (rv Value)

func (Value) IsASExtInst

func (v Value) IsASExtInst() (rv Value)

func (Value) IsASIToFPInst

func (v Value) IsASIToFPInst() (rv Value)

func (Value) IsASelectInst

func (v Value) IsASelectInst() (rv Value)

func (Value) IsAShuffleVectorInst

func (v Value) IsAShuffleVectorInst() (rv Value)

func (Value) IsAStoreInst

func (v Value) IsAStoreInst() (rv Value)

func (Value) IsASwitchInst

func (v Value) IsASwitchInst() (rv Value)

func (Value) IsATerminatorInst

func (v Value) IsATerminatorInst() (rv Value)

func (Value) IsATruncInst

func (v Value) IsATruncInst() (rv Value)

func (Value) IsAUIToFPInst

func (v Value) IsAUIToFPInst() (rv Value)

func (Value) IsAUnaryInstruction

func (v Value) IsAUnaryInstruction() (rv Value)

func (Value) IsAUndefValue

func (v Value) IsAUndefValue() (rv Value)

func (Value) IsAUnreachableInst

func (v Value) IsAUnreachableInst() (rv Value)

func (Value) IsAUser

func (v Value) IsAUser() (rv Value)

func (Value) IsAVAArgInst

func (v Value) IsAVAArgInst() (rv Value)

func (Value) IsAZExtInst

func (v Value) IsAZExtInst() (rv Value)

func (Value) IsBasicBlock

func (v Value) IsBasicBlock() bool

func (Value) IsConstant

func (v Value) IsConstant() bool

func (Value) IsDeclaration

func (v Value) IsDeclaration() bool

func (Value) IsGlobalConstant

func (v Value) IsGlobalConstant() bool

func (Value) IsNil

func (c Value) IsNil() bool

func (Value) IsNull

func (v Value) IsNull() bool

func (Value) IsTailCall

func (v Value) IsTailCall() bool

Operations on call instructions (only)

func (Value) IsThreadLocal

func (v Value) IsThreadLocal() bool

func (Value) IsUndef

func (v Value) IsUndef() bool

func (Value) LastBasicBlock

func (v Value) LastBasicBlock() (bb BasicBlock)

func (Value) LastParam

func (v Value) LastParam() (rv Value)

func (Value) Linkage

func (v Value) Linkage() Linkage

func (Value) Metadata

func (v Value) Metadata(kind int) (rv Value)

func (Value) Name

func (v Value) Name() string

func (Value) Opcode

func (v Value) Opcode() Opcode

Constant expressions

func (Value) Operand

func (v Value) Operand(i int) (rv Value)

Operations on Users

func (Value) OperandsCount

func (v Value) OperandsCount() int

func (Value) Param

func (v Value) Param(i int) (rv Value)

func (Value) ParamParent

func (v Value) ParamParent() (rv Value)

func (Value) Params

func (v Value) Params() []Value

func (Value) ParamsCount

func (v Value) ParamsCount() int

Operations on parameters

func (Value) RemoveAttribute

func (v Value) RemoveAttribute(a Attribute)

func (Value) RemoveFunctionAttr

func (v Value) RemoveFunctionAttr(a Attribute)

func (Value) RemoveInstrAttribute

func (v Value) RemoveInstrAttribute(i int, a Attribute)

func (Value) ReplaceAllUsesWith

func (v Value) ReplaceAllUsesWith(nv Value)

func (Value) SExtValue

func (v Value) SExtValue() int64

func (Value) Section

func (v Value) Section() string

func (Value) SetAlignment

func (v Value) SetAlignment(a int)

func (Value) SetCleanup

func (l Value) SetCleanup(cleanup bool)

func (Value) SetFunctionCallConv

func (v Value) SetFunctionCallConv(cc CallConv)

func (Value) SetGC

func (v Value) SetGC(name string)

func (Value) SetGlobalConstant

func (v Value) SetGlobalConstant(gc bool)

func (Value) SetInitializer

func (v Value) SetInitializer(cv Value)

func (Value) SetInstrParamAlignment

func (v Value) SetInstrParamAlignment(i int, align int)

func (Value) SetInstructionCallConv

func (v Value) SetInstructionCallConv(cc CallConv)

Operations on call sites

func (Value) SetLinkage

func (v Value) SetLinkage(l Linkage)

func (Value) SetMetadata

func (v Value) SetMetadata(kind int, node Value)

func (Value) SetName

func (v Value) SetName(name string)

func (Value) SetOperand

func (v Value) SetOperand(i int, op Value)

func (Value) SetParamAlignment

func (v Value) SetParamAlignment(align int)

func (Value) SetSection

func (v Value) SetSection(str string)

func (Value) SetTailCall

func (v Value) SetTailCall(is bool)

func (Value) SetThreadLocal

func (v Value) SetThreadLocal(tl bool)

func (Value) SetVisibility

func (v Value) SetVisibility(vi Visibility)

func (Value) Type

func (v Value) Type() (t Type)

Operations on all values

func (Value) Visibility

func (v Value) Visibility() Visibility

func (Value) ZExtValue

func (v Value) ZExtValue() uint64

type VerifierFailureAction

type VerifierFailureAction C.LLVMVerifierFailureAction
const (
	// verifier will print to stderr and abort()
	AbortProcessAction VerifierFailureAction = C.LLVMAbortProcessAction
	// verifier will print to stderr and return 1
	PrintMessageAction VerifierFailureAction = C.LLVMPrintMessageAction
	// verifier will just return 1
	ReturnStatusAction VerifierFailureAction = C.LLVMReturnStatusAction
)

type Visibility

type Visibility C.LLVMVisibility
const (
	DefaultVisibility   Visibility = C.LLVMDefaultVisibility
	HiddenVisibility    Visibility = C.LLVMHiddenVisibility
	ProtectedVisibility Visibility = C.LLVMProtectedVisibility
)

Directories

Path Synopsis
examples
factorial
Taken from: http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
Taken from: http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL