The c2go translation left a lot of case expressions on separate lines.
Merge expressions onto single lines subject to these constraints:
* Max 4 clauses, all literals or names
* Don't move expressions with comments
The change was created by running http://play.golang.org/p/yHajs72h-g:
$ mergecase cmd/internal/{ld,gc,obj}/*.go cmd/internal/obj/*/*.go
Passes toolstash -cmp.
Change-Id: Iba41b390d302e5486e5dc6ba7599a92270676556
Reviewed-on: https://go-review.googlesource.com/7593
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
et := int32(t.Etype)
switch et {
- case TFUNC,
- TCHAN,
- TMAP,
- TSTRING:
+ case TFUNC, TCHAN, TMAP, TSTRING:
break
/* simtype == 0 during bootstrap */
Fatal("dowidth: unknown type: %v", Tconv(t, 0))
/* compiler-specific stuff */
- case TINT8,
- TUINT8,
- TBOOL:
+ case TINT8, TUINT8, TBOOL:
// bool is int8
w = 1
- case TINT16,
- TUINT16:
+ case TINT16, TUINT16:
w = 2
- case TINT32,
- TUINT32,
- TFLOAT32:
+ case TINT32, TUINT32, TFLOAT32:
w = 4
- case TINT64,
- TUINT64,
- TFLOAT64,
- TCOMPLEX64:
+ case TINT64, TUINT64, TFLOAT64, TCOMPLEX64:
w = 8
t.Align = uint8(Widthreg)
// can't do in walk because n->left->addable
// changes if n->left is an escaping local variable.
switch n.Op {
- case OSPTR,
- OLEN:
+ case OSPTR, OLEN:
if Isslice(n.Left.Type) || Istype(n.Left.Type, TSTRING) {
n.Addable = n.Left.Addable
}
}
}
- case OLSH,
- ORSH,
- OLROT:
+ case OLSH, ORSH, OLROT:
Thearch.Cgen_shift(int(n.Op), n.Bounded, nl, nr, res)
}
Fixlargeoffset(a)
return
- case OCALLFUNC,
- OCALLMETH,
- OCALLINTER:
+ case OCALLFUNC, OCALLMETH, OCALLINTER:
switch n.Op {
case OCALLFUNC:
cgen_call(n, 0)
func typecheckpartialcall(fn *Node, sym *Node) {
switch fn.Op {
- case ODOTINTER,
- ODOTMETH:
+ case ODOTINTER, ODOTMETH:
break
default:
return
}
- case OLSH,
- ORSH:
+ case OLSH, ORSH:
convlit1(&n.Left, t, explicit && isideal(n.Left.Type))
t = n.Left.Type
if t != nil && t.Etype == TIDEAL && n.Val.Ctype != CTINT {
}
}
- case CTSTR,
- CTBOOL:
+ case CTSTR, CTBOOL:
if et != int(n.Type.Etype) {
goto bad
}
- case CTINT,
- CTRUNE,
- CTFLT,
- CTCPLX:
+ case CTINT, CTRUNE, CTFLT, CTCPLX:
ct := int(n.Val.Ctype)
if Isint[et] {
switch ct {
default:
goto bad
- case CTCPLX,
- CTFLT,
- CTRUNE:
+ case CTCPLX, CTFLT, CTRUNE:
n.Val = toint(n.Val)
fallthrough
default:
goto bad
- case CTCPLX,
- CTINT,
- CTRUNE:
+ case CTCPLX, CTINT, CTRUNE:
n.Val = toflt(n.Val)
fallthrough
default:
goto bad
- case CTFLT,
- CTINT,
- CTRUNE:
+ case CTFLT, CTINT, CTRUNE:
n.Val = tocplx(n.Val)
case CTCPLX:
func copyval(v Val) Val {
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
i := new(Mpint)
mpmovefixfix(i, v.U.Xval)
v.U.Xval = i
func tocplx(v Val) Val {
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
c := new(Mpcplx)
Mpmovefixflt(&c.Real, v.U.Xval)
Mpmovecflt(&c.Imag, 0.0)
func toflt(v Val) Val {
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
f := new(Mpflt)
Mpmovefixflt(f, v.U.Xval)
v.Ctype = CTFLT
func doesoverflow(v Val, t *Type) bool {
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
if !Isint[t.Etype] {
Fatal("overflow: %v integer constant", Tconv(t, 0))
}
}
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
Yyerror("constant %v overflows %v", Bconv(v.U.Xval, 0), Tconv(t, 0))
case CTFLT:
func tostr(v Val) Val {
switch v.Ctype {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
if Mpcmpfixfix(v.U.Xval, Minintval[TINT]) < 0 || Mpcmpfixfix(v.U.Xval, Maxintval[TINT]) > 0 {
Yyerror("overflow in int -> string")
}
// right must be unsigned.
// left can be ideal.
- case OLSH,
- ORSH:
+ case OLSH, ORSH:
defaultlit(&nr, Types[TUINT])
n.Right = nr
case CTBOOL:
n.Type = idealbool
- case CTINT,
- CTRUNE,
- CTFLT,
- CTCPLX:
+ case CTINT, CTRUNE, CTFLT, CTCPLX:
n.Type = Types[TIDEAL]
case CTNIL:
}
fallthrough
- case OREAL,
- OIMAG:
+ case OREAL, OIMAG:
return CTFLT
case OCOMPLEX:
return CTBOOL
// shifts (beware!).
- case OLSH,
- ORSH:
+ case OLSH, ORSH:
return idealkind(n.Left)
}
}
TPTR32:
return true
- case TIDEAL,
- TINT64,
- TUINT64,
- TPTR64:
+ case TIDEAL, TINT64, TUINT64, TPTR64:
if Mpcmpfixfix(n.Val.U.Xval, Minintval[TINT32]) < 0 || Mpcmpfixfix(n.Val.U.Xval, Maxintval[TINT32]) > 0 {
break
}
case TUINT32:
x = int64(uint32(x))
- case TINT64,
- TUINT64:
+ case TINT64, TUINT64:
break
}
default:
Fatal("convconst ctype=%d %v", val.Ctype, Tconv(t, obj.FmtLong))
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
i = Mpgetfix(val.U.Xval)
case CTBOOL:
return true
}
- case OLEN,
- OCAP:
+ case OLEN, OCAP:
l := n.Left
if isgoconst(l) {
return true
return
}
- case OREAL,
- OIMAG:
+ case OREAL, OIMAG:
nl := n.Left
if nl.Addable == 0 {
var tmp Node
case OMINUS:
complexminus(nl, res)
- case OADD,
- OSUB:
+ case OADD, OSUB:
complexadd(int(n.Op), nl, nr, res)
case OMUL:
// mktag returns the string representation for an escape analysis tag.
func mktag(mask int) *string {
switch mask & EscMask {
- case EscNone,
- EscReturn:
+ case EscNone, EscReturn:
break
default:
// This assignment is a no-op for escape analysis,
// it does not store any new pointers into b that were not already there.
// However, without this special case b will escape, because we assign to OIND/ODOTPTR.
- case OAS,
- OASOP:
+ case OAS, OASOP:
if (n.Left.Op == OIND || n.Left.Op == ODOTPTR) && n.Left.Left.Op == ONAME && // dst is ONAME dereference
(n.Right.Op == OSLICE || n.Right.Op == OSLICE3 || n.Right.Op == OSLICESTR) && // src is slice operation
(n.Right.Left.Op == OIND || n.Right.Left.Op == ODOTPTR) && n.Right.Left.Left.Op == ONAME && // slice is applied to ONAME dereference
escassign(e, &e.theSink, ll.N)
}
- case OCALLMETH,
- OCALLFUNC,
- OCALLINTER:
+ case OCALLMETH, OCALLFUNC, OCALLINTER:
esccall(e, n, up)
// esccall already done on n->rlist->n. tie it's escretval to n->list
}
}
- case OCONV,
- OCONVNOP:
+ case OCONV, OCONVNOP:
escassign(e, n, n.Left)
case OCONVIFACE:
// so that writing the address of one result
// to another (or the same) result makes the
// first result move to the heap.
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
n.Escloopdepth = 1
}
}
dst = &e.theSink // lose track of dereference
- case OIND,
- ODOTPTR:
+ case OIND, ODOTPTR:
dst = &e.theSink // lose track of dereference
// lose track of key and value
// Flowing multiple returns to a single dst happens when
// analyzing "go f(g())": here g() flows to sink (issue 4529).
- case OCALLMETH,
- OCALLFUNC,
- OCALLINTER:
+ case OCALLMETH, OCALLFUNC, OCALLINTER:
for ll := src.Escretval; ll != nil; ll = ll.Next {
escflows(e, dst, ll.N)
}
// escaping to the global scope.
func escflood(e *EscState, dst *Node) {
switch dst.Op {
- case ONAME,
- OCLOSURE:
+ case ONAME, OCLOSURE:
break
default:
escwalk(e, level, dst, src.Closure)
}
- case OPTRLIT,
- OADDR:
+ case OPTRLIT, OADDR:
if leaks {
src.Esc = EscHeap
addrescapes(src.Left)
fallthrough
// fall through
- case ODOTPTR,
- OINDEXMAP,
- OIND:
+ case ODOTPTR, OINDEXMAP, OIND:
newlevel := level
if level > MinLevel {
}
switch t.Etype {
- case TPTR32,
- TPTR64:
+ case TPTR32, TPTR64:
if fmtmode == FTypeId && (flag&obj.FmtShort != 0 /*untyped*/) {
return fmt.Sprintf("*%v", Tconv(t.Type, obj.FmtShort))
}
// Statements which may be rendered with a simplestmt as init.
func stmtwithinit(op int) bool {
switch op {
- case OIF,
- OFOR,
- OSWITCH:
+ case OIF, OFOR, OSWITCH:
return true
}
case ODCL:
if fmtmode == FExp {
switch n.Left.Class &^ PHEAP {
- case PPARAM,
- PPARAMOUT,
- PAUTO:
+ case PPARAM, PPARAMOUT, PAUTO:
f += fmt.Sprintf("var %v %v", Nconv(n.Left, 0), Tconv(n.Left.Type, 0))
goto ret
}
fallthrough
// fallthrough
- case OAS2DOTTYPE,
- OAS2FUNC,
- OAS2MAPR,
- OAS2RECV:
+ case OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV:
f += fmt.Sprintf("%v = %v", Hconv(n.List, obj.FmtComma), Hconv(n.Rlist, obj.FmtComma))
case ORETURN:
f += fmt.Sprintf("for %v = range %v { %v }", Hconv(n.List, obj.FmtComma), Nconv(n.Right, 0), Hconv(n.Nbody, 0))
- case OSELECT,
- OSWITCH:
+ case OSELECT, OSWITCH:
if fmtmode == FErr {
f += fmt.Sprintf("%v statement", Oconv(int(n.Op), 0))
break
f += fmt.Sprintf(" { %v }", Hconv(n.List, 0))
- case OCASE,
- OXCASE:
+ case OCASE, OXCASE:
if n.List != nil {
f += fmt.Sprintf("case %v: %v", Hconv(n.List, obj.FmtComma), Hconv(n.Nbody, 0))
} else {
fallthrough
//fallthrough
- case OPACK,
- ONONAME:
+ case OPACK, ONONAME:
return Sconv(n.Sym, 0)
case OTYPE:
// fallthrough
- case OARRAYLIT,
- OMAPLIT:
+ case OARRAYLIT, OMAPLIT:
if fmtmode == FErr {
return fmt.Sprintf("%v literal", Tconv(n.Type, 0))
}
f += fmt.Sprintf(".%v", Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte))
return f
- case ODOTTYPE,
- ODOTTYPE2:
+ case ODOTTYPE, ODOTTYPE2:
var f string
f += exprfmt(n.Left, nprec)
if n.Right != nil {
f += fmt.Sprintf("[%v]", Nconv(n.Right, 0))
return f
- case OCOPY,
- OCOMPLEX:
+ case OCOPY, OCOMPLEX:
return fmt.Sprintf("%v(%v, %v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0), Nconv(n.Right, 0))
case OCONV,
}
return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma))
- case OCALL,
- OCALLFUNC,
- OCALLINTER,
- OCALLMETH:
+ case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH:
var f string
f += exprfmt(n.Left, nprec)
if n.Isddd {
f += fmt.Sprintf("(%v)", Hconv(n.List, obj.FmtComma))
return f
- case OMAKEMAP,
- OMAKECHAN,
- OMAKESLICE:
+ case OMAKEMAP, OMAKECHAN, OMAKESLICE:
if n.List != nil { // pre-typecheck
return fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma))
}
return f
- case OCMPSTR,
- OCMPIFACE:
+ case OCMPSTR, OCMPIFACE:
var f string
f += exprfmt(n.Left, nprec)
f += fmt.Sprintf(" %v ", Oconv(int(n.Etype), obj.FmtSharp))
default:
fmt.Fprintf(&buf, "%v%v", Oconv(int(n.Op), 0), Jconv(n, 0))
- case OREGISTER,
- OINDREG:
+ case OREGISTER, OINDREG:
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), obj.Rconv(int(n.Val.U.Reg)), Jconv(n, 0))
case OLITERAL:
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Vconv(&n.Val, 0), Jconv(n, 0))
- case ONAME,
- ONONAME:
+ case ONAME, ONONAME:
if n.Sym != nil {
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Sconv(n.Sym, 0), Jconv(n, 0))
} else {
_ = r
var str string
switch fmtmode {
- case FErr,
- FExp:
+ case FErr, FExp:
str = nodefmt(n, flag)
case FDbg:
// so the param already has a valid xoffset.
// expression to refer to stack copy
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
n.Stackparam = Nod(OPARAM, n, nil)
n.Stackparam.Type = n.Type
Curfn = oldfn
}
- case OIND,
- ODOTPTR:
+ case OIND, ODOTPTR:
break
// ODOTPTR has already been introduced,
// In &x[0], if x is a slice, then x does not
// escape--the pointer inside x does, but that
// is always a heap pointer anyway.
- case ODOT,
- OINDEX:
+ case ODOT, OINDEX:
if !Isslice(n.Left.Type) {
addrescapes(n.Left)
}
z.Addable = 1
switch Simtype[n.Type.Etype] {
- case TCOMPLEX64,
- TCOMPLEX128:
+ case TCOMPLEX64, TCOMPLEX128:
z.Val.U.Cval = new(Mpcplx)
Mpmovecflt(&z.Val.U.Cval.Real, 0.0)
Mpmovecflt(&z.Val.U.Cval.Imag, 0.0)
- case TFLOAT32,
- TFLOAT64:
+ case TFLOAT32, TFLOAT64:
var zero Mpflt
Mpmovecflt(&zero, 0.0)
z.Val.Ctype = CTFLT
z.Val.U.Fval = &zero
- case TPTR32,
- TPTR64,
- TCHAN,
- TMAP:
+ case TPTR32, TPTR64, TCHAN, TMAP:
z.Val.Ctype = CTNIL
case TBOOL:
if n.Defn != nil {
switch n.Defn.Op {
// so stmtlabel can find the label
- case OFOR,
- OSWITCH,
- OSELECT:
+ case OFOR, OSWITCH, OSELECT:
n.Defn.Sym = lab.Sym
}
}
case ODEFER:
cgen_proc(n, 2)
- case ORETURN,
- ORETJMP:
+ case ORETURN, ORETJMP:
cgen_ret(n)
case OCHECKNIL:
goto no
}
- case TSTRING,
- TINTER:
+ case TSTRING, TINTER:
break
}
func Isfat(t *Type) bool {
if t != nil {
switch t.Etype {
- case TSTRUCT,
- TARRAY,
- TSTRING,
+ case TSTRUCT, TARRAY, TSTRING,
TINTER: // maybe remove later
return true
}
case PAUTO:
a.Name = obj.NAME_AUTO
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
a.Name = obj.NAME_PARAM
case PFUNC:
a.Type = obj.TYPE_FCONST
a.Val = mpgetflt(n.Val.U.Fval)
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
a.Sym = nil
a.Type = obj.TYPE_CONST
a.Offset = Mpgetfix(n.Val.U.Xval)
// are there any interesting init statements
for l := n; l != nil; l = l.Next {
switch l.N.Op {
- case ODCLFUNC,
- ODCLCONST,
- ODCLTYPE,
- OEMPTY:
+ case ODCLFUNC, ODCLCONST, ODCLTYPE, OEMPTY:
break
case OAS:
}
// Things that are too hairy, irrespective of the budget
- case OCALL,
- OCALLINTER,
- OPANIC,
- ORECOVER:
+ case OCALL, OCALLINTER, OPANIC, ORECOVER:
if Debug['l'] < 4 {
return true
}
}
switch n.Op {
- case ONAME,
- OTYPE,
- OLITERAL:
+ case ONAME, OTYPE, OLITERAL:
return n
}
switch n.Op {
// inhibit inlining of their argument
- case ODEFER,
- OPROC:
+ case ODEFER, OPROC:
switch n.Left.Op {
- case OCALLFUNC,
- OCALLMETH:
+ case OCALLFUNC, OCALLMETH:
n.Left.Etype = n.Op
}
fallthrough
// transmogrify this node itself unless inhibited by the
// switch at the top of this function.
switch n.Op {
- case OCALLFUNC,
- OCALLMETH:
+ case OCALLFUNC, OCALLMETH:
if n.Etype == OPROC || n.Etype == ODEFER {
return
}
if n.List != nil && n.List.Next == nil {
switch n.List.N.Op {
- case OCALL,
- OCALLFUNC,
- OCALLINTER,
- OCALLMETH:
+ case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH:
if n.List.N.Left.Type.Outtuple > 1 {
multiret = n.List.N.Left.Type.Outtuple - 1
}
}
return n
- case OLITERAL,
- OTYPE:
+ case OLITERAL, OTYPE:
return n
// Since we don't handle bodies with closures, this return is guaranteed to belong to the current inlined function.
// dump("Return after substitution", m);
return m
- case OGOTO,
- OLABEL:
+ case OGOTO, OLABEL:
m := Nod(OXXX, nil, nil)
*m = *n
m.Ninit = nil
*
* i said it was clumsy.
*/
- case '(',
- '[':
+ case '(', '[':
if loophack != 0 || _yylex_lstk != nil {
h = new(Loophack)
if h == nil {
goto lx
- case ')',
- ']':
+ case ')', ']':
if _yylex_lstk != nil {
h = _yylex_lstk
loophack = h.v
case LIGNORE:
goto l0
- case LFOR,
- LIF,
- LSWITCH,
- LSELECT:
+ case LFOR, LIF, LSWITCH, LSELECT:
loophack = 1 // see comment about loophack above
}
c := s[0]
s = s[1:]
switch c {
- case '-',
- '+':
+ case '-', '+':
break
case '0':
f = 1
fallthrough
- case ' ',
- '\t',
- '+':
+ case ' ', '\t', '+':
continue
case '.':
}
continue
- case 'P',
- 'p':
+ case 'P', 'p':
eb = 1
fallthrough
- case 'E',
- 'e':
+ case 'E', 'e':
ex = 0
ef = 0
for {
// and then returns tmp.
func ordercheapexpr(n *Node, order *Order) *Node {
switch n.Op {
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
return n
}
// The intended use is to apply to x when rewriting x += y into x = x + y.
func ordersafeexpr(n *Node, order *Order) *Node {
switch n.Op {
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
return n
case ODOT:
typecheck(&a, Erv)
return a
- case ODOTPTR,
- OIND:
+ case ODOTPTR, OIND:
l := ordercheapexpr(n.Left, order)
if l == n.Left {
return n
typecheck(&a, Erv)
return a
- case OINDEX,
- OINDEXMAP:
+ case OINDEX, OINDEXMAP:
var l *Node
if Isfixedarray(n.Left.Type) {
l = ordersafeexpr(n.Left, order)
default:
return false
- case OCALLFUNC,
- OCALLMETH,
- OCALLINTER:
+ case OCALLFUNC, OCALLMETH, OCALLINTER:
break
}
order.out = list(order.out, a)
}
- case OAS2,
- OAS2DOTTYPE,
- OAS2MAPR,
- OAS2FUNC:
+ case OAS2, OAS2DOTTYPE, OAS2MAPR, OAS2FUNC:
var post *NodeList
var m *Node
var a *Node
orderexprlist(n.List, order)
orderexprlist(n.Rlist, order)
switch n.Op {
- case OAS,
- OAS2,
- OAS2DOTTYPE:
+ case OAS, OAS2, OAS2DOTTYPE:
ordermapassign(n, order)
default:
cleantemp(t, order)
// Special: does not save n onto out.
- case OBLOCK,
- OEMPTY:
+ case OBLOCK, OEMPTY:
orderstmtlist(n.List, order)
// Special: n->left is not an expression; save as is.
order.out = list(order.out, n)
// Special: handle call arguments.
- case OCALLFUNC,
- OCALLINTER,
- OCALLMETH:
+ case OCALLFUNC, OCALLINTER, OCALLMETH:
t := marktemp(order)
ordercall(n, order)
cleantemp(t, order)
// Special: order arguments to inner call but not call itself.
- case ODEFER,
- OPROC:
+ case ODEFER, OPROC:
t := marktemp(order)
switch n.Left.Op {
// chan, string, slice, array ranges use value multiple times.
// make copy.
// fall through
- case TCHAN,
- TSTRING:
+ case TCHAN, TSTRING:
r := n.Right
if r.Type.Etype == TSTRING && r.Type != Types[TSTRING] {
// the ODCL nodes to declare x and y. We want to delay that
// declaration (and possible allocation) until inside the case body.
// Delete the ODCL nodes here and recreate them inside the body below.
- case OSELRECV,
- OSELRECV2:
+ case OSELRECV, OSELRECV2:
if r.Colas != 0 {
t = r.Ninit
if t != nil && t.N.Op == ODCL && t.N.Left == r.Left {
orderaddrtemp(&n.Left, order)
}
- case OANDAND,
- OOROR:
+ case OANDAND, OOROR:
mark := marktemp(order)
orderexpr(&n.Left, order)
n.Alloc = ordertemp(Types[TUINT8], order, false) // walk will fill in correct type
}
- case OARRAYLIT,
- OCALLPART:
+ case OARRAYLIT, OCALLPART:
orderexpr(&n.Left, order)
orderexpr(&n.Right, order)
orderexprlist(n.List, order)
orderexpr(&n.Left, order)
n = ordercopyexpr(n, n.Type, order, 1)
- case OEQ,
- ONE:
+ case OEQ, ONE:
orderexpr(&n.Left, order)
orderexpr(&n.Right, order)
t := n.Left.Type
}
switch n.Class {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
Thearch.Gins(as, nil, n)
}
}
continue
}
switch n.Class {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
Nodconst(&nod1, Types[TUINTPTR], l.N.Type.Width)
p = Thearch.Gins(obj.ATYPE, l.N, &nod1)
p.From.Gotype = Linksym(ngotype(l.N))
result = append(result, ll.N)
}
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
ll.N.Opt = int32(len(result))
result = append(result, ll.N)
}
from := &prog.From
if from.Node != nil && from.Sym != nil && ((from.Node).(*Node)).Curfn == Curfn {
switch ((from.Node).(*Node)).Class &^ PHEAP {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
pos, ok := from.Node.(*Node).Opt.(int32) // index in vars
if !ok {
goto Next
to := &prog.To
if to.Node != nil && to.Sym != nil && ((to.Node).(*Node)).Curfn == Curfn {
switch ((to.Node).(*Node)).Class &^ PHEAP {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
pos, ok := to.Node.(*Node).Opt.(int32) // index in vars
if !ok {
return
xoffset = node.Xoffset + stkptrsize
twobitwalktype1(node.Type, &xoffset, locals)
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
xoffset = node.Xoffset
twobitwalktype1(node.Type, &xoffset, args)
}
// Check whether n is marked live in args/locals.
func islive(n *Node, args Bvec, locals Bvec) bool {
switch n.Class {
- case PPARAM,
- PPARAMOUT:
+ case PPARAM, PPARAMOUT:
for i := 0; int64(i) < n.Type.Width/int64(Widthptr)*obj.BitsPerPointer; i++ {
if bvget(args, int32(n.Xoffset/int64(Widthptr)*obj.BitsPerPointer+int64(i))) != 0 {
return true
default:
Fatal("racewalk: unknown node type %v", Oconv(int(n.Op), 0))
- case OAS,
- OAS2FUNC:
+ case OAS, OAS2FUNC:
racewalknode(&n.Left, init, 1, 0)
racewalknode(&n.Right, init, 0, 0)
goto ret
// can't matter
- case OCFUNC,
- OVARKILL:
+ case OCFUNC, OVARKILL:
goto ret
case OBLOCK:
// x, y := f() becomes BLOCK{CALL f, AS x [SP+0], AS y [SP+n]}
// We don't want to instrument between the statements because it will
// smash the results.
- case OCALLFUNC,
- OCALLMETH,
- OCALLINTER:
+ case OCALLFUNC, OCALLMETH, OCALLINTER:
racewalknode(&n.List.N, &n.List.N.Ninit, 0, 0)
var fini *NodeList
callinstr(&n, init, wr, skip)
goto ret
- case OSPTR,
- OLEN,
- OCAP:
+ case OSPTR, OLEN, OCAP:
racewalknode(&n.Left, init, 0, 0)
if Istype(n.Left.Type, TMAP) {
n1 := Nod(OCONVNOP, n.Left, nil)
racewalknode(&n.Right, init, wr, 0)
goto ret
- case OANDAND,
- OOROR:
+ case OANDAND, OOROR:
racewalknode(&n.Left, init, wr, 0)
// walk has ensured the node has moved to a location where
racewalknode(&n.Left, init, wr, 0)
goto ret
- case ODIV,
- OMOD:
+ case ODIV, OMOD:
racewalknode(&n.Left, init, wr, 0)
racewalknode(&n.Right, init, wr, 0)
goto ret
// Seems to only lead to double instrumentation.
//racewalknode(&n->left, init, 0, 0);
- case OSLICE,
- OSLICEARR,
- OSLICE3,
- OSLICE3ARR:
+ case OSLICE, OSLICEARR, OSLICE3, OSLICE3ARR:
goto ret
case OADDR:
goto ret
// impossible nodes: only appear in backend.
- case ORROTC,
- OEXTEND:
+ case ORROTC, OEXTEND:
Yyerror("racewalk: %v cannot exist now", Oconv(int(n.Op), 0))
goto ret
}
// Turn T(v).Field into v.Field
- case ODOT,
- OXDOT:
+ case ODOT, OXDOT:
if n.Left.Op == OCONVNOP {
n.Left = n.Left.Left
}
func hascallspred(n *Node, c interface{}) {
switch n.Op {
- case OCALL,
- OCALLFUNC,
- OCALLMETH,
- OCALLINTER:
+ case OCALL, OCALLFUNC, OCALLMETH, OCALLINTER:
(*c.(*int))++
}
}
switch n.Op {
// There may be multiple refs to this node;
// introduce OCONVNOP to hold init list.
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
n = Nod(OCONVNOP, n, nil)
n.Type = n.Left.Type
ot = duint16(s, ot, uint16(mapbucket(t).Width))
ot = duint8(s, ot, uint8(bool2int(isreflexive(t.Down))))
- case TPTR32,
- TPTR64:
+ case TPTR32, TPTR64:
if t.Type.Etype == TANY {
// ../../runtime/type.go:/UnsafePointerType
ot = dcommontype(s, ot, t)
// we want be able to find.
if t.Sym == nil {
switch t.Etype {
- case TARRAY,
- TCHAN,
- TMAP:
+ case TARRAY, TCHAN, TMAP:
slink := typelinksym(t)
dsymptr(slink, 0, s, 0)
ggloblsym(slink, int32(Widthptr), int8(dupok|obj.RODATA))
}
switch et {
- case 0,
- TFUNC:
+ case 0, TFUNC:
return zbits
}
return Thearch.RtoB(i)
}
- case TFLOAT32,
- TFLOAT64:
+ case TFLOAT32, TFLOAT64:
i := Thearch.BtoF(^b)
if i != 0 && r.cost > 0 {
r.regno = int16(i)
case OSEND:
ch = n.Left
- case OSELRECV,
- OSELRECV2:
+ case OSELRECV, OSELRECV2:
ch = n.Right.Left
if n.Op == OSELRECV || n.Ntest == nil {
if n.Left == nil {
n.Right = Nod(OADDR, n.Right, nil)
typecheck(&n.Right, Erv)
- case OSELRECV,
- OSELRECV2:
+ case OSELRECV, OSELRECV2:
if n.Op == OSELRECV2 && n.Ntest == nil {
n.Op = OSELRECV
}
return
}
switch n.Class {
- case PEXTERN,
- PFUNC:
+ case PEXTERN, PFUNC:
break
default:
*out = list(*out, n.Defn)
}
- case OAS2FUNC,
- OAS2MAPR,
- OAS2DOTTYPE,
- OAS2RECV:
+ case OAS2FUNC, OAS2MAPR, OAS2DOTTYPE, OAS2RECV:
if n.Defn.Initorder != InitNotStarted {
break
}
for ; l != nil; l = l.Next {
n = l.N
switch n.Op {
- case ODCLFUNC,
- ODCLCONST,
- ODCLTYPE:
+ case ODCLFUNC, ODCLCONST, ODCLTYPE:
continue
}
break
// copy pointer
- case OARRAYLIT,
- OSTRUCTLIT,
- OMAPLIT:
+ case OARRAYLIT, OSTRUCTLIT, OMAPLIT:
gdata(l, Nod(OADDR, r.Nname, nil), int(l.Type.Width))
return true
break
// Init pointer.
- case OARRAYLIT,
- OMAPLIT,
- OSTRUCTLIT:
+ case OARRAYLIT, OMAPLIT, OSTRUCTLIT:
a := staticname(r.Left.Type, 1)
r.Nname = a
// not a special composit literal assignment
return false
- case OSTRUCTLIT,
- OARRAYLIT,
- OMAPLIT:
+ case OSTRUCTLIT, OARRAYLIT, OMAPLIT:
if vmatch1(n.Left, n.Right) {
// not a special composit literal assignment
return false
case CTBOOL:
return n.Val.U.Bval == 0
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
return mpcmpfixc(n.Val.U.Xval, 0) == 0
case CTFLT:
TFLOAT64:
gdata(&nam, nr, int(nr.Type.Width))
- case TCOMPLEX64,
- TCOMPLEX128:
+ case TCOMPLEX64, TCOMPLEX128:
gdatacomplex(&nam, nr.Val.U.Cval)
case TSTRING:
lno := lineno
if n != nil {
switch n.Op {
- case ONAME,
- OTYPE,
- OPACK,
- OLITERAL:
+ case ONAME, OTYPE, OPACK, OLITERAL:
break
default:
switch t.Etype {
// will be defined later.
- case TANY,
- TFORW:
+ case TANY, TFORW:
*bad = t
return -1
TUNSAFEPTR:
return AMEM
- case TFUNC,
- TMAP:
+ case TFUNC, TMAP:
if bad != nil {
*bad = t
}
default:
Yyerror("array bound must be an integer expression")
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
bound = Mpgetfix(b.Val.U.Xval)
if bound < 0 {
Yyerror("array bound must be non negative")
fallthrough
// fall through
- case ONAME,
- OLITERAL,
- OTYPE:
+ case ONAME, OLITERAL, OTYPE:
m = n
}
return true
}
switch t.Etype {
- case TNIL,
- TIDEAL:
+ case TNIL, TIDEAL:
return true
}
return true
}
- case TINT,
- TINT32:
+ case TINT, TINT32:
if (t1 == Types[runetype.Etype] || t1 == runetype) && (t2 == Types[runetype.Etype] || t2 == runetype) {
return true
}
l.t2 = t2
switch t1.Etype {
- case TINTER,
- TSTRUCT:
+ case TINTER, TSTRUCT:
t1 = t1.Type
t2 = t2.Type
for ; t1 != nil && t2 != nil; t1, t2 = t1.Down, t2.Down {
return false
}
switch Simtype[t.Etype] {
- case TINT64,
- TUINT64,
- TPTR64:
+ case TINT64, TUINT64, TPTR64:
return true
}
e2 := int(Simtype[t2.Etype])
switch e1 {
- case TINT8,
- TUINT8:
+ case TINT8, TUINT8:
return e2 == TINT8 || e2 == TUINT8
- case TINT16,
- TUINT16:
+ case TINT16, TUINT16:
return e2 == TINT16 || e2 == TUINT16
- case TINT32,
- TUINT32,
- TPTR32:
+ case TINT32, TUINT32, TPTR32:
return e2 == TINT32 || e2 == TUINT32 || e2 == TPTR32
- case TINT64,
- TUINT64,
- TPTR64:
+ case TINT64, TUINT64, TPTR64:
return e2 == TINT64 || e2 == TUINT64 || e2 == TPTR64
case TFLOAT32:
nt = shallow(t)
nt.Copyany = 1
- case TPTR32,
- TPTR64,
- TCHAN,
- TARRAY:
+ case TPTR32, TPTR64, TCHAN, TARRAY:
nt = shallow(t)
nt.Type = deep(t.Type)
}
switch n.Op {
- case OREGISTER,
- OLITERAL,
- ONAME:
+ case OREGISTER, OLITERAL, ONAME:
ul = 1
if n.Class == PPARAMREF || (n.Class&PHEAP != 0) {
ul++
}
goto out
- case OCALL,
- OCALLFUNC,
- OCALLMETH,
- OCALLINTER:
+ case OCALL, OCALLFUNC, OCALLMETH, OCALLINTER:
ul = UINF
goto out
// hard with race detector
- case OANDAND,
- OOROR:
+ case OANDAND, OOROR:
if flag_race != 0 {
ul = UINF
goto out
default:
goto bad
- case TSTRUCT,
- TINTER,
- TFUNC:
+ case TSTRUCT, TINTER, TFUNC:
break
}
}
switch n.Op {
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
return n
case ODOT:
walkexpr(&r, init)
return r
- case ODOTPTR,
- OIND:
+ case ODOTPTR, OIND:
l := safeexpr(n.Left, init)
if l == n.Left {
return n
walkexpr(&a, init)
return a
- case OINDEX,
- OINDEXMAP:
+ case OINDEX, OINDEXMAP:
l := safeexpr(n.Left, init)
r := safeexpr(n.Right, init)
if l == n.Left && r == n.Right {
*/
func cheapexpr(n *Node, init **NodeList) *Node {
switch n.Op {
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
return n
}
switch n.Op {
// There may be multiple refs to this node;
// introduce OCONVNOP to hold init list.
- case ONAME,
- OLITERAL:
+ case ONAME, OLITERAL:
n = Nod(OCONVNOP, n, nil)
n.Type = n.Left.Type
// But re-typecheck ONAME/OTYPE/OLITERAL/OPACK node in case context has changed.
if n.Typecheck == 1 {
switch n.Op {
- case ONAME,
- OTYPE,
- OLITERAL,
- OPACK:
+ case ONAME, OTYPE, OLITERAL, OPACK:
break
default:
return
}
switch consttype(n) {
- case CTINT,
- CTRUNE,
- CTFLT,
- CTCPLX:
+ case CTINT, CTRUNE, CTFLT, CTCPLX:
defaultlit(np, Types[TINT])
}
l := typecheck(&n.Left, Erv)
var v Val
switch consttype(l) {
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
v = l.Val
case CTFLT:
n.Type = t
break OpSwitch
- case OCOM,
- OMINUS,
- ONOT,
- OPLUS:
+ case OCOM, OMINUS, ONOT, OPLUS:
ok |= Erv
l := typecheck(&n.Left, Erv|top&Eiota)
t := l.Type
}
switch n.Op {
- case ODOTINTER,
- ODOTMETH:
+ case ODOTINTER, ODOTMETH:
if top&Ecall != 0 {
ok |= Ecall
} else {
n.Type = nil
return
- case TSTRING,
- TARRAY:
+ case TSTRING, TARRAY:
indexlit(&n.Right)
if t.Etype == TSTRING {
n.Type = Types[TUINT8]
n.Type = getoutargx(l.Type)
break OpSwitch
- case OCAP,
- OLEN,
- OREAL,
- OIMAG:
+ case OCAP, OLEN, OREAL, OIMAG:
ok |= Erv
if onearg(n, "%v", Oconv(int(n.Op), 0)) < 0 {
n.Type = nil
goto badcall1
}
- case OREAL,
- OIMAG:
+ case OREAL, OIMAG:
if !Iscomplex[t.Etype] {
goto badcall1
}
n.Type = Ptrto(t)
break OpSwitch
- case OPRINT,
- OPRINTN:
+ case OPRINT, OPRINTN:
ok |= Etop
typechecklist(n.List, Erv|Eindir) // Eindir: address does not escape
for args := n.List; args != nil; args = args.Next {
default: // unknown, bool, nil
b = 23
- case CTINT,
- CTRUNE:
+ case CTINT, CTRUNE:
b = uint32(Mpgetfix(n.Val.U.Xval))
case CTFLT:
func iscomptype(t *Type) bool {
switch t.Etype {
- case TARRAY,
- TSTRUCT,
- TMAP:
+ case TARRAY, TSTRUCT, TMAP:
return true
- case TPTR32,
- TPTR64:
+ case TPTR32, TPTR64:
switch t.Type.Etype {
- case TARRAY,
- TSTRUCT,
- TMAP:
+ case TARRAY, TSTRUCT, TMAP:
return true
}
}
fallthrough
// fall through
- case OIND,
- ODOTPTR,
- OCLOSUREVAR,
- OPARAM:
+ case OIND, ODOTPTR, OCLOSUREVAR, OPARAM:
return true
case ODOT:
}
switch l.Op {
- case ONAME,
- OCLOSUREVAR:
+ case ONAME, OCLOSUREVAR:
return l == r
- case ODOT,
- ODOTPTR:
+ case ODOT, ODOTPTR:
return l.Right != nil && r.Right != nil && l.Right.Sym == r.Right.Sym && samesafeexpr(l.Left, r.Left)
case OIND:
switch n.Right.Op {
// For x = x[0:y], x can be updated in place, without touching pointer.
// TODO(rsc): Reenable once it is actually updated in place without touching the pointer.
- case OSLICE,
- OSLICE3,
- OSLICESTR:
+ case OSLICE, OSLICE3, OSLICESTR:
if false && samesafeexpr(n.Left, n.Right.Left) && (n.Right.Right.Left == nil || iszero(n.Right.Right.Left)) {
n.Right.Reslice = true
}
goto out
}
switch r.Op {
- case OCALLMETH,
- OCALLINTER,
- OCALLFUNC:
+ case OCALLMETH, OCALLINTER, OCALLFUNC:
if r.Type.Etype != TSTRUCT || r.Type.Funarg == 0 {
break
}
Fatal("typecheckdef %v", Oconv(int(n.Op), 0))
// not really syms
- case OGOTO,
- OLABEL:
+ case OGOTO, OLABEL:
break
case OLITERAL:
func checkmake(t *Type, arg string, n *Node) int {
if n.Op == OLITERAL {
switch n.Val.Ctype {
- case CTINT,
- CTRUNE,
- CTFLT,
- CTCPLX:
+ case CTINT, CTRUNE, CTFLT, CTCPLX:
n.Val = toint(n.Val)
if mpcmpfixc(n.Val.U.Xval, 0) < 0 {
Yyerror("negative %s argument in make(%v)", arg, Tconv(t, 0))
case OIF:
return isterminating(n.Nbody, 0) && isterminating(n.Nelse, 0)
- case OSWITCH,
- OTYPESW,
- OSELECT:
+ case OSWITCH, OTYPESW, OSELECT:
if n.Hasbreak {
return false
}
base := r.Left
typecheck(&r, Erv)
switch r.Op {
- case ODOT,
- ODOTPTR:
+ case ODOT, ODOTPTR:
break
case OCALLPART:
case ODEFER:
Hasdefer = 1
switch n.Left.Op {
- case OPRINT,
- OPRINTN:
+ case OPRINT, OPRINTN:
walkprintfunc(&n.Left, &n.Ninit)
case OCOPY:
case OPROC:
switch n.Left.Op {
- case OPRINT,
- OPRINTN:
+ case OPRINT, OPRINTN:
walkprintfunc(&n.Left, &n.Ninit)
case OCOPY:
walkexpr(&n.Right, init)
goto ret
- case OSPTR,
- OITAB:
+ case OSPTR, OITAB:
walkexpr(&n.Left, init)
goto ret
- case OLEN,
- OCAP:
+ case OLEN, OCAP:
walkexpr(&n.Left, init)
// replace len(*[10]int) with 10.
goto ret
- case OLSH,
- ORSH:
+ case OLSH, ORSH:
walkexpr(&n.Left, init)
walkexpr(&n.Right, init)
t := n.Left.Type
walkexpr(&n.Right, init)
goto ret
- case OOR,
- OXOR:
+ case OOR, OXOR:
walkexpr(&n.Left, init)
walkexpr(&n.Right, init)
walkrotate(&n)
goto ret
- case OEQ,
- ONE:
+ case OEQ, ONE:
walkexpr(&n.Left, init)
walkexpr(&n.Right, init)
safemode = old_safemode
goto ret
- case OANDAND,
- OOROR:
+ case OANDAND, OOROR:
walkexpr(&n.Left, init)
// cannot put side effects from n.Right on init,
addinit(&n.Right, ll)
goto ret
- case OPRINT,
- OPRINTN:
+ case OPRINT, OPRINTN:
walkexprlist(n.List, init)
n = walkprint(n, init)
goto ret
n.Addable = 1
goto ret
- case OCLOSUREVAR,
- OCFUNC:
+ case OCLOSUREVAR, OCFUNC:
n.Addable = 1
goto ret
p := ""
if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing.
switch Simsimtype(t.Down) {
- case TINT32,
- TUINT32:
+ case TINT32, TUINT32:
p = "mapaccess2_fast32"
- case TINT64,
- TUINT64:
+ case TINT64, TUINT64:
p = "mapaccess2_fast64"
case TSTRING:
walkexpr(&n, init)
goto ret
- case OCONV,
- OCONVNOP:
+ case OCONV, OCONVNOP:
if Thearch.Thechar == '5' {
if Isfloat[n.Left.Type.Etype] {
if n.Type.Etype == TINT64 {
walkmul(&n, init)
goto ret
- case ODIV,
- OMOD:
+ case ODIV, OMOD:
walkexpr(&n.Left, init)
walkexpr(&n.Right, init)
* on 32-bit architectures.
*/
switch n.Op {
- case OMOD,
- ODIV:
+ case OMOD, ODIV:
if Widthreg >= 8 || (et != TUINT64 && et != TINT64) {
goto ret
}
p := ""
if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing.
switch Simsimtype(t.Down) {
- case TINT32,
- TUINT32:
+ case TINT32, TUINT32:
p = "mapaccess1_fast32"
- case TINT64,
- TUINT64:
+ case TINT64, TUINT64:
p = "mapaccess1_fast64"
case TSTRING:
fallthrough
// fallthrough
- case OSLICEARR,
- OSLICESTR:
+ case OSLICEARR, OSLICESTR:
if n.Right == nil { // already processed
goto ret
}
n = sliceany(n, init) // chops n.Right, sets n.List
goto ret
- case OSLICE3,
- OSLICE3ARR:
+ case OSLICE3, OSLICE3ARR:
if n.Right == nil { // already processed
goto ret
}
n = r
goto ret
- case OARRAYLIT,
- OMAPLIT,
- OSTRUCTLIT,
- OPTRLIT:
+ case OARRAYLIT, OMAPLIT, OSTRUCTLIT, OPTRLIT:
var_ := temp(n.Type)
anylit(0, n, var_, init)
n = var_
case ONAME:
switch n.Class {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
return true
}
}
// small compared to the cost of the allocation.)
if r.Reslice {
switch r.Op {
- case OSLICE,
- OSLICE3,
- OSLICESTR,
- OAPPEND:
+ case OSLICE, OSLICE3, OSLICESTR, OAPPEND:
break
default:
case ONAME:
break
- case OINDEX,
- OINDEXMAP:
+ case OINDEX, OINDEXMAP:
reorder3save(&l.Left, all, list, &early)
reorder3save(&l.Right, all, list, &early)
if l.Op == OINDEXMAP {
list.N = convas(list.N, &mapinit)
}
- case OIND,
- ODOTPTR:
+ case OIND, ODOTPTR:
reorder3save(&l.Left, all, list, &early)
}
varwrite = 1
continue
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
if n.Addrtaken {
varwrite = 1
continue
case ONAME:
switch n.Class {
- case PAUTO,
- PPARAM,
- PPARAMOUT:
+ case PAUTO, PPARAM, PPARAMOUT:
if !n.Addrtaken {
return true
}
switch l.Op {
case ONAME:
switch l.Class {
- case PPARAM,
- PPARAMREF,
- PAUTO:
+ case PPARAM, PPARAMREF, PAUTO:
break
// assignment to non-stack variable
case ONAME:
return a == b
- case ODOT,
- ODOTPTR:
+ case ODOT, ODOTPTR:
ar = a.Right
br = b.Right
if ar.Op != ONAME || br.Op != ONAME || ar.Sym != br.Sym {
return
// n1 = nl * magic >> w (HMUL)
- case TUINT8,
- TUINT16,
- TUINT32:
+ case TUINT8, TUINT16, TUINT32:
nc := Nod(OXXX, nil, nil)
Nodconst(nc, nl.Type, int64(m.Um))
default:
return
- case TUINT8,
- TUINT16:
+ case TUINT8, TUINT16:
twide = Types[TUINT32]
case TUINT32:
twide = Types[TUINT64]
- case TINT8,
- TINT16:
+ case TINT8, TINT16:
twide = Types[TINT32]
case TINT32:
}
// n1 = nl * magic >> w
- case TINT8,
- TINT16,
- TINT32:
+ case TINT8, TINT16, TINT32:
nc := Nod(OXXX, nil, nil)
Nodconst(nc, nl.Type, m.Sm)
default:
Fatal("usefield %v", Oconv(int(n.Op), 0))
- case ODOT,
- ODOTPTR:
+ case ODOT, ODOTPTR:
break
}
break
// Discardable as long as we know it's not division by zero.
- case ODIV,
- OMOD:
+ case ODIV, OMOD:
if Isconst(n.Right, CTINT) && mpcmpfixc(n.Right.Val.U.Xval, 0) != 0 {
break
}
return false
// Discardable as long as we know it won't fail because of a bad size.
- case OMAKECHAN,
- OMAKEMAP:
+ case OMAKECHAN, OMAKEMAP:
if Isconst(n.Left, CTINT) && mpcmpfixc(n.Left.Val.U.Xval, 0) == 0 {
break
}
}
// r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call.
- case R_CALL,
- R_PCREL:
+ case R_CALL, R_PCREL:
if Linkmode == LinkExternal && r.Sym != nil && r.Sym.Type != SCONST && r.Sym.Sect != Ctxt.Cursym.Sect {
r.Done = 0
default:
return
- case 'd',
- 'b',
- 'D',
- 'B':
+ case 'd', 'b', 'D', 'B':
dv = newdie(&dwglobals, DW_ABRV_VARIABLE, s)
newabslocexprattr(dv, v, sym)
if ver == 0 {
fallthrough
// fallthrough
- case 'a',
- 'p':
+ case 'a', 'p':
dt = defgotype(gotype)
}
*/
func ispubname(die *DWDie) bool {
switch die.abbrev {
- case DW_ABRV_FUNCTION,
- DW_ABRV_VARIABLE:
+ case DW_ABRV_FUNCTION, DW_ABRV_VARIABLE:
a := getattr(die, DW_AT_external)
return a != nil && a.value != 0
}
}
switch eh.machine {
- case EM_X86_64,
- EM_PPC64,
- EM_AARCH64:
+ case EM_X86_64, EM_PPC64, EM_AARCH64:
sh := elfshname(".rela.plt")
sh.type_ = SHT_RELA
sh.flags = SHF_ALLOC
case ElfSymTypeSection:
s = elfobj.sect[sym.shndx].sym
- case ElfSymTypeObject,
- ElfSymTypeFunc,
- ElfSymTypeNone:
+ case ElfSymTypeObject, ElfSymTypeFunc, ElfSymTypeNone:
switch sym.bind {
case ElfSymBindGlobal:
if needSym != 0 {
Diag("%s: unknown relocation type %d;", pn, type_)
fallthrough
- case IMAGE_REL_I386_REL32,
- IMAGE_REL_AMD64_REL32,
+ case IMAGE_REL_I386_REL32, IMAGE_REL_AMD64_REL32,
IMAGE_REL_AMD64_ADDR32, // R_X86_64_PC32
IMAGE_REL_AMD64_ADDR32NB:
rp.Type = R_PCREL
rp.Add = int64(int32(Le32(rsect.base[rp.Off:])))
- case IMAGE_REL_I386_DIR32NB,
- IMAGE_REL_I386_DIR32:
+ case IMAGE_REL_I386_DIR32NB, IMAGE_REL_I386_DIR32:
rp.Type = R_ADDR
// load addend from image
err = fmt.Errorf("%s: invalid symbol type %d", sym.name, sym.type_)
return err
- case IMAGE_SYM_DTYPE_FUNCTION,
- IMAGE_SYM_DTYPE_NULL:
+ case IMAGE_SYM_DTYPE_FUNCTION, IMAGE_SYM_DTYPE_NULL:
switch sym.sclass {
case IMAGE_SYM_CLASS_EXTERNAL: //global
s = Linklookup(Ctxt, name, 0)
- case IMAGE_SYM_CLASS_NULL,
- IMAGE_SYM_CLASS_STATIC,
- IMAGE_SYM_CLASS_LABEL:
+ case IMAGE_SYM_CLASS_NULL, IMAGE_SYM_CLASS_STATIC, IMAGE_SYM_CLASS_LABEL:
s = Linklookup(Ctxt, name, Ctxt.Version)
s.Dupok = 1
case '8':
argv = append(argv, "-m32")
- case '6',
- '9':
+ case '6', '9':
argv = append(argv, "-m64")
case '5':
r = &s.R[ri]
switch r.Type {
// Direct call.
- case R_CALL,
- R_CALLARM,
- R_CALLARM64,
- R_CALLPOWER:
+ case R_CALL, R_CALLARM, R_CALLARM64, R_CALLPOWER:
ch.limit = int(int32(limit) - pcsp.value - int32(callsize()))
ch.sym = r.Sym
}
put(s, s.Name, 'D', Symaddr(s), s.Size, int(s.Version), s.Gotype)
- case SBSS,
- SNOPTRBSS:
+ case SBSS, SNOPTRBSS:
if !s.Reachable {
continue
}
func Machoinit() {
switch Thearch.Thechar {
// 64-bit architectures
- case '6',
- '9':
+ case '6', '9':
macho64 = true
// 32-bit architectures
default:
return
- case 'D',
- 'B',
- 'T':
+ case 'D', 'B', 'T':
break
}
default:
return
- case 'D',
- 'B',
- 'T',
- 'U':
+ case 'D', 'B', 'T', 'U':
break
}
default:
log.Fatalf("unknown thread-local storage offset for %s", Headstr(ctxt.Headtype))
- case Hplan9,
- Hwindows:
+ case Hplan9, Hwindows:
break
/*
func putelfsyment(off int, addr int64, size int64, info int, shndx int, other int) {
switch Thearch.Thechar {
- case '6',
- '7',
- '9':
+ case '6', '7', '9':
Thearch.Lput(uint32(off))
Cput(uint8(info))
Cput(uint8(other))
func putplan9sym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *LSym) {
switch t {
- case 'T',
- 'L',
- 'D',
- 'B':
+ case 'T', 'L', 'D', 'B':
if ver != 0 {
t += 'a' - 'A'
}
}
}
- case AB,
- ABL:
+ case AB, ABL:
if p.To.Type != obj.TYPE_MEM {
if out != nil {
asmout(ctxt, p, o, out)
case C_HFAUTO:
return b == C_HAUTO || b == C_FAUTO
- case C_FAUTO,
- C_HAUTO:
+ case C_FAUTO, C_HAUTO:
return b == C_HFAUTO
case C_SAUTO:
case C_HFOREG:
return b == C_HOREG || b == C_FOREG
- case C_FOREG,
- C_HOREG:
+ case C_FOREG, C_HOREG:
return b == C_HFOREG
case C_SROREG:
return cmp(C_SOREG, b) || cmp(C_ROREG, b)
- case C_SOREG,
- C_ROREG:
+ case C_SOREG, C_ROREG:
return b == C_SROREG || cmp(C_HFOREG, b)
case C_LOREG:
o1 |= (uint32(p.To.Reg) & 1) << 22
o1 |= (uint32(p.From.Reg) & 15) << 0
- case 38,
- 39:
+ case 38, 39:
switch o.type_ {
case 38: /* movm $con,oreg -> stm */
o1 = 0x4 << 25
ctxt.Diag(".nil/.W on dp instruction")
}
switch a {
- case AMULU,
- AMUL:
+ case AMULU, AMUL:
return o | 0x0<<21 | 0x9<<4
case AMULA:
return o | 0x1<<21 | 0x9<<4
case AORR:
return o | 0xc<<21
- case AMOVB,
- AMOVH,
- AMOVW:
+ case AMOVB, AMOVH, AMOVW:
return o | 0xd<<21
case ABIC:
return o | 0xe<<21
case obj.ARET:
break
- case ADIV,
- ADIVU,
- AMOD,
- AMODU:
+ case ADIV, ADIVU, AMOD, AMODU:
q = p
if ctxt.Sym_div == nil {
initdiv(ctxt)
p.Spadj = int32(p.From.Offset)
}
- case ADIV,
- ADIVU,
- AMOD,
- AMODU:
+ case ADIV, ADIVU, AMOD, AMODU:
if ctxt.Debugdivmod != 0 {
break
}
case ATBZ:
oprange[ATBNZ] = t
- case AADR,
- AADRP:
+ case AADR, AADRP:
break
case ACLREX:
case AFCSELD:
oprange[AFCSELS] = t
- case AFMOVS,
- AFMOVD:
+ case AFMOVS, AFMOVD:
break
case AFCVTZSD:
oprange[AIC] = t
oprange[ATLBI] = t
- case ASYSL,
- AHINT:
+ case ASYSL, AHINT:
break
case ADMB:
oprange[ADSB] = t
oprange[AISB] = t
- case AMRS,
- AMSR:
+ case AMRS, AMSR:
break
case ALDAR:
as = AMOVWU /* clearer in disassembly */
}
switch as {
- case AMOVB,
- ASXTB:
+ case AMOVB, ASXTB:
o1 = opbfm(ctxt, ASBFM, 0, 7, rf, rt)
- case AMOVH,
- ASXTH:
+ case AMOVH, ASXTH:
o1 = opbfm(ctxt, ASBFM, 0, 15, rf, rt)
- case AMOVW,
- ASXTW:
+ case AMOVW, ASXTW:
o1 = opbfm(ctxt, ASBFM, 0, 31, rf, rt)
- case AMOVBU,
- AUXTB:
+ case AMOVBU, AUXTB:
o1 = opbfm(ctxt, AUBFM, 0, 7, rf, rt)
- case AMOVHU,
- AUXTH:
+ case AMOVHU, AUXTH:
o1 = opbfm(ctxt, AUBFM, 0, 15, rf, rt)
case AMOVWU:
case AADCSW:
return S32 | 0<<30 | 1<<29 | 0xd0<<21 | 0<<10
- case ANGC,
- ASBC:
+ case ANGC, ASBC:
return S64 | 1<<30 | 0<<29 | 0xd0<<21 | 0<<10
- case ANGCS,
- ASBCS:
+ case ANGCS, ASBCS:
return S64 | 1<<30 | 1<<29 | 0xd0<<21 | 0<<10
- case ANGCW,
- ASBCW:
+ case ANGCW, ASBCW:
return S32 | 1<<30 | 0<<29 | 0xd0<<21 | 0<<10
- case ANGCSW,
- ASBCSW:
+ case ANGCSW, ASBCSW:
return S32 | 1<<30 | 1<<29 | 0xd0<<21 | 0<<10
case AADD:
case AADDW:
return S32 | 0<<30 | 0<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
- case ACMN,
- AADDS:
+ case ACMN, AADDS:
return S64 | 0<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
- case ACMNW,
- AADDSW:
+ case ACMNW, AADDSW:
return S32 | 0<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
case ASUB:
case ASUBW:
return S32 | 1<<30 | 0<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
- case ACMP,
- ASUBS:
+ case ACMP, ASUBS:
return S64 | 1<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
- case ACMPW,
- ASUBSW:
+ case ACMPW, ASUBSW:
return S32 | 1<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 0<<21 | 0<<10
case AAND:
case AANDW:
return S32 | 0<<29 | 0xA<<24
- case AMOVD,
- AORR:
+ case AMOVD, AORR:
return S64 | 1<<29 | 0xA<<24
// case AMOVW:
- case AMOVWU,
- AORRW:
+ case AMOVWU, AORRW:
return S32 | 1<<29 | 0xA<<24
case AEOR:
case AEONW:
return S32 | 2<<29 | 0xA<<24 | 1<<21
- case AMVN,
- AORN:
+ case AMVN, AORN:
return S64 | 1<<29 | 0xA<<24 | 1<<21
- case AMVNW,
- AORNW:
+ case AMVNW, AORNW:
return S32 | 1<<29 | 0xA<<24 | 1<<21
case AASR:
case ACSETMW:
return S32 | 1<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 0<<10
- case ACINC,
- ACSINC:
+ case ACINC, ACSINC:
return S64 | 0<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 1<<10
- case ACINCW,
- ACSINCW:
+ case ACINCW, ACSINCW:
return S32 | 0<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 1<<10
- case ACINV,
- ACSINV:
+ case ACINV, ACSINV:
return S64 | 1<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 0<<10
- case ACINVW,
- ACSINVW:
+ case ACINVW, ACSINVW:
return S32 | 1<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 0<<10
- case ACNEG,
- ACSNEG:
+ case ACNEG, ACSNEG:
return S64 | 1<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 1<<10
- case ACNEGW,
- ACSNEGW:
+ case ACNEGW, ACSNEGW:
return S32 | 1<<30 | 0<<29 | 0xD4<<21 | 0<<11 | 1<<10
- case AMUL,
- AMADD:
+ case AMUL, AMADD:
return S64 | 0<<29 | 0x1B<<24 | 0<<21 | 0<<15
- case AMULW,
- AMADDW:
+ case AMULW, AMADDW:
return S32 | 0<<29 | 0x1B<<24 | 0<<21 | 0<<15
- case AMNEG,
- AMSUB:
+ case AMNEG, AMSUB:
return S64 | 0<<29 | 0x1B<<24 | 0<<21 | 1<<15
- case AMNEGW,
- AMSUBW:
+ case AMNEGW, AMSUBW:
return S32 | 0<<29 | 0x1B<<24 | 0<<21 | 1<<15
case AMRS:
case ANEGSW:
return S32 | 1<<30 | 1<<29 | 0xB<<24 | 0<<21
- case AREM,
- ASDIV:
+ case AREM, ASDIV:
return S64 | OPDP2(3)
- case AREMW,
- ASDIVW:
+ case AREMW, ASDIVW:
return S32 | OPDP2(3)
- case ASMULL,
- ASMADDL:
+ case ASMULL, ASMADDL:
return OPDP3(1, 0, 1, 0)
- case ASMNEGL,
- ASMSUBL:
+ case ASMNEGL, ASMSUBL:
return OPDP3(1, 0, 1, 1)
case ASMULH:
return OPDP3(1, 0, 2, 0)
- case AUMULL,
- AUMADDL:
+ case AUMULL, AUMADDL:
return OPDP3(1, 0, 5, 0)
- case AUMNEGL,
- AUMSUBL:
+ case AUMNEGL, AUMSUBL:
return OPDP3(1, 0, 5, 1)
case AUMULH:
return OPDP3(1, 0, 6, 0)
- case AUREM,
- AUDIV:
+ case AUREM, AUDIV:
return S64 | OPDP2(2)
- case AUREMW,
- AUDIVW:
+ case AUREMW, AUDIVW:
return S32 | OPDP2(2)
case AAESE:
func opirr(ctxt *obj.Link, a int) uint32 {
switch a {
/* op $addcon, Rn, Rd */
- case AMOVD,
- AADD:
+ case AMOVD, AADD:
return S64 | 0<<30 | 0<<29 | 0x11<<24
- case ACMN,
- AADDS:
+ case ACMN, AADDS:
return S64 | 0<<30 | 1<<29 | 0x11<<24
- case AMOVW,
- AADDW:
+ case AMOVW, AADDW:
return S32 | 0<<30 | 0<<29 | 0x11<<24
- case ACMNW,
- AADDSW:
+ case ACMNW, AADDSW:
return S32 | 0<<30 | 1<<29 | 0x11<<24
case ASUB:
return S64 | 1<<30 | 0<<29 | 0x11<<24
- case ACMP,
- ASUBS:
+ case ACMP, ASUBS:
return S64 | 1<<30 | 1<<29 | 0x11<<24
case ASUBW:
return S32 | 1<<30 | 0<<29 | 0x11<<24
- case ACMPW,
- ASUBSW:
+ case ACMPW, ASUBSW:
return S32 | 1<<30 | 1<<29 | 0x11<<24
/* op $imm(SB), Rd; op label, Rd */
case AADDW:
return S32 | 0<<30 | 0<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_32
- case ACMN,
- AADDS:
+ case ACMN, AADDS:
return S64 | 0<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_64
- case ACMNW,
- AADDSW:
+ case ACMNW, AADDSW:
return S32 | 0<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_32
case ASUB:
case ASUBW:
return S32 | 1<<30 | 0<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_32
- case ACMP,
- ASUBS:
+ case ACMP, ASUBS:
return S64 | 1<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_64
- case ACMPW,
- ASUBSW:
+ case ACMPW, ASUBSW:
return S32 | 1<<30 | 1<<29 | 0x0b<<24 | 0<<22 | 1<<21 | LSL0_32
}
w = 2 /* sign extend */
}
- case AMOVB,
- AMOVH,
- AMOVW:
+ case AMOVB, AMOVH, AMOVW:
w = 2 /* 32 bit, sign-extended to 64 */
break
}
case AMOVD:
return 3
- case AMOVW,
- AMOVWU:
+ case AMOVW, AMOVWU:
return 2
- case AMOVH,
- AMOVHU:
+ case AMOVH, AMOVHU:
return 1
- case AMOVB,
- AMOVBU:
+ case AMOVB, AMOVBU:
return 0
case AFMOVS:
p.To.Reg = REGLINK
p.Spadj = +ctxt.Autosize
- case AADD,
- ASUB:
+ case AADD, ASUB:
if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.From.Type == obj.TYPE_CONST {
if p.As == AADD {
p.Spadj = int32(-p.From.Offset)
}
return
- case TYPE_FCONST,
- TYPE_SCONST:
+ case TYPE_FCONST, TYPE_SCONST:
if a.Reg != 0 || a.Index != 0 || a.Scale != 0 || a.Name != 0 || a.Offset != 0 || a.Sym != nil {
break
}
maskgen64(ctxt, p, mask[:], uint64(d))
var a int
switch p.As {
- case ARLDCL,
- ARLDCLCC:
+ case ARLDCL, ARLDCLCC:
a = int(mask[0]) /* MB */
if mask[1] != 63 {
ctxt.Diag("invalid mask for rotate: %x (end != bit 63)\n%v", uint64(d), p)
}
- case ARLDCR,
- ARLDCRCC:
+ case ARLDCR, ARLDCRCC:
a = int(mask[1]) /* ME */
if mask[0] != 0 {
ctxt.Diag("invalid mask for rotate: %x (start != 0)\n%v", uint64(d), p)
}
var a int
switch p.As {
- case ASLD,
- ASLDCC:
+ case ASLD, ASLDCC:
a = int(63 - v)
o1 = OP_RLDICR
- case ASRD,
- ASRDCC:
+ case ASRD, ASRDCC:
a = int(v)
v = 64 - v
o1 = OP_RLDICL
maskgen64(ctxt, p, mask[:], uint64(d))
var a int
switch p.As {
- case ARLDC,
- ARLDCCC:
+ case ARLDC, ARLDCCC:
a = int(mask[0]) /* MB */
if int32(mask[1]) != (63 - v) {
ctxt.Diag("invalid mask for shift: %x (shift %d)\n%v", uint64(d), v, p)
}
- case ARLDCL,
- ARLDCLCC:
+ case ARLDCL, ARLDCLCC:
a = int(mask[0]) /* MB */
if mask[1] != 63 {
ctxt.Diag("invalid mask for shift: %x (shift %d)\n%v", uint64(d), v, p)
}
- case ARLDCR,
- ARLDCRCC:
+ case ARLDCR, ARLDCRCC:
a = int(mask[1]) /* ME */
if mask[0] != 0 {
ctxt.Diag("invalid mask for shift: %x (shift %d)\n%v", uint64(d), v, p)
case ADCBZ:
return int32(OPVCC(31, 1014, 0, 0))
- case AREM,
- ADIVW:
+ case AREM, ADIVW:
return int32(OPVCC(31, 491, 0, 0))
- case AREMCC,
- ADIVWCC:
+ case AREMCC, ADIVWCC:
return int32(OPVCC(31, 491, 0, 1))
- case AREMV,
- ADIVWV:
+ case AREMV, ADIVWV:
return int32(OPVCC(31, 491, 1, 0))
- case AREMVCC,
- ADIVWVCC:
+ case AREMVCC, ADIVWVCC:
return int32(OPVCC(31, 491, 1, 1))
- case AREMU,
- ADIVWU:
+ case AREMU, ADIVWU:
return int32(OPVCC(31, 459, 0, 0))
- case AREMUCC,
- ADIVWUCC:
+ case AREMUCC, ADIVWUCC:
return int32(OPVCC(31, 459, 0, 1))
- case AREMUV,
- ADIVWUV:
+ case AREMUV, ADIVWUV:
return int32(OPVCC(31, 459, 1, 0))
- case AREMUVCC,
- ADIVWUVCC:
+ case AREMUVCC, ADIVWUVCC:
return int32(OPVCC(31, 459, 1, 1))
- case AREMD,
- ADIVD:
+ case AREMD, ADIVD:
return int32(OPVCC(31, 489, 0, 0))
- case AREMDCC,
- ADIVDCC:
+ case AREMDCC, ADIVDCC:
return int32(OPVCC(31, 489, 0, 1))
- case AREMDV,
- ADIVDV:
+ case AREMDV, ADIVDV:
return int32(OPVCC(31, 489, 1, 0))
- case AREMDVCC,
- ADIVDVCC:
+ case AREMDVCC, ADIVDVCC:
return int32(OPVCC(31, 489, 1, 1))
- case AREMDU,
- ADIVDU:
+ case AREMDU, ADIVDU:
return int32(OPVCC(31, 457, 0, 0))
- case AREMDUCC,
- ADIVDUCC:
+ case AREMDUCC, ADIVDUCC:
return int32(OPVCC(31, 457, 0, 1))
- case AREMDUV,
- ADIVDUV:
+ case AREMDUV, ADIVDUV:
return int32(OPVCC(31, 457, 1, 0))
- case AREMDUVCC,
- ADIVDUVCC:
+ case AREMDUVCC, ADIVDUVCC:
return int32(OPVCC(31, 457, 1, 1))
case AEIEIO:
case AFMADDSCC:
return int32(OPVCC(59, 29, 0, 1))
- case AFMOVS,
- AFMOVD:
+ case AFMOVS, AFMOVD:
return int32(OPVCC(63, 72, 0, 0)) /* load */
case AFMOVDCC:
return int32(OPVCC(63, 72, 0, 1))
return int32(OPVCC(58, 0, 0, 0) | 1<<1) /* lwa */
/* no AMOVWU */
- case AMOVB,
- AMOVBZ:
+ case AMOVB, AMOVBZ:
return int32(OPVCC(34, 0, 0, 0))
/* load */
- case AMOVBU,
- AMOVBZU:
+ case AMOVBU, AMOVBZU:
return int32(OPVCC(35, 0, 0, 0))
case AFMOVD:
return int32(OPVCC(50, 0, 0, 0))
case AMOVWU:
return int32(OPVCC(31, 373, 0, 0)) /* lwaux */
- case AMOVB,
- AMOVBZ:
+ case AMOVB, AMOVBZ:
return int32(OPVCC(31, 87, 0, 0)) /* lbzx */
- case AMOVBU,
- AMOVBZU:
+ case AMOVBU, AMOVBZU:
return int32(OPVCC(31, 119, 0, 0)) /* lbzux */
case AFMOVD:
return int32(OPVCC(31, 599, 0, 0)) /* lfdx */
*/
func opstore(ctxt *obj.Link, a int) int32 {
switch a {
- case AMOVB,
- AMOVBZ:
+ case AMOVB, AMOVBZ:
return int32(OPVCC(38, 0, 0, 0)) /* stb */
- case AMOVBU,
- AMOVBZU:
+ case AMOVBU, AMOVBZU:
return int32(OPVCC(39, 0, 0, 0)) /* stbu */
case AFMOVD:
return int32(OPVCC(54, 0, 0, 0)) /* stfd */
case AFMOVSU:
return int32(OPVCC(53, 0, 0, 0)) /* stfsu */
- case AMOVHZ,
- AMOVH:
+ case AMOVHZ, AMOVH:
return int32(OPVCC(44, 0, 0, 0)) /* sth */
- case AMOVHZU,
- AMOVHU:
+ case AMOVHZU, AMOVHU:
return int32(OPVCC(45, 0, 0, 0)) /* sthu */
case AMOVMW:
return int32(OPVCC(47, 0, 0, 0)) /* stmw */
case ASTSW:
return int32(OPVCC(31, 725, 0, 0)) /* stswi */
- case AMOVWZ,
- AMOVW:
+ case AMOVWZ, AMOVW:
return int32(OPVCC(36, 0, 0, 0)) /* stw */
- case AMOVWZU,
- AMOVWU:
+ case AMOVWZU, AMOVWU:
return int32(OPVCC(37, 0, 0, 0)) /* stwu */
case AMOVD:
return int32(OPVCC(62, 0, 0, 0)) /* std */
*/
func opstorex(ctxt *obj.Link, a int) int32 {
switch a {
- case AMOVB,
- AMOVBZ:
+ case AMOVB, AMOVBZ:
return int32(OPVCC(31, 215, 0, 0)) /* stbx */
- case AMOVBU,
- AMOVBZU:
+ case AMOVBU, AMOVBZU:
return int32(OPVCC(31, 247, 0, 0)) /* stbux */
case AFMOVD:
return int32(OPVCC(31, 727, 0, 0)) /* stfdx */
case AFMOVSU:
return int32(OPVCC(31, 695, 0, 0)) /* stfsux */
- case AMOVHZ,
- AMOVH:
+ case AMOVHZ, AMOVH:
return int32(OPVCC(31, 407, 0, 0)) /* sthx */
case AMOVHBR:
return int32(OPVCC(31, 918, 0, 0)) /* sthbrx */
- case AMOVHZU,
- AMOVHU:
+ case AMOVHZU, AMOVHU:
return int32(OPVCC(31, 439, 0, 0)) /* sthux */
- case AMOVWZ,
- AMOVW:
+ case AMOVWZ, AMOVW:
return int32(OPVCC(31, 151, 0, 0)) /* stwx */
- case AMOVWZU,
- AMOVWU:
+ case AMOVWZU, AMOVWU:
return int32(OPVCC(31, 183, 0, 0)) /* stwux */
case ASTSW:
return int32(OPVCC(31, 661, 0, 0)) /* stswx */
p.Mark |= LABEL | SYNC
continue
- case AMOVW,
- AMOVWZ,
- AMOVD:
+ case AMOVW, AMOVWZ, AMOVD:
q = p
if p.From.Reg >= REG_SPECIAL || p.To.Reg >= REG_SPECIAL {
p.Mark |= LABEL | SYNC
}
continue
- case AFCMPO,
- AFCMPU:
+ case AFCMPO, AFCMPU:
q = p
p.Mark |= FCMP | FLOAT
continue
default:
log.Fatalf("unknown thread-local storage offset for %s", Headstr(ctxt.Headtype))
- case Hplan9,
- Hwindows:
+ case Hplan9, Hwindows:
break
/*
case REG_CX:
return Ycx
- case REG_DX,
- REG_BX:
+ case REG_DX, REG_BX:
return Yrx
case REG_R8, /* not really Yrl */
}
fallthrough
- case REG_SP,
- REG_BP,
- REG_SI,
- REG_DI:
+ case REG_SP, REG_BP, REG_SI, REG_DI:
if p.Mode == 32 {
return Yrl32
}
func isax(a *obj.Addr) bool {
switch a.Reg {
- case REG_AX,
- REG_AL,
- REG_AH:
+ case REG_AX, REG_AL, REG_AH:
return true
}
func mediaop(ctxt *obj.Link, o *Optab, op int, osize int, z int) int {
switch op {
- case Pm,
- Pe,
- Pf2,
- Pf3:
+ case Pm, Pe, Pf2, Pf3:
if osize != 1 {
if op != Pm {
ctxt.Andptr[0] = byte(op)
ctxt.Andptr[0] = byte(vaddr(ctxt, p, &p.From, nil))
ctxt.Andptr = ctxt.Andptr[1:]
- case Z_ib,
- Zib_:
+ case Z_ib, Zib_:
if yt.zcase == Zib_ {
a = &p.From
} else {
ctxt.Andptr[0] = byte(vaddr(ctxt, p, &p.From, nil))
ctxt.Andptr = ctxt.Andptr[1:]
- case Z_il,
- Zil_:
+ case Z_il, Zil_:
if yt.zcase == Zil_ {
a = &p.From
} else {
relput4(ctxt, p, a)
}
- case Zm_ilo,
- Zilo_m:
+ case Zm_ilo, Zilo_m:
ctxt.Andptr[0] = byte(op)
ctxt.Andptr = ctxt.Andptr[1:]
if yt.zcase == Zilo_m {
}
// TODO: jump across functions needs reloc
- case Zbr,
- Zjmp,
- Zloop:
+ case Zbr, Zjmp, Zloop:
if p.To.Sym != nil {
if yt.zcase != Zjmp {
ctxt.Diag("branch to ATEXT")
cand = 0
cana = cand
- case REG_AX,
- REG_AL,
- REG_AH:
+ case REG_AX, REG_AL, REG_AH:
cana = 0
- case REG_BX,
- REG_BL,
- REG_BH:
+ case REG_BX, REG_BL, REG_BH:
canb = 0
- case REG_CX,
- REG_CL,
- REG_CH:
+ case REG_CX, REG_CL, REG_CH:
canc = 0
- case REG_DX,
- REG_DL,
- REG_DH:
+ case REG_DX, REG_DL, REG_DH:
cand = 0
}
}
copy(ctxt.Andptr, naclstos)
ctxt.Andptr = ctxt.Andptr[len(naclstos):]
- case AMOVSB,
- AMOVSW,
- AMOVSL,
- AMOVSQ:
+ case AMOVSB, AMOVSW, AMOVSL, AMOVSQ:
copy(ctxt.Andptr, naclmovs)
ctxt.Andptr = ctxt.Andptr[len(naclmovs):]
}
if a.Type == obj.TYPE_MEM && a.Name == obj.NAME_NONE {
switch a.Reg {
// all ok
- case REG_BP,
- REG_SP,
- REG_R15:
+ case REG_BP, REG_SP, REG_R15:
break
default:
default:
continue
- case APUSHL,
- APUSHFL:
+ case APUSHL, APUSHFL:
deltasp += 4
p.Spadj = 4
continue
- case APUSHQ,
- APUSHFQ:
+ case APUSHQ, APUSHFQ:
deltasp += 8
p.Spadj = 8
continue
- case APUSHW,
- APUSHFW:
+ case APUSHW, APUSHFW:
deltasp += 2
p.Spadj = 2
continue
- case APOPL,
- APOPFL:
+ case APOPL, APOPFL:
deltasp -= 4
p.Spadj = -4
continue
- case APOPQ,
- APOPFQ:
+ case APOPQ, APOPFQ:
deltasp -= 8
p.Spadj = -8
continue
- case APOPW,
- APOPFW:
+ case APOPW, APOPFW:
deltasp -= 2
p.Spadj = -2
continue