abi

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package abi contains target-independent lowering for LLGo's internal ABI.

Index

Constants

View Source
const (
	// MaxStackVarSize matches cmd/compile's default limit for explicitly
	// declared variables. Values larger than this must not live on LLGo's
	// fixed native stack.
	MaxStackVarSize uint64 = 128 * 1024
	// MaxImplicitStackVarSize matches cmd/compile's default limit for
	// compiler-generated temporaries.
	MaxImplicitStackVarSize uint64 = 64 * 1024
	// MinAggregateCopySize is the point at which aggregate loads and
	// stores are lowered to memory intrinsics to avoid LLVM scalarization.
	// Return types and the native stack/return ABI still use MaxImplicitStackVarSize.
	MinAggregateCopySize uint64 = 4 * 1024
	// MaxSSAValueWords matches cmd/compile's ssa.MaxStruct: a value may occupy
	// at most this many pointer-sized words and still be SSAable.
	MaxSSAValueWords = 4
)
View Source
const MaxEscapeStackBytes uint64 = 64 * 1024

MaxEscapeStackBytes bounds storage newly promoted by Go escape analysis and its lowering helpers in one function. Existing locals and later LLVM frame layout remain independent; this is not a bound on the entire call stack.

View Source
const SmallStackBufferSize = runtimeabi.SmallStackBufferSize

Variables

This section is empty.

Functions

func LowerAggregateCopies added in v1.0.10

func LowerAggregateCopies(td llvm.TargetData, m llvm.Module, config AggregateLoweringConfig) int

LowerAggregateCopies applies snapshot lowering to copies of at least 4 KiB and to multi-element arrays larger than MaxSSAValueSize. LLVM scalarizes first-class loads of those arrays, notably NTT polynomials. Smaller arrays stay first-class so they can remain in registers. Function signatures, return sret, and the native C ABI are unchanged: loads used as call arguments are left alone. config.Wasm still selects the wasm GC-root frame layout.

func LowerLargeAggregates

func LowerLargeAggregates(td llvm.TargetData, m llvm.Module, config AggregateLoweringConfig)

LowerLargeAggregates converts oversized direct aggregate returns and copies to indirect memory operations before target-specific C ABI lowering runs.

func MaxSSAValueSize added in v1.0.10

func MaxSSAValueSize(ptrSize int) uint64

MaxSSAValueSize is cmd/compile's CanSSA size limit (MaxStruct * PtrSize).

func PopGCRootFrame added in v1.0.4

func PopGCRootFrame(m llvm.Module, fn llvm.Value, frame GCRootFrame)

PopGCRootFrame restores the chain only when this frame is its actual head. Discarded entries replayed by SJLJ may return without having linked a frame.

func ShouldLowerArrayCopy added in v1.0.10

func ShouldLowerArrayCopy(length int, size uint64, ptrSize int) bool

ShouldLowerArrayCopy reports whether a multi-element array should be copied in memory instead of as a first-class LLVM value. Arrays larger than MaxSSAValueSize are not SSAable in cmd/compile; smaller ones stay in registers.

func ShouldSnapshotAggregateLoad added in v1.0.10

func ShouldSnapshotAggregateLoad(isArray bool, arrayLen int, isStruct bool, size uint64, ptrSize int) bool

ShouldSnapshotAggregateLoad reports whether ABI copy lowering may heap-allocate a snapshot of this load (AllocU), which the frontend must treat as a GC safepoint. Copies smaller than MinAggregateCopySize use a stack alloca instead, including CanSSA-sized arrays, so they are not safepoints.

Types

type AggregateLoweringConfig added in v1.0.4

type AggregateLoweringConfig struct {
	GoWordSize int
	GCRoots    bool
	Wasm       bool
}

AggregateLoweringConfig describes the Go runtime ABI used by lowering-created allocations and roots. GoWordSize can exceed the physical Wasm address size.

type GCRootFrame added in v1.0.4

type GCRootFrame struct {
	Frame, Prev llvm.Value
	Slots       []llvm.Value
	// contains filtered or unexported fields
}

GCRootFrame is the shadow-frame layout used by temporaries introduced after frontend root planning.

func NewGCRootFrame added in v1.0.4

func NewGCRootFrame(m llvm.Module, fn llvm.Value, count, pointerSize, goWordSize int, wasm bool) GCRootFrame

NewGCRootFrame adds an outer frame before the existing entry. When frames are nested by successive lowering passes, pop them in the reverse order.

func (GCRootFrame) StorePointer added in v1.0.4

func (frame GCRootFrame) StorePointer(b llvm.Builder, slot, ptr llvm.Value)

StorePointer publishes a physical address in the Go pointer storage format.

Directories

Path Synopsis
Package abitest shares IR regression checks between ABI lowering passes.
Package abitest shares IR regression checks between ABI lowering passes.

Jump to

Keyboard shortcuts

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