func main() { llvm.InitializeAllTargets() llvm.InitializeAllTargetMCs() llvm.InitializeAllTargetInfos() flag.Parse() if *version { displayVersion() } compiler.SetTraceEnabled(*trace) compiler.SetTargetArch(*arch) compiler.SetTargetOs(*os_) if *printTriple { displayTriple() } module, err := compileFiles(flag.Args(), *importpath) if err == nil { defer module.Dispose() if exitCode == 0 { if *dump { module.Dump() } else { err := writeObjectFile(module) if err != nil { fmt.Println(err) } } } } else { //fmt.Printf("llg.Compile(%v) failed: %v", file.Name, err) report(err) } os.Exit(exitCode) }
func main() { llvm.InitializeAllTargets() llvm.InitializeAllTargetMCs() llvm.InitializeAllTargetInfos() flag.Parse() if *version { displayVersion() } module, err := compileFiles(flag.Args()) if err == nil { defer module.Dispose() if exitCode == 0 { if *dump { module.Dump() } else { err := llvm.WriteBitcodeToFile(module.Module, os.Stdout) if err != nil { fmt.Println(err) } } } } else { //fmt.Printf("llg.Compile(%v) failed: %v", file.Name, err) report(err) } os.Exit(exitCode) }
func main() { llvm.InitializeAllTargets() llvm.InitializeAllTargetMCs() llvm.InitializeAllTargetInfos() flag.Parse() if *version { displayVersion() } if *printTriple { fmt.Println(computeTriple()) os.Exit(0) } opts := llgo.CompilerOptions{} opts.TargetTriple = computeTriple() if *trace { opts.Logger = log.New(os.Stderr, "", 0) } compiler, err := initCompiler() if err != nil { fmt.Fprintf(os.Stderr, "initCompiler failed: %s\n", err) os.Exit(1) } defer compiler.Dispose() module, err := compileFiles(compiler, flag.Args(), *importpath) if err == nil { defer module.Dispose() if exitCode == 0 { if *dump { module.Dump() } else { err := writeObjectFile(module) if err != nil { fmt.Println(err) } } } } else { report(err) } os.Exit(exitCode) }