Documentation
¶
Index ¶
- Constants
- Variables
- func FullName(pkg *types.Package, name string) string
- func FuncAddCtx(ctx *types.Var, sig *types.Signature) *types.Signature
- func FuncName(pkg *types.Package, name string, recv *types.Var, org bool) string
- func HasNameValist(sig *types.Signature) bool
- func Initialize(flags InitFlags)
- func Instantiate(orig types.Type, t *types.Named) (types.Type, bool)
- func IsClosure(raw *types.Struct) bool
- func MethodSymbolName(receiverPkg *types.Package, method *types.Func, name string) string
- func NameOf(typ *types.Named) string
- func PathOf(pkg *types.Package) string
- func SetDebug(dbgFlags dbgFlags)
- func StripModuleTarget(ir string) string
- func TypeArgs(typeArgs []types.Type) string
- func VArg() *types.Var
- type AbiSymbol
- type AbiTypeInfo
- type AtomicOp
- type AtomicOrdering
- type Background
- type BasicBlock
- type Builder
- func (b Builder) Advance(ptr Expr, offset Expr) Expr
- func (b Builder) Aggregate(t Type, flds ...Expr) Expr
- func (b Builder) Alloc(elem Type, heap bool) (ret Expr)
- func (b Builder) AllocCStr(gostr Expr) (ret Expr)
- func (b Builder) AllocU(elem Type, n ...int64) (ret Expr)
- func (b Builder) AllocZ(n Expr) (ret Expr)
- func (b Builder) Alloca(n Expr) (ret Expr)
- func (b Builder) AllocaCStr(gostr Expr) (ret Expr)
- func (b Builder) AllocaCStrs(strs Expr, endWithNil bool) (cstrs Expr)
- func (b Builder) AllocaSigjmpBuf() Expr
- func (b Builder) AllocaT(t Type) (ret Expr)
- func (b Builder) ArrayAlloca(telem Type, n Expr) (ret Expr)
- func (b Builder) AssertNilDeref(ptr Expr)
- func (b Builder) Atomic(op AtomicOp, ptr, val Expr) Expr
- func (b Builder) AtomicCmpXchg(ptr, old, new Expr) Expr
- func (b Builder) BinOp(op token.Token, x, y Expr) Expr
- func (b Builder) BindRecoverFrame()
- func (b Builder) BuiltinCall(fn string, args ...Expr) (ret Expr)
- func (b Builder) CBytes(v Expr) Expr
- func (b Builder) CMalloc(n Expr) Expr
- func (b Builder) CStr(v string) Expr
- func (b Builder) CString(v Expr) Expr
- func (b Builder) Call(fn Expr, args ...Expr) (ret Expr)
- func (b Builder) CallRecoverAlias(from Expr, mayRecover bool, fn Expr, ...) Expr
- func (b Builder) ChangeInterface(typ Type, x Expr) (ret Expr)
- func (b Builder) ChangeType(t Type, x Expr) (ret Expr)
- func (b Builder) Complex(r, i Expr) Expr
- func (b Builder) Const(v constant.Value, typ Type) Expr
- func (b Builder) Convert(t Type, x Expr) (ret Expr)
- func (b Builder) DIDeclare(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, ...)
- func (b Builder) DIGlobal(v Expr, name string, pos token.Position)
- func (b Builder) DIParam(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, ...)
- func (b Builder) DIScope(f Function, scope *types.Scope) DIScope
- func (b Builder) DISetCurrentDebugLocation(diScope DIScope, pos token.Position)
- func (b Builder) DIValue(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, ...)
- func (b Builder) DIVarAuto(scope DIScope, pos token.Position, varName string, vt Type) DIVar
- func (b Builder) DIVarParam(scope DIScope, pos token.Position, varName string, vt Type, argNo int) DIVar
- func (b Builder) DebugFunction(f Function, funcScope *types.Scope, pos token.Position, bodyPos token.Position)
- func (b Builder) Defer(kind DoAction, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, ...)
- func (b Builder) DeferData() Expr
- func (b Builder) DeferRecover(kind DoAction, mayRecover bool, fn Expr, ...)
- func (b Builder) DeferStack() Expr
- func (b Builder) DeferStackDrain()
- func (b Builder) DeferTo(owner Function, stack Expr, fn Expr, ...)
- func (b Builder) DeferToRecover(owner Function, stack Expr, mayRecover bool, fn Expr, ...)
- func (b Builder) Dispose()
- func (b Builder) Do(da DoAction, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, ...) (ret Expr)
- func (b Builder) EmitReflectTypeMethodCheckedLoad(ret Expr, check ReflectMethodCheck)
- func (b Builder) EmitReflectValueMethodCheckedLoad(ret Expr, check ReflectMethodCheck)
- func (b Builder) EndBuild()
- func (b Builder) EnterLocalContext() (ctx, previous Expr)
- func (b Builder) Extract(x Expr, i int) (ret Expr)
- func (b Builder) Field(x Expr, idx int) Expr
- func (b Builder) FieldAddr(x Expr, idx int) Expr
- func (b Builder) FitIntSize(n Expr) Expr
- func (b Builder) Go(fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr)
- func (b Builder) GoBytes(v Expr, n Expr) (ret Expr)
- func (b Builder) GoString(v Expr) Expr
- func (b Builder) GoStringN(v Expr, n Expr) Expr
- func (b Builder) If(cond Expr, thenb, elseb BasicBlock)
- func (b Builder) IfThen(cond Expr, then func())
- func (b Builder) Imethod(intf Expr, method *types.Func) Expr
- func (b Builder) ImethodWithRecoverToken(intf Expr, method *types.Func) Expr
- func (b Builder) Index(x, idx Expr, takeAddr func() (addr Expr, zero bool)) Expr
- func (b Builder) IndexAddr(x, idx Expr) Expr
- func (b Builder) IndirectJump(addr Expr, dests []BasicBlock)
- func (b Builder) InlineAsm(instruction string)
- func (b Builder) InlineAsmFull(instruction, constraints string, retType Type, exprs []Expr) Expr
- func (b Builder) InlineCall(fn Expr, args ...Expr) (ret Expr)
- func (b Builder) InterfaceData(x Expr) Expr
- func (b Builder) Jump(jmpb BasicBlock)
- func (b Builder) LeaveLocalContext(ctx, previous Expr)
- func (b Builder) Load(ptr Expr) Expr
- func (b Builder) Longjmp(jb, retval Expr)
- func (b Builder) Lookup(x, key Expr, commaOk bool) (ret Expr)
- func (b Builder) MakeChan(t Type, size Expr) (ret Expr)
- func (b Builder) MakeClosure(fn Expr, bindings []Expr) Expr
- func (b Builder) MakeInterface(tinter Type, x Expr) (ret Expr)
- func (b Builder) MakeInterfaceFromPtr(tinter Type, ptr Expr) (ret Expr)
- func (b Builder) MakeMap(t Type, nReserve Expr) (ret Expr)
- func (b Builder) MakeSlice(t Type, len, cap Expr) (ret Expr)
- func (b Builder) MakeString(cstr Expr, n ...Expr) (ret Expr)
- func (b Builder) MapUpdate(m, k, v Expr)
- func (b Builder) MarkReflectMethodByNameCall(call llvm.Value, kind string, nameArgIndex int)
- func (b Builder) MarkReflectTypeMethodByNameCall(call llvm.Value, nameArgIndex int)
- func (b Builder) MarkReflectTypeMethodByNameExpr(call Expr, nameArgIndex int)
- func (b Builder) MarkReflectValueMethodByNameCall(call llvm.Value, nameArgIndex int)
- func (b Builder) Next(typ Type, iter Expr, isString bool) Expr
- func (b Builder) NilDerefCheck(ptr Expr) Expr
- func (b Builder) Panic(v Expr)
- func (b Builder) Param(idx int) Expr
- func (b Builder) Phi(t Type) Phi
- func (b Builder) PrintEx(ln bool, args ...Expr) (ret Expr)
- func (b Builder) Printf(fmt string, args ...Expr) Expr
- func (b Builder) Println(args ...Expr) (ret Expr)
- func (b Builder) PtrCast(t Type, x Expr) Expr
- func (b Builder) PyBool(bVal Expr) (ret Expr)
- func (b Builder) PyByteArray(v Expr) Expr
- func (b Builder) PyBytes(v Expr) Expr
- func (b Builder) PyComplex64(v Expr) Expr
- func (b Builder) PyComplex128(v Expr) Expr
- func (b Builder) PyFloat(fltVal Expr) (ret Expr)
- func (b Builder) PyImportMod(path string) Expr
- func (b Builder) PyInt64(intVal Expr) (ret Expr)
- func (b Builder) PyList(args ...Expr) (ret Expr)
- func (b Builder) PyListSetItem(list, index, item Expr) (ret Expr)
- func (b Builder) PyLoadModSyms(modName string, objs ...PyObjRef) Expr
- func (b Builder) PyNewList(n Expr) (ret Expr)
- func (b Builder) PyNewTuple(n Expr) (ret Expr)
- func (b Builder) PyNewVar(modName, name string) PyGlobal
- func (b Builder) PyStr(v string) Expr
- func (b Builder) PyStrExpr(v Expr) Expr
- func (b Builder) PyTuple(args ...Expr) (ret Expr)
- func (b Builder) PyTupleSetItem(list, index, item Expr) (ret Expr)
- func (b Builder) PyUint64(uintVal Expr) (ret Expr)
- func (b Builder) PyVal(v Expr) (ret Expr)
- func (b Builder) Range(x Expr) Expr
- func (b Builder) Recover() Expr
- func (b Builder) Recv(ch Expr, commaOk bool) (ret Expr)
- func (b Builder) Return(results ...Expr)
- func (b Builder) RunDefers()
- func (b Builder) Select(states []*SelectState, blocking bool) (ret Expr)
- func (b Builder) SelectValue(cond Expr, a Expr, bExpr Expr) Expr
- func (b Builder) Send(ch Expr, x Expr) (ret Expr)
- func (b Builder) SetBlock(blk BasicBlock) Builder
- func (b Builder) SetBlockEx(blk BasicBlock, pos InsertPoint, setBlk bool)
- func (b Builder) Setjmp(jb Expr) Expr
- func (b Builder) Siglongjmp(jb, retval Expr)
- func (b Builder) Sigsetjmp(jb, savemask Expr) Expr
- func (b Builder) Slice(x, low, high, max Expr) (ret Expr)
- func (b Builder) SliceCap(x Expr) Expr
- func (b Builder) SliceData(x Expr) Expr
- func (b Builder) SliceLen(x Expr) Expr
- func (b Builder) SliceLit(t Type, elts ...Expr) Expr
- func (b Builder) SliceToArrayPointer(x Expr, typ Type) (ret Expr)
- func (b Builder) StackRestore(sp Expr)
- func (b Builder) StackSave() Expr
- func (b Builder) Store(ptr, val Expr) Expr
- func (b Builder) Str(v string) Expr
- func (b Builder) StringData(x Expr) Expr
- func (b Builder) StringLen(x Expr) Expr
- func (b Builder) Times(n Expr, loop func(i Expr))
- func (b Builder) TypeAssert(x Expr, assertedTyp Type, commaOk bool) Expr
- func (b Builder) UnOp(op token.Token, x Expr) (ret Expr)
- func (b Builder) Unreachable()
- func (b Builder) WrapNilCheck(ptr, recvType, methodName Expr) Expr
- type CompilationUnit
- type DIExpression
- type DIFile
- type DIFunction
- type DIGlobalVariableExpression
- type DILexicalBlock
- type DIScope
- type DIScopeMeta
- type DIType
- type DIVar
- type DoAction
- type Expr
- type Function
- func (p Function) Block(idx int) BasicBlock
- func (p Function) BuildLocalPackageAccessor(cache, size, align Expr)
- func (p Function) DisableTailCalls()
- func (p Function) Env() Expr
- func (p Function) EnvType() Type
- func (p Function) FreeVar(b Builder, i int) Expr
- func (p Function) HasBody() bool
- func (p Function) Inline(inline inlineAttr)
- func (p Function) MakeBlock() BasicBlock
- func (p Function) MakeBlocks(nblk int) []BasicBlock
- func (p Function) MakeBody(nblk int) Builder
- func (p Function) Name() string
- func (p Function) NeedsEnv() bool
- func (p Function) NewBuilder() Builder
- func (p Function) Param(i int) Expr
- func (p Function) SetRecover(blk BasicBlock)
- type Global
- type InitFlags
- type InsertPoint
- type LocalStorage
- type Locality
- type LocalityInfo
- type NamedConst
- type Package
- func (pkg Package) AddGlobalString(name string, value string)
- func (p Package) AfterInit(b Builder, ret BasicBlock)
- func (pkg Package) ConstBytes(value []byte) Expr
- func (pkg Package) ConstSlice(name string, t Type, values []Expr) Expr
- func (pkg Package) ConstString(value string) Expr
- func (p Package) EmitFuncInfo(symbol, name, file string, line, column int)
- func (p Package) EmitPCLineInfo(id uint64, symbol, file string, line, column int)
- func (p Package) ExportFuncs() map[string]string
- func (p Package) FinalizeDebug()
- func (p Package) FinishMetaCollection() error
- func (p Package) FuncOf(name string) Function
- func (p Package) InitAbiTypes(fname string) Function
- func (p Package) InitAbiTypesFor(fname string, filter func(sym *AbiSymbol) bool) Function
- func (p Package) InitDebug(name, pkgPath string, positioner Positioner)
- func (p Package) MarkReflectMethod(funcName string)
- func (p Package) MaterializePreserveSyms()
- func (p Package) Module() llvm.Module
- func (p Package) NewEnvFunc(name string, sig *types.Signature, bg Background, env *types.Var, ...) Function
- func (p Package) NewFunc(name string, sig *types.Signature, bg Background) Function
- func (p Package) NewFuncEx(name string, sig *types.Signature, bg Background, hasFreeVars bool, ...) Function
- func (p Package) NewThreadLocalVar(name string, typ types.Type, bg Background) Global
- func (p Package) NewVar(name string, typ types.Type, bg Background) Global
- func (p Package) NewVarEx(name string, t Type) Global
- func (p Package) Path() string
- func (p Package) PyNewFunc(name string, sig *types.Signature, doInit bool) PyObjRef
- func (p Package) PyNewModVar(name string, doInit bool) Global
- func (p Package) PyObjOf(name string) PyObjRef
- func (p Package) RecordReflectMethodByIndex(funcName string, index int)
- func (p Package) RecordReflectMethodByName(funcName, name string)
- func (p Package) RegisterAbiTypes(infos []AbiTypeInfo)
- func (p Package) RuntimeFunc(fnName string) Expr
- func (p Package) SetExport(name, export string)
- func (p Package) SetResolveLinkname(fn func(string) string)
- func (p Package) String() string
- func (pkg Package) Undefined(names ...string) error
- func (p Package) VarOf(name string) Global
- type Phi
- type Positioner
- type Program
- func (p Program) AbiType() Type
- func (p Program) AbiTypePtr() Type
- func (p Program) AbiTypes() []AbiTypeInfo
- func (p Program) ActivateLocalitiesFor(pkg *types.Package)
- func (p Program) AlignOf(typ Type) uint64
- func (p Program) Any() Type
- func (p Program) Bool() Type
- func (p Program) BoolVal(v bool) Expr
- func (p Program) Byte() Type
- func (p Program) CInt() Type
- func (p Program) CIntPtr() Type
- func (p Program) CStr() Type
- func (p Program) Closure(sig *types.Signature) Type
- func (p Program) Complex64() Type
- func (p Program) Complex128() Type
- func (p Program) ComplexVal(v complex128, t Type) Expr
- func (prog Program) ConstArray(t Type, values []Expr) Expr
- func (prog Program) ConstByteArray(t Type, value []byte) Expr
- func (prog Program) ConstStruct(t Type, values []Expr) Expr
- func (p Program) DataLayout() string
- func (p Program) DeadcodeDropEnabled() bool
- func (p Program) DeclareLocality(pkg *types.Package, name string, info LocalityInfo)
- func (p Program) Defer() Type
- func (p Program) DeferPtr() Type
- func (p Program) DisableBoundsChecks(disable bool)
- func (p Program) Dispose()
- func (p Program) Elem(typ Type) Type
- func (p Program) EnableDeadcodeDrop(enable bool)
- func (p Program) EnableFuncInfoMetadata(enable bool)
- func (p Program) EnableFuncInfoSites(enable bool)
- func (p Program) EnableGoGlobalDCE(enable bool)
- func (p Program) EnableLTOPluginMarkers(enable bool)
- func (p Program) Field(typ Type, i int) Type
- func (p Program) Float32() Type
- func (p Program) Float64() Type
- func (p Program) FloatVal(v float64, t Type) Expr
- func (p Program) FuncDecl(sig *types.Signature, bg Background) Type
- func (p Program) FuncInfoMetadataEnabled() bool
- func (p Program) FuncInfoSitesEnabled() bool
- func (p Program) HasClosureEnvDirective(fset *token.FileSet, name string, pos token.Pos) bool
- func (p Program) Index(typ Type) Type
- func (p Program) Int() Type
- func (p Program) Int32() Type
- func (p Program) Int64() Type
- func (p Program) IntVal(v uint64, t Type) Expr
- func (p Program) Linkname(name string) (link string, ok bool)
- func (p Program) MarkPackageSyntaxParsed(pkg *types.Package)
- func (p Program) NeedsFramePointer() bool
- func (p Program) NeedsLocalContext() bool
- func (p Program) NewBackendProgram() Program
- func (p Program) NewPackage(name, pkgPath string) Package
- func (p Program) NewPackageEx(name, pkgPath string, metaCollect bool) Package
- func (p Program) Nil(t Type) Expr
- func (p Program) OffsetOf(typ Type, i int) uint64
- func (p Program) PackageExport(name string) (string, bool)
- func (p Program) PackageLocalities(pkgPath string) map[string]VariableLocality
- func (p Program) PackageLocalitiesFor(pkg *types.Package) map[string]VariableLocality
- func (p Program) PackageSyntaxParsed(pkg *types.Package) bool
- func (p Program) Pointer(typ Type) Type
- func (p Program) PointerSize() int
- func (p Program) PyObjectPtr() Type
- func (p Program) PyObjectPtrPtr() Type
- func (p Program) ResolveLocality(name string) (string, VariableLocality, bool, error)
- func (p Program) ResolveLocalityFor(pkg *types.Package, name string) (string, VariableLocality, bool, error)
- func (p Program) SetClosureEnvDirective(fset *token.FileSet, name string, pos token.Pos)
- func (p Program) SetCompileMethods(check func(Package, types.Type))
- func (p Program) SetDebugInfoOptimized(enable bool)
- func (p Program) SetLinkname(name, link string)
- func (p Program) SetLocalStorage(name string, storage LocalStorage)
- func (p Program) SetLocalStorageFor(pkg *types.Package, name string, storage LocalStorage)
- func (p Program) SetLocalityInfo(name string, info LocalityInfo)
- func (p Program) SetLocalityInfoFor(pkg *types.Package, name string, info LocalityInfo)
- func (p Program) SetNoInterfaceMethod(fullName string)
- func (p Program) SetPackageExport(name, export string)
- func (p Program) SetPatch(patchType func(types.Type) types.Type)
- func (p Program) SetPthreadStackSize(size uint64)
- func (p Program) SetPython(py any)
- func (p Program) SetRuntime(runtime any)
- func (p Program) SetTypeBackground(fullName string, bg Background)
- func (p Program) SizeOf(typ Type, n ...int64) uint64
- func (p Program) Slice(typ Type) Type
- func (p Program) String() Type
- func (p Program) Struct(typs ...Type) Type
- func (p Program) Target() *Target
- func (p Program) TargetData() llvm.TargetData
- func (p Program) TargetMachine() llvm.TargetMachine
- func (p Program) Type(typ types.Type, bg Background) Type
- func (p Program) TypeSizes(sizes types.Sizes) types.Sizes
- func (p Program) Uint() Type
- func (p Program) Uint16() Type
- func (p Program) Uint32() Type
- func (p Program) Uint64() Type
- func (p Program) Uintptr() Type
- func (p Program) Val(v interface{}) Expr
- func (p Program) ValidateLocalities(pkgPath string) error
- func (p Program) ValidateLocalitiesFor(pkg *types.Package) error
- func (p Program) VariableLocality(name string) (VariableLocality, bool)
- func (p Program) VariableLocalityFor(pkg *types.Package, name string) (VariableLocality, bool)
- func (p Program) Void() Type
- func (p Program) VoidPtr() Type
- func (p Program) VoidPtrPtr() Type
- func (p Program) Zero(t Type) Expr
- type PyGlobal
- type PyObjRef
- type ReflectMethodCheck
- type SelectState
- type Target
- type TargetSpec
- type Type
- type VariableLocality
Constants ¶
const ( NoInline inlineAttr = iota AlwaysInline InlineHint )
const ( OrderingNotAtomic = llvm.AtomicOrderingNotAtomic OrderingUnordered = llvm.AtomicOrderingUnordered OrderingMonotonic = llvm.AtomicOrderingMonotonic OrderingAcquire = llvm.AtomicOrderingAcquire OrderingRelease = llvm.AtomicOrderingRelease OrderingAcquireRelease = llvm.AtomicOrderingAcquireRelease OrderingSeqConsistent = llvm.AtomicOrderingSequentiallyConsistent )
const ( ReflectArrayOf = 1 << iota ReflectChanOf ReflectFuncOf ReflectMapOf ReflectPointerTo ReflectSliceOf ReflectStructOf ReflectMethodByIndex ReflectMethodByName ReflectMethodDynamic ReflectTypeMethodByIndex ReflectTypeMethodByName ReflectTypeMethodDynamic ReflectMethodMask = ReflectMethodByIndex | ReflectMethodByName | ReflectMethodDynamic | reflectTypeMethodMask )
const ( FuncInfoMetadataName = "llgo.funcinfo" PCLineMetadataName = "llgo.pcline" )
const ( LocalityNone = locality.None ThreadLocal = locality.Thread GoroutineLocal = locality.Goroutine )
const ( LocalStorageUnknown = localitylayout.StorageUnknown LocalStorageNativeTLS = localitylayout.StorageNativeTLS LocalStoragePackage = localitylayout.StoragePackage )
const ( OpXchg = llvm.AtomicRMWBinOpXchg OpAdd = llvm.AtomicRMWBinOpAdd OpSub = llvm.AtomicRMWBinOpSub OpAnd = llvm.AtomicRMWBinOpAnd OpNand = llvm.AtomicRMWBinOpNand OpOr = llvm.AtomicRMWBinOpOr OpXor = llvm.AtomicRMWBinOpXor OpMax = llvm.AtomicRMWBinOpMax OpMin = llvm.AtomicRMWBinOpMin OpUMax = llvm.AtomicRMWBinOpUMax OpUMin = llvm.AtomicRMWBinOpUMin )
const ( PkgPython = "github.com/goplus/lib/py" PkgRuntime = env.LLGoRuntimePkg + "/internal/runtime" )
const ( DbgFlagInstruction dbgFlags = 1 << iota DbgFlagAll = DbgFlagInstruction )
const (
LLVMModuleFlagBehaviorError = 1
)
const (
MD_dbg = 0
)
const (
NameValist = "__llgo_va_list"
)
Variables ¶
var (
NoArgsNoRet = types.NewSignatureType(nil, nil, nil, nil, nil, false)
)
Functions ¶
func FuncAddCtx ¶
FuncAddCtx adds a ctx to a function signature.
func HasNameValist ¶
func MethodSymbolName ¶
MethodSymbolName qualifies an unexported method name when its declaring package differs from the receiver package. Promoted methods need this extra identity component to avoid colliding with same-named receiver methods. Package identity intentionally uses PathOf rather than Package.Path: patched runtime packages and their original counterparts must name the same symbol.
func StripModuleTarget ¶
Types ¶
type AbiTypeInfo ¶
AbiTypeInfo is the LLVM-free identity needed to declare one runtime type descriptor in another Program.
type AtomicOrdering ¶
type AtomicOrdering = llvm.AtomicOrdering
type BasicBlock ¶
type BasicBlock = *aBasicBlock
BasicBlock represents a basic block in a function.
func (BasicBlock) Addr ¶
func (p BasicBlock) Addr() Expr
Addr returns the address of the basic block.
func (BasicBlock) Index ¶
func (p BasicBlock) Index() int
Index returns the index of the basic block in the parent function.
func (BasicBlock) Parent ¶
func (p BasicBlock) Parent() Function
Parent returns the function to which the basic block belongs.
type Builder ¶
type Builder = *aBuilder
Builder represents a builder for creating instructions in a function.
func (Builder) Alloc ¶
The Alloc instruction reserves space for a variable of the given type, zero-initializes it, and yields its address.
If heap is false, Alloc zero-initializes the same local variable in the call frame and returns its address; in this case the Alloc must be present in Function.Locals. We call this a "local" alloc.
If heap is true, Alloc allocates a new zero-initialized variable each time the instruction is executed. We call this a "new" alloc.
When Alloc is applied to a channel, map or slice type, it returns the address of an uninitialized (nil) reference of that kind; store the result of MakeSlice, MakeMap or MakeChan in that location to instantiate these types.
Example printed form:
t0 = local int t1 = new int
func (Builder) AllocaCStr ¶
AllocaCStr allocates space for copy it from a Go string.
func (Builder) AllocaCStrs ¶
func allocaCStrs(strs []string, endWithNil bool) **int8
func (Builder) AllocaSigjmpBuf ¶
func (Builder) ArrayAlloca ¶
ArrayAlloca reserves space for an array of n elements of type telem.
func (Builder) AssertNilDeref ¶
func (Builder) Atomic ¶
Atomic performs an atomic operation on the memory location pointed to by ptr.
func (Builder) AtomicCmpXchg ¶
AtomicCmpXchg performs an atomic compare-and-swap operation on the memory location pointed to by ptr.
func (Builder) BinOp ¶
The BinOp instruction yields the result of binary operation (x op y). op can be: ADD SUB MUL QUO REM + - * / % AND OR XOR SHL SHR AND_NOT & | ^ << >> &^ EQL NEQ LSS LEQ GTR GEQ == != < <= > >=
func (Builder) BindRecoverFrame ¶
func (b Builder) BindRecoverFrame()
BindRecoverFrame gives this invocation a stack-local identity. The runtime replaces a pending deferred-function token with this activation token only when this invocation is the direct deferred call. Recursive calls to the same function therefore cannot recover the caller's panic.
func (Builder) BuiltinCall ¶
A Builtin represents a specific use of a built-in function, e.g. len.
Builtins are immutable values. Builtins do not have addresses.
`fn` indicates the function: one of the built-in functions from the Go spec (excluding "make" and "new").
func (Builder) Call ¶
The Call instruction represents a function call.
The Call instruction yields the function result if there is exactly one. Otherwise it returns a tuple, the components of which are accessed via Extract.
Example printed form:
t2 = println(t0, t1) t4 = t3()
func (Builder) CallRecoverAlias ¶
func (b Builder) CallRecoverAlias(from Expr, mayRecover bool, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr) Expr
CallRecoverAlias invokes fn through a compiler-generated wrapper while preserving the wrapped function as the direct deferred call for recover.
func (Builder) ChangeInterface ¶
ChangeInterface constructs a value of one interface type from a value of another interface type known to be assignable to it. This operation cannot fail.
Pos() returns the ast.CallExpr.Lparen if the instruction arose from an explicit T(e) conversion; the ast.TypeAssertExpr.Lparen if the instruction arose from an explicit e.(T) operation; or token.NoPos otherwise.
Example printed form:
t1 = change interface interface{} <- I (t0)
func (Builder) ChangeType ¶
The ChangeType instruction applies to X a value-preserving type change to Type().
Type changes are permitted:
- between a named type and its underlying type.
- between two named types of the same underlying type.
- between (possibly named) pointers to identical base types.
- from a bidirectional channel to a read- or write-channel, optionally adding/removing a name.
- between a type (t) and an instance of the type (tσ), i.e. Type() == σ(X.Type()) (or X.Type()== σ(Type())) where σ is the type substitution of Parent().TypeParams by Parent().TypeArgs.
This operation cannot fail dynamically.
Type changes may to be to or from a type parameter (or both). All types in the type set of X.Type() have a value-preserving type change to all types in the type set of Type().
Example printed form:
t1 = changetype *int <- IntPtr (t0)
func (Builder) Convert ¶
The Convert instruction yields the conversion of value X to type Type(). One or both of those types is basic (but possibly named).
A conversion may change the value and representation of its operand. Conversions are permitted:
- between real numeric types.
- between complex numeric types.
- between string and []byte or []rune.
- between pointers and unsafe.Pointer.
- between unsafe.Pointer and uintptr.
- from (Unicode) integer to (UTF-8) string.
A conversion may imply a type name change also.
Conversions may to be to or from a type parameter. All types in the type set of X.Type() can be converted to all types in the type set of Type().
This operation cannot fail dynamically.
Conversions of untyped string/number/bool constants to a specific representation are eliminated during SSA construction.
Example printed form:
t1 = convert []byte <- string (t0)
func (Builder) DISetCurrentDebugLocation ¶
func (Builder) DIVarParam ¶
func (Builder) DebugFunction ¶
func (Builder) Defer ¶
func (b Builder) Defer(kind DoAction, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr)
Defer emits a defer instruction.
func (Builder) DeferRecover ¶
func (b Builder) DeferRecover(kind DoAction, mayRecover bool, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr)
DeferRecover emits a defer instruction with explicit recover capability.
func (Builder) DeferStack ¶
DeferStack returns a stable handle to the current function's explicit loop-defer list.
func (Builder) DeferStackDrain ¶
func (b Builder) DeferStackDrain()
DeferStackDrain registers a drain point for defers pushed through an explicit stack, such as range-over-func yield bodies.
func (Builder) DeferTo ¶
func (b Builder) DeferTo(owner Function, stack Expr, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr)
DeferTo emits a defer instruction into an explicit runtime defer stack.
func (Builder) DeferToRecover ¶
func (b Builder) DeferToRecover(owner Function, stack Expr, mayRecover bool, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr)
DeferToRecover emits a defer instruction into an explicit runtime defer stack with explicit recover capability.
func (Builder) Do ¶
func (b Builder) Do(da DoAction, fn Expr, buildCall func(Builder, Expr, ...Expr) Expr, args ...Expr) (ret Expr)
Do call a function with an action.
func (Builder) EmitReflectTypeMethodCheckedLoad ¶
func (b Builder) EmitReflectTypeMethodCheckedLoad(ret Expr, check ReflectMethodCheck)
func (Builder) EmitReflectValueMethodCheckedLoad ¶
func (b Builder) EmitReflectValueMethodCheckedLoad(ret Expr, check ReflectMethodCheck)
func (Builder) EndBuild ¶
func (b Builder) EndBuild()
EndBuild ends the build process of a function.
func (Builder) EnterLocalContext ¶
EnterLocalContext creates the stack root used by TLS/GLS locality blocks and installs it for the current outermost Go entry. previous is nonzero only for a nested entry that inherited an existing context.
func (Builder) Extract ¶
The Extract instruction yields component Index of Tuple.
This is used to access the results of instructions with multiple return values, such as Call, TypeAssert, Next, UnOp(ARROW) and IndexExpr(Map).
Example printed form:
t1 = extract t0 #1
func (Builder) FieldAddr ¶
The FieldAddr instruction yields the address of Field of *struct X.
The field is identified by its index within the field list of the struct type of X.
Dynamically, this instruction panics if X evaluates to a nil pointer.
Type() returns a (possibly named) *types.Pointer.
Example printed form:
t1 = &t0.name [#1]
func (Builder) Go ¶
The Go instruction creates a new goroutine and calls the specified function within it.
Example printed form:
go println(t0, t1) go t3() go invoke t5.Println(...t6)
func (Builder) If ¶
func (b Builder) If(cond Expr, thenb, elseb BasicBlock)
If emits an if instruction.
func (Builder) ImethodWithRecoverToken ¶
ImethodWithRecoverToken returns an interface method invocation whose code pointer may also be used as recover-frame bookkeeping data.
func (Builder) Index ¶
The Index instruction yields element Index of collection X, an array, string or type parameter containing an array, a string, a pointer to an, array or a slice.
Example printed form:
t2 = t0[t1]
func (Builder) IndexAddr ¶
The IndexAddr instruction yields the address of the element at index `idx` of collection `x`. `idx` is an integer expression.
The elements of maps and strings are not addressable; use Lookup (map), Index (string), or MapUpdate instead.
Dynamically, this instruction panics if `x` evaluates to a nil *array pointer.
Example printed form:
t2 = &t0[t1]
func (Builder) IndirectJump ¶
func (b Builder) IndirectJump(addr Expr, dests []BasicBlock)
IndirectJump emits an indirect jump instruction.
func (Builder) InlineAsmFull ¶
func (Builder) InlineCall ¶
TODO(xsw): make inline call
func (Builder) InterfaceData ¶
InterfaceData returns the data pointer of an interface.
func (Builder) LeaveLocalContext ¶
LeaveLocalContext restores an inherited context or drops the stack roots installed by EnterLocalContext.
func (Builder) Lookup ¶
The Lookup instruction yields element Index of collection map X. Index is the appropriate key type.
If CommaOk, the result is a 2-tuple of the value above and a boolean indicating the result of a map membership test for the key. The components of the tuple are accessed using Extract.
Example printed form:
t2 = t0[t1] t5 = t3[t4],ok
func (Builder) MakeChan ¶
The MakeChan instruction creates a new channel object and yields a value of kind chan.
Type() returns a (possibly named) *types.Chan.
Pos() returns the ast.CallExpr.Lparen for the make(chan) that created it.
Example printed form:
t0 = make chan int 0
t0 = make IntChan 0
type MakeChan struct {
register
Size Value // int; size of buffer; zero => synchronous.
}
func (Builder) MakeClosure ¶
The MakeClosure instruction yields a closure value whose code is Fn and whose free variables' values are supplied by Bindings.
Type() returns a (possibly named) *types.Signature.
Example printed form:
t0 = make closure anon@1.2 [x y z] t1 = make closure bound$(main.I).add [i]
func (Builder) MakeInterface ¶
MakeInterface constructs an instance of an interface type from a value of a concrete type.
Use Program.MethodSets.MethodSet(X.Type()) to find the method-set of X, and Program.MethodValue(m) to find the implementation of a method.
To construct the zero value of an interface type T, use:
NewConst(constant.MakeNil(), T, pos)
Example printed form:
t1 = make interface{} <- int (42:int)
t2 = make Stringer <- t0
func (Builder) MakeInterfaceFromPtr ¶
func (Builder) MakeMap ¶
The MakeMap instruction creates a new hash-table-based map object and yields a value of kind map.
t is a (possibly named) *types.Map.
Example printed form:
t1 = make map[string]int t0 t1 = make StringIntMap t0
func (Builder) MakeSlice ¶
The MakeSlice instruction yields a slice of length Len backed by a newly allocated array of length Cap.
Both Len and Cap must be non-nil Values of integer type.
(Alloc(types.Array) followed by Slice will not suffice because Alloc can only create arrays of constant length.)
Type() returns a (possibly named) *types.Slice.
Example printed form:
t1 = make []string 1:int t0 t1 = make StringSlice 1:int t0
func (Builder) MakeString ¶
MakeString creates a new string from a C string pointer and length.
func (Builder) MapUpdate ¶
The MapUpdate instruction updates the association of Map[Key] to Value.
Pos() returns the ast.KeyValueExpr.Colon or ast.IndexExpr.Lbrack, if explicit in the source.
Example printed form:
t0[t1] = t2
func (Builder) MarkReflectMethodByNameCall ¶
func (Builder) MarkReflectTypeMethodByNameCall ¶
func (Builder) MarkReflectTypeMethodByNameExpr ¶
func (Builder) MarkReflectValueMethodByNameCall ¶
func (Builder) Next ¶
The Next instruction reads and advances the (map or string) iterator Iter and returns a 3-tuple value (ok, k, v). If the iterator is not exhausted, ok is true and k and v are the next elements of the domain and range, respectively. Otherwise ok is false and k and v are undefined.
Components of the tuple are accessed using Extract.
The IsString field distinguishes iterators over strings from those over maps, as the Type() alone is insufficient: consider map[int]rune.
Type() returns a *types.Tuple for the triple (ok, k, v). The types of k and/or v may be types.Invalid.
Example printed form:
t1 = next t0
func (Builder) NilDerefCheck ¶
func (Builder) PyByteArray ¶
PyByteArray(val []byte) *Object
func (Builder) PyComplex64 ¶
PyComplex64(val complex64) *Object
func (Builder) PyComplex128 ¶
PyComplex128(val complex128) *Object
func (Builder) PyImportMod ¶
PyImportMod imports a Python module.
func (Builder) PyListSetItem ¶
PyListSetItem(list *Object, index uintptr, item *Object) c.Int
func (Builder) PyLoadModSyms ¶
PyLoadModSyms loads python objects from specified module.
func (Builder) PyNewTuple ¶
PyNewTuple(n int) *Object
func (Builder) PyTupleSetItem ¶
PyTupleSetItem(list *Object, index uintptr, item *Object) c.Int
func (Builder) Range ¶
The Range instruction yields an iterator over the domain and range of X, which must be a string or map.
Elements are accessed via Next.
Type() returns an opaque and degenerate "rangeIter" type.
Pos() returns the ast.RangeStmt.For.
Example printed form:
t0 = range "hello":string
func (Builder) RunDefers ¶
func (b Builder) RunDefers()
RunDefers emits instructions to run deferred instructions.
func (Builder) Select ¶
func (b Builder) Select(states []*SelectState, blocking bool) (ret Expr)
The Select instruction tests whether (or blocks until) one of the specified sent or received states is entered.
Let n be the number of States for which Dir==RECV and T_i (0<=i<n) be the element type of each such state's Chan. Select returns an n+2-tuple
(index int, recvOk bool, r_0 T_0, ... r_n-1 T_n-1)
The tuple's components, described below, must be accessed via the Extract instruction.
If Blocking, select waits until exactly one state holds, i.e. a channel becomes ready for the designated operation of sending or receiving; select chooses one among the ready states pseudorandomly, performs the send or receive operation, and sets 'index' to the index of the chosen channel.
If !Blocking, select doesn't block if no states hold; instead it returns immediately with index equal to -1.
If the chosen channel was used for a receive, the r_i component is set to the received value, where i is the index of that state among all n receive states; otherwise r_i has the zero value of type T_i. Note that the receive index i is not the same as the state index index.
The second component of the triple, recvOk, is a boolean whose value is true iff the selected operation was a receive and the receive successfully yielded a value.
Pos() returns the ast.SelectStmt.Select.
Example printed form:
t3 = select nonblocking [<-t0, t1<-t2] t4 = select blocking []
func (Builder) SelectValue ¶
SelectValue chooses between two values based on the condition.
func (Builder) Send ¶
The Send instruction sends X on channel Chan.
Pos() returns the ast.SendStmt.Arrow, if explicit in the source.
Example printed form:
send t0 <- t1
func (Builder) SetBlock ¶
func (b Builder) SetBlock(blk BasicBlock) Builder
SetBlock means SetBlockEx(blk, AtEnd, true).
func (Builder) SetBlockEx ¶
func (b Builder) SetBlockEx(blk BasicBlock, pos InsertPoint, setBlk bool)
SetBlockEx sets blk as current basic block and pos as its insert point.
func (Builder) Siglongjmp ¶
func (Builder) Slice ¶
The Slice instruction yields a slice of an existing string, slice or *array X between optional integer bounds Low and High.
Dynamically, this instruction panics if X evaluates to a nil *array pointer.
Type() returns string if the type of X was string, otherwise a *types.Slice with the same element type as X.
Example printed form:
t1 = slice t0[1:]
func (Builder) SliceToArrayPointer ¶
The SliceToArrayPointer instruction yields the conversion of slice X to array pointer.
Pos() returns the ast.CallExpr.Lparen, if the instruction arose from an explicit conversion in the source.
Conversion may to be to or from a type parameter. All types in the type set of X.Type() must be a slice types that can be converted to all types in the type set of Type() which must all be pointer to array types.
This operation can fail dynamically if the length of the slice is less than the length of the array.
Example printed form:
t1 = slice to array pointer *[4]byte <- []byte (t0)
func (Builder) StackRestore ¶
declare void @llvm.stackrestore.p0(ptr)
func (Builder) StringData ¶
StringData returns the data pointer of a string.
func (Builder) TypeAssert ¶
The TypeAssert instruction tests whether interface value X has type AssertedType.
If !CommaOk, on success it returns v, the result of the conversion (defined below); on failure it panics.
If CommaOk: on success it returns a pair (v, true) where v is the result of the conversion; on failure it returns (z, false) where z is AssertedType's zero value. The components of the pair must be accessed using the Extract instruction.
If Underlying: tests whether interface value X has the underlying type AssertedType.
If AssertedType is a concrete type, TypeAssert checks whether the dynamic type in interface X is equal to it, and if so, the result of the conversion is a copy of the value in the interface.
If AssertedType is an interface, TypeAssert checks whether the dynamic type of the interface is assignable to it, and if so, the result of the conversion is a copy of the interface value X. If AssertedType is a superinterface of X.Type(), the operation will fail iff the operand is nil. (Contrast with ChangeInterface, which performs no nil-check.)
Type() reflects the actual type of the result, possibly a 2-types.Tuple; AssertedType is the asserted type.
Depending on the TypeAssert's purpose, Pos may return:
- the ast.CallExpr.Lparen of an explicit T(e) conversion;
- the ast.TypeAssertExpr.Lparen of an explicit e.(T) operation;
- the ast.CaseClause.Case of a case of a type-switch statement;
- the Ident(m).NamePos of an interface method value i.m (for which TypeAssert may be used to effect the nil check).
Example printed form:
t1 = typeassert t0.(int) t3 = typeassert,ok t2.(T)
func (Builder) UnOp ¶
The UnOp instruction yields the result of (op x). ARROW is channel receive. MUL is pointer indirection (load). XOR is bitwise complement. SUB is negation. NOT is logical negation.
func (Builder) Unreachable ¶
func (b Builder) Unreachable()
Unreachable emits an unreachable instruction.
func (Builder) WrapNilCheck ¶
type CompilationUnit ¶
type CompilationUnit = *aCompilationUnit
type DIExpression ¶
type DIExpression = *aDIExpression
type DIFunction ¶
type DIFunction = *aDIFunction
type DIGlobalVariableExpression ¶
type DIGlobalVariableExpression = *aDIGlobalVariableExpression
type DILexicalBlock ¶
type DILexicalBlock = *aDILexicalBlock
type DIScopeMeta ¶
type DIScopeMeta = *aDIScopeMeta
type Expr ¶
type Expr struct {
Type
// contains filtered or unexported fields
}
var Nil Expr // Zero value is a nil Expr
func (Expr) SetOrdering ¶
func (v Expr) SetOrdering(ordering AtomicOrdering) Expr
SetOrdering sets the ordering of the atomic operation.
func (Expr) SetVolatile ¶
SetVolatile marks a load or store as volatile.
type Function ¶
type Function = *aFunction
Function represents a function or method.
func (Function) Block ¶
func (p Function) Block(idx int) BasicBlock
Block returns the ith basic block of the function.
func (Function) BuildLocalPackageAccessor ¶
BuildLocalPackageAccessor builds an always-hot package block lookup around a generated owner-local cache slot. The runtime owns allocation and rooting; the compiler needs no LocalContext or block-header layout knowledge.
func (Function) DisableTailCalls ¶
func (p Function) DisableTailCalls()
func (Function) MakeBlock ¶
func (p Function) MakeBlock() BasicBlock
MakeBlock creates a new basic block for the function.
func (Function) MakeBlocks ¶
func (p Function) MakeBlocks(nblk int) []BasicBlock
MakeBlocks creates nblk basic blocks for the function.
func (Function) MakeBody ¶
MakeBody creates nblk basic blocks for the function, and creates a new Builder associated to #0 block.
func (Function) NeedsEnv ¶
NeedsEnv reports whether the physical function entry takes a compiler-owned closure environment parameter.
func (Function) NewBuilder ¶
NewBuilder creates a new Builder for the function.
func (Function) SetRecover ¶
func (p Function) SetRecover(blk BasicBlock)
SetRecover sets the recover block for the function.
type Global ¶
type Global = *aGlobal
A Global is a named Value holding the address of a package-level variable.
func (Global) ReplaceAllUsesWith ¶
type InitFlags ¶
type InitFlags int
InitFlags is a set of flags for initializing the LLVM library.
const ( InitNativeTarget InitFlags = 1 << iota InitAllTargets InitAllTargetInfos InitAllTargetMCs InitNativeAsmPrinter InitAllAsmPrinters InitAllAsmParsers InitNative = InitNativeTarget | InitNativeAsmPrinter InitAll = InitAllTargets | InitAllAsmParsers | InitAllAsmPrinters | InitAllTargetInfos | InitAllTargetMCs )
type LocalStorage ¶
type LocalStorage = localitylayout.Storage
type LocalityInfo ¶
type NamedConst ¶
type NamedConst = *aNamedConst
A NamedConst is a Member of a Package representing a package-level named constant.
Pos() returns the position of the declaring ast.ValueSpec.Names[*] identifier.
NB: a NamedConst is not a Value; it contains a constant Value, which it augments with the name and position of its 'const' declaration.
type Package ¶
type Package = *aPackage
func (Package) AddGlobalString ¶
func (Package) AfterInit ¶
func (p Package) AfterInit(b Builder, ret BasicBlock)
AfterInit is called after the package is initialized (init all packages that depends on).
func (Package) ConstBytes ¶
ConstBytes creates an SSA expression for a []byte backed by writable static data. Each call gets its own backing store, matching []byte mutability semantics.
func (Package) ConstSlice ¶
ConstSlice creates a slice constant backed by a writable package global. The backing store must remain writable because a Go slice literal may be mutated after package initialization.
func (Package) ConstString ¶
ConstString creates an SSA expression representing a Go string literal. The returned value is backed by an anonymous global constant and can be used to initialize package-level variables or other constant contexts that expect a Go string value.
func (Package) EmitFuncInfo ¶
EmitFuncInfo records a function's linker symbol, Go name, and declaration source position as LLVM named metadata. The row layout is:
!{i32 version, !"symbol", !"go.name", !"file", i32 line, i32 column}
func (Package) EmitPCLineInfo ¶
EmitPCLineInfo records a PC label id and its source position. The id names a zero-byte label emitted in the function body; keeping the metadata string-only lets dead functions be removed without the line table holding address references to them.
func (Package) ExportFuncs ¶
func (Package) FinalizeDebug ¶
func (p Package) FinalizeDebug()
FinalizeDebug resolves temporary debug metadata and releases the package's DI builder. No debug records may be added after this call.
func (Package) FinishMetaCollection ¶
func (Package) InitAbiTypes ¶
func (Package) InitAbiTypesFor ¶
func (Package) InitDebug ¶
func (p Package) InitDebug(name, pkgPath string, positioner Positioner)
func (Package) MarkReflectMethod ¶
func (Package) MaterializePreserveSyms ¶
func (p Package) MaterializePreserveSyms()
func (Package) NewEnvFunc ¶
func (p Package) NewEnvFunc( name string, sig *types.Signature, bg Background, env *types.Var, instantiated bool, ) Function
NewEnvFunc creates a function whose Go signature is sig and whose physical LLVM entry has an additional compiler-owned environment parameter.
func (Package) NewFuncEx ¶
func (p Package) NewFuncEx(name string, sig *types.Signature, bg Background, hasFreeVars bool, instantiated bool) Function
NewFuncEx creates a new function.
func (Package) NewThreadLocalVar ¶
NewThreadLocalVar creates a native TLS variable. Unlike NewVar, it keeps independent storage for zero-sized values instead of using the module-wide zero-sized allocation sentinel.
func (Package) PyNewModVar ¶
PyNewModVar creates a new global variable for a Python module.
func (Package) RecordReflectMethodByIndex ¶
func (Package) RecordReflectMethodByName ¶
func (Package) RegisterAbiTypes ¶
func (p Package) RegisterAbiTypes(infos []AbiTypeInfo)
RegisterAbiTypes declares runtime type descriptors owned by other Programs. It records only Go type identity and target-local LLVM types; descriptor definitions remain in the package modules that materialized them.
func (Package) RuntimeFunc ¶
RuntimeFunc returns a declaration for a function in LLGo's internal runtime.
func (Package) SetResolveLinkname ¶
SetResolveLinkname sets a function to resolve linkname.
type Phi ¶
type Phi struct {
Expr
}
Phi represents a phi node.
func (Phi) AddIncoming ¶
func (p Phi) AddIncoming(b Builder, preds []BasicBlock, f func(i int, blk BasicBlock) Expr)
AddIncoming adds incoming values to a phi node.
type Program ¶
type Program = *aProgram
A Program presents a program.
func (Program) AbiTypes ¶
func (p Program) AbiTypes() []AbiTypeInfo
AbiTypes snapshots the runtime type descriptors materialized by this Program without retaining any LLVM-owned values.
func (Program) ActivateLocalitiesFor ¶
ActivateLocalitiesFor marks pkg's concrete import path as part of the effective build graph. Alternate packages are scanned and prepared before link reachability is known; their declarations must not require a LocalContext merely because metadata exists.
func (Program) ComplexVal ¶
func (p Program) ComplexVal(v complex128, t Type) Expr
ComplexVal returns a complex constant expression.
func (Program) ConstArray ¶
ConstArray creates an LLVM constant array expression.
func (Program) ConstByteArray ¶
ConstByteArray creates a compact LLVM constant for a Go byte array. Unlike ConstArray, it does not allocate one LLVM value wrapper per array element.
func (Program) ConstStruct ¶
ConstStruct creates an LLVM constant struct expression.
func (Program) DataLayout ¶
func (Program) DeadcodeDropEnabled ¶
func (Program) DeclareLocality ¶
func (p Program) DeclareLocality(pkg *types.Package, name string, info LocalityInfo)
DeclareLocality records locality metadata found on a declaration in pkg. Alternate packages can share canonical symbol names with the packages they replace, so both ownership and metadata retain the raw import path. Repeated loads of the same raw path preserve metadata enriched during preparation.
func (Program) DisableBoundsChecks ¶
DisableBoundsChecks controls index, slice, and slice-to-array conversion bounds checks. Other dynamic validity checks, including nil pointer and unsafe builtin checks, are not affected.
func (Program) Dispose ¶
func (p Program) Dispose()
Dispose releases the LLVM resources owned by the program: the context (and with it every module built in it), the target machine and the target data. The Program and everything created from it must not be used afterwards. In-process drivers that compile many packages sequentially (llgen goldens, the cltest run harness) call this between compiles; without it each compile's C++-side memory lives until the process exits.
func (Program) EnableDeadcodeDrop ¶
func (Program) EnableFuncInfoMetadata ¶
EnableFuncInfoMetadata controls emission of DCE-safe function source metadata. The metadata intentionally stores symbol names as strings instead of function pointer operands, so it can be consumed before materializing a final runtime line/func table without keeping otherwise-dead functions alive.
func (Program) EnableFuncInfoSites ¶
EnableFuncInfoSites controls emission of the per-function site records (entry and PC-line inline-asm fragments inside function bodies). They are gated separately from the funcinfo metadata tables because the body-embedded anchors shift instruction/scope layout enough to confuse debuggers; debug builds keep the tables (FuncForPC name/FileLine fidelity via the dlsym path) but drop the sites.
func (Program) EnableGoGlobalDCE ¶
func (Program) EnableLTOPluginMarkers ¶
func (Program) FuncDecl ¶
func (p Program) FuncDecl(sig *types.Signature, bg Background) Type
FuncDecl converts a Go/C function declaration into raw type.
func (Program) FuncInfoMetadataEnabled ¶
func (Program) FuncInfoSitesEnabled ¶
func (Program) HasClosureEnvDirective ¶
HasClosureEnvDirective reports whether a source function declaration has the cached llgo:env directive.
func (Program) MarkPackageSyntaxParsed ¶
func (Program) NeedsFramePointer ¶
NeedsFramePointer reports whether functions should keep the frame-pointer chain: only on OS targets where the runtime's FP unwinder runs.
func (Program) NeedsLocalContext ¶
func (Program) NewBackendProgram ¶
NewBackendProgram creates a Program with fresh LLVM-owned state and the same build configuration as p. Go-side package syntax and locality metadata are shared directly; callers must finish preparing them before backend Programs are created and use them read-only afterwards.
func (Program) NewPackage ¶
NewPackage creates a new package.
func (Program) NewPackageEx ¶
func (Program) PackageExport ¶
PackageExport returns the preloaded export name for name.
func (Program) PackageLocalities ¶
func (p Program) PackageLocalities(pkgPath string) map[string]VariableLocality
PackageLocalities returns the legacy canonical-only metadata view. Its result is unspecified when a canonical path has multiple declaration owners; use PackageLocalitiesFor in owner-aware code.
func (Program) PackageLocalitiesFor ¶
func (p Program) PackageLocalitiesFor(pkg *types.Package) map[string]VariableLocality
PackageLocalitiesFor returns locality metadata applicable to the concrete package. Declaration entries retain both their owner and owner-specific metadata. Entries with no declaration owner remain applicable by canonical package path for compatibility with preloaded metadata.
func (Program) PointerSize ¶
func (Program) PyObjectPtr ¶
PyObjectPtr returns the *py.Object type.
func (Program) PyObjectPtrPtr ¶
PyObjectPtrPtr returns the **py.Object type.
func (Program) ResolveLocality ¶
ResolveLocality returns locality metadata for one declaration. Locality variables cannot participate in go:linkname alias chains.
func (Program) ResolveLocalityFor ¶
func (p Program) ResolveLocalityFor(pkg *types.Package, name string) (string, VariableLocality, bool, error)
ResolveLocalityFor resolves locality metadata using the concrete package's declaration when the canonical package path has multiple owners. Owner-less preloaded metadata remains a canonical-name compatibility fallback.
func (Program) SetClosureEnvDirective ¶
SetClosureEnvDirective records that a source function declaration has the llgo:env directive. name and pos identify the source declaration rather than its resolved linker symbol, so aliases retain independent ABI metadata.
func (Program) SetCompileMethods ¶
func (Program) SetDebugInfoOptimized ¶
SetDebugInfoOptimized records whether DWARF should mark generated code as optimized. It never selects compiler passes.
func (Program) SetLinkname ¶
func (Program) SetLocalStorage ¶
func (p Program) SetLocalStorage(name string, storage LocalStorage)
func (Program) SetLocalStorageFor ¶
func (p Program) SetLocalStorageFor(pkg *types.Package, name string, storage LocalStorage)
SetLocalStorageFor records the selected storage for one concrete package declaration.
func (Program) SetLocalityInfo ¶
func (p Program) SetLocalityInfo(name string, info LocalityInfo)
func (Program) SetLocalityInfoFor ¶
func (p Program) SetLocalityInfoFor(pkg *types.Package, name string, info LocalityInfo)
SetLocalityInfoFor updates locality metadata for one concrete package declaration. It preserves distinct metadata for standard and alternate packages whose canonical symbol names are identical.
func (Program) SetNoInterfaceMethod ¶
func (Program) SetPackageExport ¶
SetPackageExport records an export directive before the LLVM Package that will later preserve the symbol exists.
func (Program) SetPthreadStackSize ¶
func (Program) SetPython ¶
SetPython sets the Python package. Its type can be *types.Package or func() *types.Package.
func (Program) SetRuntime ¶
SetRuntime sets the runtime. Its type can be *types.Package or func() *types.Package.
func (Program) SetTypeBackground ¶
func (p Program) SetTypeBackground(fullName string, bg Background)
func (Program) TargetData ¶
func (p Program) TargetData() llvm.TargetData
func (Program) TargetMachine ¶
func (p Program) TargetMachine() llvm.TargetMachine
func (Program) Type ¶
func (p Program) Type(typ types.Type, bg Background) Type
Type convert a Go/C type into raw type. C type = raw type Go type: convert to raw type (because of closure)
func (Program) ValidateLocalities ¶
ValidateLocalities validates the legacy canonical-only metadata view. Its result is unspecified when multiple declaration owners share a canonical path; use ValidateLocalitiesFor in owner-aware code.
func (Program) ValidateLocalitiesFor ¶
ValidateLocalitiesFor validates only declarations that belong to pkg, plus owner-less preloaded metadata for its canonical package path.
func (Program) VariableLocality ¶
func (p Program) VariableLocality(name string) (VariableLocality, bool)
VariableLocality returns the legacy canonical-only metadata view. Its result is unspecified when multiple declaration owners share name; use VariableLocalityFor in owner-aware code.
func (Program) VariableLocalityFor ¶
VariableLocalityFor returns metadata for a concrete declaration, falling back to owner-less preloaded metadata by canonical symbol name.
type ReflectMethodCheck ¶
type SelectState ¶
type Target ¶
type Target struct {
GOOS string
GOARCH string
GOARM string // "5", "6", "7" (default)
Target string // target name from -target flag (e.g., "esp32", "arm7tdmi", "wasi")
LLVMTarget string // physical LLVM target selected by a target configuration
OptLevel optlevel.Level
SaturatingFloatToUint32 bool
}
func (*Target) ClosureEnvBuildTag ¶
ClosureEnvBuildTag selects the runtime half of the same physical ABI used by the backend. It must be added after a named target has resolved its real LLVM triple; GOARCH may only be a package-selection compatibility value.
func (*Target) Spec ¶
func (p *Target) Spec() (spec TargetSpec)
type TargetSpec ¶
type VariableLocality ¶
type VariableLocality struct {
LocalStorage LocalStorage
locality.Info
}
VariableLocality is the locality metadata attached to one package variable.