...
Run Format

Source file src/cmd/compile/main.go

Documentation: cmd/compile

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"cmd/compile/internal/amd64"
     9  	"cmd/compile/internal/arm"
    10  	"cmd/compile/internal/arm64"
    11  	"cmd/compile/internal/gc"
    12  	"cmd/compile/internal/mips"
    13  	"cmd/compile/internal/mips64"
    14  	"cmd/compile/internal/ppc64"
    15  	"cmd/compile/internal/s390x"
    16  	"cmd/compile/internal/wasm"
    17  	"cmd/compile/internal/x86"
    18  	"cmd/internal/objabi"
    19  	"fmt"
    20  	"log"
    21  	"os"
    22  )
    23  
    24  var archInits = map[string]func(*gc.Arch){
    25  	"386":      x86.Init,
    26  	"amd64":    amd64.Init,
    27  	"amd64p32": amd64.Init,
    28  	"arm":      arm.Init,
    29  	"arm64":    arm64.Init,
    30  	"mips":     mips.Init,
    31  	"mipsle":   mips.Init,
    32  	"mips64":   mips64.Init,
    33  	"mips64le": mips64.Init,
    34  	"ppc64":    ppc64.Init,
    35  	"ppc64le":  ppc64.Init,
    36  	"s390x":    s390x.Init,
    37  	"wasm":     wasm.Init,
    38  }
    39  
    40  func main() {
    41  	// disable timestamps for reproducible output
    42  	log.SetFlags(0)
    43  	log.SetPrefix("compile: ")
    44  
    45  	archInit, ok := archInits[objabi.GOARCH]
    46  	if !ok {
    47  		fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", objabi.GOARCH)
    48  		os.Exit(2)
    49  	}
    50  
    51  	gc.Main(archInit)
    52  	gc.Exit(0)
    53  }
    54  

View as plain text