mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
compiler: move Config struct to compileopts
This commit is contained in:
committed by
Ron Evans
parent
e7cf75030c
commit
ef600965aa
+3
-30
@@ -14,6 +14,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/tinygo-org/tinygo/compileopts"
|
||||
"github.com/tinygo-org/tinygo/ir"
|
||||
"github.com/tinygo-org/tinygo/loader"
|
||||
"golang.org/x/tools/go/ssa"
|
||||
@@ -57,36 +58,8 @@ var coroFunctionsUsedInTransforms = []string{
|
||||
"runtime.llvmCoroRefHolder",
|
||||
}
|
||||
|
||||
// Configure the compiler.
|
||||
type Config struct {
|
||||
Triple string // LLVM target triple, e.g. x86_64-unknown-linux-gnu (empty string means default)
|
||||
CPU string // LLVM CPU name, e.g. atmega328p (empty string means default)
|
||||
Features []string // LLVM CPU features
|
||||
GOOS string //
|
||||
GOARCH string //
|
||||
GC string // garbage collection strategy
|
||||
Scheduler string // scheduler implementation ("coroutines" or "tasks")
|
||||
PanicStrategy string // panic strategy ("print" or "trap")
|
||||
CFlags []string // cflags to pass to cgo
|
||||
LDFlags []string // ldflags to pass to cgo
|
||||
ClangHeaders string // Clang built-in header include path
|
||||
DumpSSA bool // dump Go SSA, for compiler debugging
|
||||
VerifyIR bool // run extra checks on the IR
|
||||
Debug bool // add debug symbols for gdb
|
||||
GOROOT string // GOROOT
|
||||
TINYGOROOT string // GOROOT for TinyGo
|
||||
GOPATH string // GOPATH, like `go env GOPATH`
|
||||
BuildTags []string // build tags for TinyGo (empty means {Config.GOOS/Config.GOARCH})
|
||||
TestConfig TestConfig
|
||||
}
|
||||
|
||||
type TestConfig struct {
|
||||
CompileTestBinary bool
|
||||
// TODO: Filter the test functions to run, include verbose flag, etc
|
||||
}
|
||||
|
||||
type Compiler struct {
|
||||
Config
|
||||
*compileopts.Config
|
||||
mod llvm.Module
|
||||
ctx llvm.Context
|
||||
builder llvm.Builder
|
||||
@@ -129,7 +102,7 @@ type Phi struct {
|
||||
llvm llvm.Value
|
||||
}
|
||||
|
||||
func NewCompiler(pkgName string, config Config) (*Compiler, error) {
|
||||
func NewCompiler(pkgName string, config *compileopts.Config) (*Compiler, error) {
|
||||
if config.Triple == "" {
|
||||
config.Triple = llvm.DefaultTargetTriple()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user