all: make garbage collector configurable

This commit is contained in:
Ayke van Laethem
2018-11-17 15:01:30 +01:00
parent ecb4742316
commit c220c140ef
3 changed files with 23 additions and 3 deletions
+4
View File
@@ -25,6 +25,7 @@ var commands = map[string]string{
type BuildConfig struct {
opt string
gc string
printIR bool
dumpSSA bool
debug bool
@@ -36,6 +37,7 @@ type BuildConfig struct {
func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, action func(string) error) error {
compilerConfig := compiler.Config{
Triple: spec.Triple,
GC: config.gc,
Debug: config.debug,
DumpSSA: config.dumpSSA,
RootDir: sourceDir(),
@@ -433,6 +435,7 @@ func handleCompilerError(err error) {
func main() {
outpath := flag.String("o", "", "output filename")
opt := flag.String("opt", "z", "optimization level: 0, 1, 2, s, z")
gc := flag.String("gc", "dumb", "garbage collector to use (dumb)")
printIR := flag.Bool("printir", false, "print LLVM IR")
dumpSSA := flag.Bool("dumpssa", false, "dump internal Go SSA")
target := flag.String("target", "", "LLVM target")
@@ -452,6 +455,7 @@ func main() {
flag.CommandLine.Parse(os.Args[2:])
config := &BuildConfig{
opt: *opt,
gc: *gc,
printIR: *printIR,
dumpSSA: *dumpSSA,
debug: !*nodebug,