]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/main.go
cb2f4e8cf475a74f263d07f2091e5c3ef184f0a9
[gostls13.git] / src / cmd / compile / main.go
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/base"
12         "cmd/compile/internal/gc"
13         "cmd/compile/internal/mips"
14         "cmd/compile/internal/mips64"
15         "cmd/compile/internal/ppc64"
16         "cmd/compile/internal/riscv64"
17         "cmd/compile/internal/s390x"
18         "cmd/compile/internal/ssagen"
19         "cmd/compile/internal/wasm"
20         "cmd/compile/internal/x86"
21         "cmd/internal/objabi"
22         "fmt"
23         "log"
24         "os"
25 )
26
27 var archInits = map[string]func(*ssagen.ArchInfo){
28         "386":      x86.Init,
29         "amd64":    amd64.Init,
30         "arm":      arm.Init,
31         "arm64":    arm64.Init,
32         "mips":     mips.Init,
33         "mipsle":   mips.Init,
34         "mips64":   mips64.Init,
35         "mips64le": mips64.Init,
36         "ppc64":    ppc64.Init,
37         "ppc64le":  ppc64.Init,
38         "riscv64":  riscv64.Init,
39         "s390x":    s390x.Init,
40         "wasm":     wasm.Init,
41 }
42
43 func main() {
44         // disable timestamps for reproducible output
45         log.SetFlags(0)
46         log.SetPrefix("compile: ")
47
48         archInit, ok := archInits[objabi.GOARCH]
49         if !ok {
50                 fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", objabi.GOARCH)
51                 os.Exit(2)
52         }
53
54         gc.Main(archInit)
55         base.Exit(0)
56 }