compiler

package
Version: v0.0.0-...-0d16973 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package compiler contains style-to-compiler resolution.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNil occurs when the compiler we try to resolve is nil.
	ErrNil = errors.New("compiler nil")
	// ErrUnknownStyle occurs when we ask the resolver for a compiler style of which it isn't aware.
	ErrUnknownStyle = errors.New("unknown compiler style")

	// CResolve is a pre-populated compiler resolver.
	CResolve = Resolver{Compilers: map[id.ID]Compiler{
		id.CStyleGCC: gcc.GCC{
			DefaultRunInfo: service.RunInfo{Cmd: "gcc", Args: []string{"-pthread", "-std=gnu11"}},
			AltCommands: []string{

				"clang",
			},
		},
	}}
)

Functions

This section is empty.

Types

type Compiler

type Compiler interface {
	// Probe uses sr to probe for copies of a particular compiler class with id classId, adding them to target.
	Probe(ctx context.Context, sr service.Runner, classId id.ID, target mdl.ConfigMap) error

	mdl.Inspector
	interpreter.Driver
}

Compiler contains the various interfaces that a compiler can implement.

type Resolver

type Resolver struct {
	// Compilers is the raw map from style strings to compiler runners.
	Compilers map[id.ID]Compiler
}

Resolver maps compiler styles to compilers.

func (*Resolver) DefaultMOpts

func (r *Resolver) DefaultMOpts(c *mdl.Compiler) (stringhelp.Set, error)

DefaultMOpts gets the default machine-specific optimisation profiles for the compiler described by c.

func (*Resolver) DefaultOptLevels

func (r *Resolver) DefaultOptLevels(c *mdl.Compiler) (stringhelp.Set, error)

DefaultOptLevels gets the default optimisation levels for the compiler described by c.

func (*Resolver) Get

func (r *Resolver) Get(c *mdl.Compiler) (Compiler, error)

Get tries to look up the compiler specified by nc in this resolver.

func (*Resolver) OptLevels

func (r *Resolver) OptLevels(c *mdl.Compiler) (map[string]optlevel.Level, error)

OptLevels gets information about all available optimisation levels for the compiler described by c.

func (*Resolver) Probe

func (r *Resolver) Probe(ctx context.Context, sr service.Runner) (mdl.ConfigMap, error)

func (*Resolver) RunCompiler

func (r *Resolver) RunCompiler(ctx context.Context, j mdl.Job, sr service.Runner) error

RunCompiler runs the compiler specified by nc on job j, using this resolver to map the style to a concrete compiler.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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