compiler

package
Version: v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const Version = 9 // last change: implement reflect.New()

Version of the compiler pacakge. Must be incremented each time the compiler package changes in a way that affects the generated LLVM module. This version is independent of the TinyGo version number.

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 aligment as is necessary for the Go typechecker.

Types

type Config

type Config struct {
	// Target and output information.
	Triple          string
	CPU             string
	Features        []string
	GOOS            string
	GOARCH          string
	CodeModel       string
	RelocationModel string

	// Various compiler options that determine how code is generated.
	Scheduler          string
	FuncImplementation string
	AutomaticStackSize bool
	DefaultStackSize   uint64
	NeedsStackObjects  bool
	Debug              bool // Whether to emit debug information in the LLVM module.
	LLVMFeatures       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
t or T : Toggle theme light dark auto
y or Y : Canonical URL