本文整理匯總了Golang中code/google/com/p/rsc/c2go/liblink.Prog.Scond方法的典型用法代碼示例。如果您正苦於以下問題:Golang Prog.Scond方法的具體用法?Golang Prog.Scond怎麽用?Golang Prog.Scond使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/google/com/p/rsc/c2go/liblink.Prog
的用法示例。
在下文中一共展示了Prog.Scond方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: readprog
func readprog(b *bufio.Reader, p *liblink.Prog) {
if !undef[p] {
panic("double-def")
}
delete(undef, p)
p.Pc = rdint(b)
p.Lineno = int(rdint(b))
p.Link = rdprog(b)
p.As = int(rdint(b))
p.Reg = int(rdint(b))
p.Scond = int(rdint(b))
p.Width = int8(rdint(b))
readaddr(b, &p.From)
readaddr(b, &p.To)
}
示例2: stacksplit
func stacksplit(ctxt *liblink.Link, p *liblink.Prog, framesize int64, noctxt int) *liblink.Prog {
var arg int
// MOVW g_stackguard(g), R1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_OREG
p.From.Reg = REGG
p.To.Typ = D_REG
p.To.Reg = 1
if framesize <= liblink.StackSmall {
// small stack: SP < stackguard
// CMP stackguard, SP
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_REG
p.From.Reg = 1
p.Reg = REGSP
} else if framesize <= liblink.StackBig {
// large stack: SP-framesize < stackguard-StackSmall
// MOVW $-framesize(SP), R2
// CMP stackguard, R2
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = REGSP
p.From.Offset = -framesize
p.To.Typ = D_REG
p.To.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_REG
p.From.Reg = 1
p.Reg = 2
} else {
// Such a large stack we need to protect against wraparound
// if SP is close to zero.
// SP-stackguard+StackGuard < framesize + (StackGuard-StackSmall)
// The +StackGuard on both sides is required to keep the left side positive:
// SP is allowed to be slightly below stackguard. See stack.h.
// CMP $StackPreempt, R1
// MOVW.NE $StackGuard(SP), R2
// SUB.NE R1, R2
// MOVW.NE $(framesize+(StackGuard-StackSmall)), R3
// CMP.NE R3, R2
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_CONST
p.From.Offset = int64(uint32(liblink.StackPreempt & 0xFFFFFFFF))
p.Reg = 1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = REGSP
p.From.Offset = liblink.StackGuard
p.To.Typ = D_REG
p.To.Reg = 2
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = ASUB
p.From.Typ = D_REG
p.From.Reg = 1
p.To.Typ = D_REG
p.To.Reg = 2
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Offset = framesize + (liblink.StackGuard - liblink.StackSmall)
p.To.Typ = D_REG
p.To.Reg = 3
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_REG
p.From.Reg = 3
p.Reg = 2
p.Scond = C_SCOND_NE
}
// MOVW.LS $framesize, R1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.Scond = C_SCOND_LS
p.From.Typ = D_CONST
p.From.Offset = framesize
p.To.Typ = D_REG
p.To.Reg = 1
// MOVW.LS $args, R2
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.Scond = C_SCOND_LS
p.From.Typ = D_CONST
arg = ctxt.Cursym.Text.To.Offset2
if arg == 1 { // special marker for known 0
arg = 0
}
if arg&3 != 0 {
ctxt.Diag("misaligned argument size in stack split")
}
p.From.Offset = int64(arg)
p.To.Typ = D_REG
//.........這裏部分代碼省略.........
示例3: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var pl *liblink.Prog
var q *liblink.Prog
var q1 *liblink.Prog
var q2 *liblink.Prog
var o int
var autosize int64
var autoffset int64
autosize = 0
if ctxt.Symmorestack[0] == nil {
ctxt.Symmorestack[0] = liblink.Linklookup(ctxt, "runtime.morestack", 0)
ctxt.Symmorestack[1] = liblink.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
}
q = nil
ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil {
return
}
softfloat(ctxt, cursym)
p = cursym.Text
autoffset = p.To.Offset
if autoffset < 0 {
autoffset = 0
}
cursym.Locals = autoffset
cursym.Args = p.To.Offset2
if ctxt.Debugzerostack != 0 {
if autoffset != 0 && p.Reg&liblink.NOSPLIT == 0 {
// MOVW $4(R13), R1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = 13
p.From.Offset = 4
p.To.Typ = D_REG
p.To.Reg = 1
// MOVW $n(R13), R2
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = 13
p.From.Offset = 4 + autoffset
p.To.Typ = D_REG
p.To.Reg = 2
// MOVW $0, R3
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Offset = 0
p.To.Typ = D_REG
p.To.Reg = 3
// L:
// MOVW.nil R3, 0(R1) +4
// CMP R1, R2
// BNE L
pl = liblink.Appendp(ctxt, p)
p = pl
p.As = AMOVW
p.From.Typ = D_REG
p.From.Reg = 3
p.To.Typ = D_OREG
p.To.Reg = 1
p.To.Offset = 4
p.Scond |= C_PBIT
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_REG
p.From.Reg = 1
p.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ABNE
p.To.Typ = D_BRANCH
p.Pcond = pl
}
}
/*
* find leaf subroutines
* strip NOPs
* expand RET
* expand BECOME pseudo
*/
for p = cursym.Text; p != nil; p = p.Link {
switch p.As {
case ACASE:
if ctxt.Flag_shared != 0 {
linkcase(p)
}
case ATEXT:
p.Mark |= LEAF
case ARET:
break
case ADIV,
ADIVU,
AMOD,
AMODU:
q = p
if ctxt.Sym_div == nil {
initdiv(ctxt)
}
//.........這裏部分代碼省略.........