1
0
mirror of https://github.com/golang/go synced 2024-11-27 03:01:23 -07:00

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: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-03-20 15:01:20 -07:00
parent 236ef852be
commit 42a915c933
14 changed files with 25 additions and 23 deletions

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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 {

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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

View File

@ -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

View File

@ -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())
}

View File

@ -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())
}