main: add -internal-nodwarf flag
This can be useful during development to avoid generating debug information in IR.
Этот коммит содержится в:
родитель
92d9f856ab
коммит
4a240827cb
3 изменённых файлов: 9 добавлений и 1 удалений
|
@ -175,7 +175,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||||
AutomaticStackSize: config.AutomaticStackSize(),
|
AutomaticStackSize: config.AutomaticStackSize(),
|
||||||
DefaultStackSize: config.StackSize(),
|
DefaultStackSize: config.StackSize(),
|
||||||
NeedsStackObjects: config.NeedsStackObjects(),
|
NeedsStackObjects: config.NeedsStackObjects(),
|
||||||
Debug: true,
|
Debug: !config.Options.SkipDWARF, // emit DWARF except when -internal-nodwarf is passed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the target machine, which is the LLVM object that contains all
|
// Load the target machine, which is the LLVM object that contains all
|
||||||
|
|
|
@ -35,6 +35,7 @@ type Options struct {
|
||||||
PrintIR bool
|
PrintIR bool
|
||||||
DumpSSA bool
|
DumpSSA bool
|
||||||
VerifyIR bool
|
VerifyIR bool
|
||||||
|
SkipDWARF bool
|
||||||
PrintCommands func(cmd string, args ...string) `json:"-"`
|
PrintCommands func(cmd string, args ...string) `json:"-"`
|
||||||
Semaphore chan struct{} `json:"-"` // -p flag controls cap
|
Semaphore chan struct{} `json:"-"` // -p flag controls cap
|
||||||
Debug bool
|
Debug bool
|
||||||
|
|
7
main.go
7
main.go
|
@ -1431,6 +1431,12 @@ func main() {
|
||||||
printIR := flag.Bool("internal-printir", false, "print LLVM IR")
|
printIR := flag.Bool("internal-printir", false, "print LLVM IR")
|
||||||
dumpSSA := flag.Bool("internal-dumpssa", false, "dump internal Go SSA")
|
dumpSSA := flag.Bool("internal-dumpssa", false, "dump internal Go SSA")
|
||||||
verifyIR := flag.Bool("internal-verifyir", false, "run extra verification steps on LLVM IR")
|
verifyIR := flag.Bool("internal-verifyir", false, "run extra verification steps on LLVM IR")
|
||||||
|
// Don't generate debug information in the IR, to make IR more readable.
|
||||||
|
// You generally want debug information in IR for various features, like
|
||||||
|
// stack size calculation and features like -size=short, -print-allocs=,
|
||||||
|
// etc. The -no-debug flag is used to strip it at link time. But for TinyGo
|
||||||
|
// development it can be useful to not emit debug information at all.
|
||||||
|
skipDwarf := flag.Bool("internal-nodwarf", false, "internal flag, use -no-debug instead")
|
||||||
|
|
||||||
var flagJSON, flagDeps, flagTest bool
|
var flagJSON, flagDeps, flagTest bool
|
||||||
if command == "help" || command == "list" || command == "info" || command == "build" {
|
if command == "help" || command == "list" || command == "info" || command == "build" {
|
||||||
|
@ -1508,6 +1514,7 @@ func main() {
|
||||||
PrintIR: *printIR,
|
PrintIR: *printIR,
|
||||||
DumpSSA: *dumpSSA,
|
DumpSSA: *dumpSSA,
|
||||||
VerifyIR: *verifyIR,
|
VerifyIR: *verifyIR,
|
||||||
|
SkipDWARF: *skipDwarf,
|
||||||
Semaphore: make(chan struct{}, *parallelism),
|
Semaphore: make(chan struct{}, *parallelism),
|
||||||
Debug: !*nodebug,
|
Debug: !*nodebug,
|
||||||
PrintSizes: *printSize,
|
PrintSizes: *printSize,
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче