Skip to content

Commit 2a9f34c

Browse files
committed
ssa2pal: globals should be WithPointer
+ a bit of debug cleanup
1 parent e62a3f9 commit 2a9f34c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

objects/builder.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
package objects
1616

1717
import (
18-
"fmt"
1918
"go/token"
2019
"go/types"
2120

2221
"github.com/go-air/pal/indexing"
23-
"github.com/go-air/pal/internal/plain"
2422
"github.com/go-air/pal/memory"
2523
"github.com/go-air/pal/typeset"
2624
)
@@ -226,7 +224,7 @@ func (b *Builder) Func(sig *types.Signature, declName string, opaque memory.Attr
226224
// everywhere...
227225
func (b *Builder) walkObj(m memory.Loc) {
228226
ty := b.mmod.Type(m)
229-
fmt.Printf("walkObj %s ty %s\n", plain.String(m), b.ts.String(ty))
227+
//fmt.Printf("walkObj %s ty %s\n", plain.String(m), b.ts.String(ty))
230228
ki := b.ts.Kind(ty)
231229
switch ki {
232230
case typeset.Basic:

ssa2pal/debug.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ package ssa2pal
1717
const (
1818
tracePackage = true
1919
traceFunc = true
20+
traceParam = false
2021

21-
debugLogModel = true
22+
debugLogModel = false
2223
traceGenValueLoc = false
2324
traceGenExtract = false
2425
traceGenNext = false

ssa2pal/t.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ func (p *T) genGlobal(name string, x *ssa.Global) {
136136
}
137137
switch ty := x.Type().Underlying().(type) {
138138
case *types.Pointer:
139-
p.vmap[x] = p.buildr.Pointer(ty).Loc()
139+
_, ptr := p.buildr.GoType(ty.Elem().Underlying()).WithPointer()
140+
p.vmap[x] = ptr
140141
default:
141142
msg := fmt.Sprintf(
142143
"unexpected ssa global member type for %s %T\n",
@@ -160,7 +161,7 @@ func (p *T) addFuncDecl(name string, fn *ssa.Function) error {
160161
p.vmap[fn] = memFn.Loc()
161162

162163
for i, param := range fn.Params {
163-
if traceFunc {
164+
if traceParam {
164165
fmt.Printf("setting param %s to %s\n", param, plain.String(memFn.ParamLoc(i)))
165166

166167
}

0 commit comments

Comments
 (0)