Commit 42a915c9 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/internal/obj: convert Debug* Link fields into bools

Change-Id: I9ac274dbfe887675a7820d2f8f87b5887b1c9b0e
Reviewed-on: https://go-review.googlesource.com/38383
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 236ef852
......@@ -35,7 +35,7 @@ func main() {
ctxt := obj.Linknew(architecture.LinkArch)
if *flags.PrintOut {
ctxt.Debugasm = 1
ctxt.Debugasm = true
}
ctxt.Flag_dynlink = *flags.Dynlink
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
......
......@@ -32,10 +32,12 @@ var (
var (
Debug_append int
Debug_asm bool
Debug_closure int
debug_dclstack int
Debug_panic int
Debug_slice int
Debug_vlog bool
Debug_wb int
Debug_pctab string
)
......@@ -174,7 +176,7 @@ func Main(archInit func(*Arch)) {
obj.Flagfn1("I", "add `directory` to import search path", addidir)
obj.Flagcount("K", "debug missing line numbers", &Debug['K'])
obj.Flagcount("N", "disable optimizations", &Debug['N'])
obj.Flagcount("S", "print assembly listing", &Debug['S'])
flag.BoolVar(&Debug_asm, "S", false, "print assembly listing")
obj.Flagfn0("V", "print compiler version", doversion)
obj.Flagcount("W", "debug parse tree after type checking", &Debug['W'])
flag.StringVar(&asmhdr, "asmhdr", "", "write assembly header to `file`")
......@@ -203,7 +205,7 @@ func Main(archInit func(*Arch)) {
obj.Flagcount("s", "warn about composite literals that can be simplified", &Debug['s'])
flag.StringVar(&pathPrefix, "trimpath", "", "remove `prefix` from recorded source file paths")
flag.BoolVar(&safemode, "u", false, "reject unsafe code")
obj.Flagcount("v", "increase debug verbosity", &Debug['v'])
flag.BoolVar(&Debug_vlog, "v", false, "increase debug verbosity")
obj.Flagcount("w", "debug type checking", &Debug['w'])
flag.BoolVar(&use_writebarrier, "wb", true, "enable write barrier")
var flag_shared bool
......@@ -226,8 +228,8 @@ func Main(archInit func(*Arch)) {
Ctxt.Flag_dynlink = flag_dynlink
Ctxt.Flag_optimize = Debug['N'] == 0
Ctxt.Debugasm = int32(Debug['S'])
Ctxt.Debugvlog = int32(Debug['v'])
Ctxt.Debugasm = Debug_asm
Ctxt.Debugvlog = Debug_vlog
if flag.NArg() < 1 {
usage()
......
......@@ -646,7 +646,7 @@ func span5(ctxt *obj.Link, cursym *obj.LSym) {
var opc int32
var out [6 + 3]uint32
for {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f span1\n", obj.Cputime())
}
bflag = 0
......
......@@ -355,7 +355,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
}
if autosize == 0 && cursym.Text.Mark&LEAF == 0 {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("save suppressed in: %s\n", cursym.Name)
}
......@@ -549,7 +549,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
if cursym.Text.From3.Offset&obj.NOSPLIT != 0 {
ctxt.Diag("cannot divide in NOSPLIT function")
}
if ctxt.Debugdivmod != 0 {
if ctxt.Debugdivmod {
break
}
if p.From.Type != obj.TYPE_REG {
......
......@@ -587,7 +587,7 @@ func span7(ctxt *obj.Link, cursym *obj.LSym) {
* around jmps to fix. this is rare.
*/
for bflag != 0 {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f span1\n", obj.Cputime())
}
bflag = 0
......@@ -687,7 +687,7 @@ func checkpool(ctxt *obj.Link, p *obj.Prog, skip int) {
func flushpool(ctxt *obj.Link, p *obj.Prog, skip int) {
if ctxt.Blitrl != nil {
if skip != 0 {
if ctxt.Debugvlog != 0 && skip == 1 {
if ctxt.Debugvlog && skip == 1 {
fmt.Printf("note: flush literal pool at %#x: len=%d ref=%x\n", uint64(p.Pc+4), pool.size, pool.start)
}
q := ctxt.NewProg()
......
......@@ -555,7 +555,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
}
p.To.Offset = int64(ctxt.Autosize) - 8
if ctxt.Autosize == 0 && !(cursym.Text.Mark&LEAF != 0) {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("save suppressed in: %s\n", cursym.Text.From.Sym.Name)
}
cursym.Text.Mark |= LEAF
......
......@@ -719,9 +719,9 @@ type Pcdata struct {
type Link struct {
Headtype HeadType
Arch *LinkArch
Debugasm int32
Debugvlog int32
Debugdivmod int32
Debugasm bool
Debugvlog bool
Debugdivmod bool
Debugpcln string
Flag_shared bool
Flag_dynlink bool
......
......@@ -417,7 +417,7 @@ func span0(ctxt *obj.Link, cursym *obj.LSym) {
var otxt int64
var q *obj.Prog
for bflag != 0 {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f span1\n", obj.Cputime())
}
bflag = 0
......
......@@ -168,7 +168,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
* expand RET
* expand BECOME pseudo
*/
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f noops\n", obj.Cputime())
}
......@@ -340,7 +340,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
q.Spadj = +autosize
} else if cursym.Text.Mark&LEAF == 0 {
if cursym.Text.From3.Offset&obj.NOSPLIT != 0 {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("save suppressed in: %s\n", cursym.Name)
}
......
......@@ -380,7 +380,7 @@ func (w *objWriter) writeSymDebug(s *LSym) {
func (w *objWriter) writeSym(s *LSym) {
ctxt := w.ctxt
if ctxt.Debugasm != 0 {
if ctxt.Debugasm {
w.writeSymDebug(s)
}
......
......@@ -15,7 +15,7 @@ type Plist struct {
}
func Flushplist(ctxt *Link, plist *Plist) {
flushplist(ctxt, plist, ctxt.Debugasm == 0)
flushplist(ctxt, plist, !ctxt.Debugasm)
}
func FlushplistNoFree(ctxt *Link, plist *Plist) {
flushplist(ctxt, plist, false)
......@@ -28,7 +28,7 @@ func flushplist(ctxt *Link, plist *Plist, freeProgs bool) {
var plink *Prog
for p := plist.Firstpc; p != nil; p = plink {
if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 {
if ctxt.Debugasm && ctxt.Debugvlog {
fmt.Printf("obj: %v\n", p)
}
plink = p.Link
......
......@@ -597,7 +597,7 @@ func span9(ctxt *obj.Link, cursym *obj.LSym) {
var otxt int64
var q *obj.Prog
for bflag != 0 {
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f span1\n", obj.Cputime())
}
bflag = 0
......
......@@ -274,7 +274,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
* expand RET
* expand BECOME pseudo
*/
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f noops\n", obj.Cputime())
}
......
......@@ -240,7 +240,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
* strip NOPs
* expand RET
*/
if ctxt.Debugvlog != 0 {
if ctxt.Debugvlog {
ctxt.Logf("%5.2f noops\n", obj.Cputime())
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment