compiler

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompilePackage added in v0.17.0

func CompilePackage(moduleName string, pkg *loader.Package, ssaPkg *ssa.Package, machine llvm.TargetMachine, config *Config, dumpSSA bool) (llvm.Module, []error)

CompilePackage compiles a single package to a LLVM module.

func NewTargetMachine added in v0.13.0

func NewTargetMachine(config *Config) (llvm.TargetMachine, error)

NewTargetMachine returns a new llvm.TargetMachine based on the passed-in configuration. It is used by the compiler and is needed for machine code emission.

func Sizes added in v0.17.0

func Sizes(machine llvm.TargetMachine) types.Sizes

Sizes returns a types.Sizes appropriate for the given target machine. It includes the correct int size and alignment as is necessary for the Go typechecker.

Types

type Config

type Config struct {
	// Target and output information.
	Triple          string
	CPU             string
	Features        string
	ABI             string
	GOOS            string
	GOARCH          string
	BuildMode       string
	CodeModel       string
	RelocationModel string
	SizeLevel       int
	TinyGoVersion   string // for llvm.ident

	// Various compiler options that determine how code is generated.
	Scheduler          string
	AutomaticStackSize bool
	DefaultStackSize   uint64
	MaxStackAlloc      uint64
	NeedsStackObjects  bool
	Debug              bool // Whether to emit debug information in the LLVM module.
	PanicStrategy      string
}

Config is the configuration for the compiler. Most settings should be copied directly from compileopts.Config, it recreated here to decouple the compiler package a bit and because it makes caching easier.

This struct can be used for caching: if one of the flags here changes the code must be recompiled.

Directories

Path Synopsis
Package ircheck implements a checker for LLVM IR, that goes a bit further than the regular LLVM IR verifier.
Package ircheck implements a checker for LLVM IR, that goes a bit further than the regular LLVM IR verifier.
Package llvmutil contains utility functions used across multiple compiler packages.
Package llvmutil contains utility functions used across multiple compiler packages.

Jump to

Keyboard shortcuts

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