import (
"cmd/internal/obj"
- "cmd/internal/sys"
"fmt"
)
// hopes innocuous) type mismatches.
// The type mismatches should be fixed and the clearing below removed.
dowidth(n.Type)
-
- a.Width = n.Type.Width
}
switch n.Op {
a.Type = obj.TYPE_REG
a.Reg = n.Reg
a.Sym = nil
- if Thearch.LinkArch.Family == sys.I386 { // TODO(rsc): Never clear a->width.
- a.Width = 0
- }
case OINDREG:
a.Type = obj.TYPE_MEM
if a.Offset != int64(int32(a.Offset)) {
yyerror("offset %d too large for OINDREG", a.Offset)
}
- if Thearch.LinkArch.Family == sys.I386 { // TODO(rsc): Never clear a->width.
- a.Width = 0
- }
case OCLOSUREVAR:
if !Curfn.Func.Needctxt {
a.Sym = Linksym(n.Left.Sym)
case ONAME:
- a.Etype = 0
- if n.Type != nil {
- a.Etype = uint8(simtype[n.Type.Etype])
- }
a.Offset = n.Xoffset
s := n.Sym
a.Node = n.Orig
case PFUNC:
a.Name = obj.NAME_EXTERN
a.Type = obj.TYPE_ADDR
- a.Width = int64(Widthptr)
s = funcsym(s)
}
Naddr(a, n.Left)
case OLITERAL:
- if Thearch.LinkArch.Family == sys.I386 {
- a.Width = 0
- }
switch u := n.Val().U.(type) {
default:
Fatalf("naddr: const %L", n.Type)
case OADDR:
Naddr(a, n.Left)
- a.Etype = uint8(Tptr)
- if !Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) { // TODO(rsc): Do this even for these architectures.
- a.Width = int64(Widthptr)
- }
if a.Type != obj.TYPE_MEM {
a := a // copy to let escape into Ctxt.Dconv
Fatalf("naddr: OADDR %v (from %v)", Ctxt.Dconv(a), n.Left.Op)
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // itab(nil)
}
- a.Etype = uint8(Tptr)
- a.Width = int64(Widthptr)
case OIDATA:
// idata of interface value
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // idata(nil)
}
- if isdirectiface(n.Type) {
- a.Etype = uint8(simtype[n.Type.Etype])
- } else {
- a.Etype = uint8(Tptr)
- }
a.Offset += int64(Widthptr)
- a.Width = int64(Widthptr)
// pointer in a string or slice
case OSPTR:
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // ptr(nil)
}
- a.Etype = uint8(simtype[Tptr])
a.Offset += int64(array_array)
- a.Width = int64(Widthptr)
// len of string or slice
case OLEN:
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // len(nil)
}
- a.Etype = uint8(simtype[TUINT])
a.Offset += int64(array_nel)
- if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm.
- a.Width = int64(Widthint)
- }
// cap of string or slice
case OCAP:
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // cap(nil)
}
- a.Etype = uint8(simtype[TUINT])
a.Offset += int64(array_cap)
- if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm.
- a.Width = int64(Widthint)
- }
}
}