block = d.Block
}
-func poptodcl() {
- // pop the old marker and push a new one
- // (cannot reuse the existing one)
- // because we use the markers to identify blocks
- // for the goto restriction checks.
- popdcl()
-
- markdcl()
-}
-
func markdcl() {
d := push()
d.Name = "" // used as a mark in fifo
return x + 1
}
-func satAdd8(x, y int8) int8 {
- z := x + y
- if x^y < 0 || x^z >= 0 {
- return z
- }
- if x < 0 {
- return -128
- }
- return 127
-}
-
func min8(a, b int8) int8 {
if a < b {
return a
// something whose address is returned -- but that implies stored into the heap,
// hence EscHeap, which means that the details are not currently relevant. )
const (
- bitsPerOutputInTag = 3 // For each output, the number of bits for a tag
- bitsMaskForTag = uint16(1<<bitsPerOutputInTag) - 1 // The bit mask to extract a single tag.
- outputsPerTag = (16 - EscReturnBits) / bitsPerOutputInTag // The number of outputs that can be tagged.
- maxEncodedLevel = int(bitsMaskForTag - 1) // The largest level that can be stored in a tag.
+ bitsPerOutputInTag = 3 // For each output, the number of bits for a tag
+ bitsMaskForTag = uint16(1<<bitsPerOutputInTag) - 1 // The bit mask to extract a single tag.
+ maxEncodedLevel = int(bitsMaskForTag - 1) // The largest level that can be stored in a tag.
)
type EscState struct {
var nblank *Node
-var hunk string
-
-var nhunk int32
-
-var thunk int32
-
var Funcdepth int32
var typecheckok bool
return duintxx(s, off, uint64(v), 4)
}
-func duint64(s *Sym, off int, v uint64) int {
- return duintxx(s, off, v, 8)
-}
-
func duintptr(s *Sym, off int, v uint64) int {
return duintxx(s, off, v, Widthptr)
}
duintxx(nam.Sym, off, uint64(len), Widthint)
}
-func dstringptr(s *Sym, off int, str string) int {
- off = int(Rnd(int64(off), int64(Widthptr)))
- p := Thearch.Gins(obj.ADATA, nil, nil)
- p.From.Type = obj.TYPE_MEM
- p.From.Name = obj.NAME_EXTERN
- p.From.Sym = Linksym(s)
- p.From.Offset = int64(off)
- p.From3 = new(obj.Addr)
- p.From3.Type = obj.TYPE_CONST
- p.From3.Offset = int64(Widthptr)
-
- Datastring(str+"\x00", &p.To) // TODO(rsc): Remove NUL
- p.To.Type = obj.TYPE_ADDR
- p.To.Etype = Simtype[TINT]
- off += Widthptr
-
- return off
-}
-
func Datastring(s string, a *obj.Addr) {
_, symdata := stringsym(s)
a.Type = obj.TYPE_MEM
livepointers []Bvec
}
-func xmalloc(size uint32) interface{} {
- result := (interface{})(make([]byte, size))
- if result == nil {
- Fatalf("malloc failed")
- }
- return result
-}
-
// Constructs a new basic block containing a single instruction.
func newblock(prog *obj.Prog) *BasicBlock {
if prog == nil {
return result
}
-// Frees a basic block and all of its leaf data structures.
-func freeblock(bb *BasicBlock) {
- if bb == nil {
- Fatalf("freeblock: cannot free nil")
- }
-}
-
// Adds an edge between two basic blocks by making from a predecessor of to and
// to a successor of from.
func addedge(from *BasicBlock, to *BasicBlock) {
}
}
-func gethunk() {
- nh := int32(NHUNK)
- if thunk >= 10*NHUNK {
- nh = 10 * NHUNK
- }
- h := string(make([]byte, nh))
- if h == "" {
- Flusherrors()
- Yyerror("out of memory")
- errorexit()
- }
-
- hunk = h
- nhunk = nh
- thunk += nh
-}
-
func Nod(op int, nleft *Node, nright *Node) *Node {
n := new(Node)
n.Op = uint8(op)
return copyexpr(n, n.Type, init)
}
-/*
- * return n in a local variable of type t if it is not already.
- * the value is guaranteed not to change except by direct
- * assignment to it.
- */
-func localexpr(n *Node, t *Type, init **NodeList) *Node {
- if n.Op == ONAME && (!n.Addrtaken || strings.HasPrefix(n.Sym.Name, "autotmp_")) && (n.Class == PAUTO || n.Class == PPARAM || n.Class == PPARAMOUT) && convertop(n.Type, t, nil) == OCONVNOP {
- return n
- }
-
- return copyexpr(n, t, init)
-}
-
func Setmaxarg(t *Type, extra int32) {
dowidth(t)
w := t.Argwid
import (
"cmd/internal/obj"
- "fmt"
"sort"
"strconv"
)
// sort by ordinal
return c1.ordinal < c2.ordinal
}
-
-func dumpcase(cc []*caseClause) {
- for _, c := range cc {
- switch c.typ {
- case caseKindDefault:
- fmt.Printf("case-default\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
-
- case caseKindExprConst:
- fmt.Printf("case-exprconst\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
-
- case caseKindExprVar:
- fmt.Printf("case-exprvar\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
- fmt.Printf("\top=%v\n", Oconv(int(c.node.Left.Op), 0))
-
- case caseKindTypeNil:
- fmt.Printf("case-typenil\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
-
- case caseKindTypeConst:
- fmt.Printf("case-typeconst\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
- fmt.Printf("\thash=%x\n", c.hash)
-
- case caseKindTypeVar:
- fmt.Printf("case-typevar\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
-
- default:
- fmt.Printf("case-???\n")
- fmt.Printf("\tord=%d\n", c.ordinal)
- fmt.Printf("\top=%v\n", Oconv(int(c.node.Left.Op), 0))
- fmt.Printf("\thash=%x\n", c.hash)
- }
- }
-
- fmt.Printf("\n")
-}
// TODO(rsc): Perhaps componentgen should run before this.
-var applywritebarrier_bv Bvec
-
func applywritebarrier(n *Node, init **NodeList) *Node {
if n.Left != nil && n.Right != nil && needwritebarrier(n.Left, n.Right) {
if Debug_wb > 1 {