compiler

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 18 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 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
	SizeLevel       int

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

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