本文整理汇总了Golang中rsc/io/tmp/slowgc/liblink.Prog.Reg方法的典型用法代码示例。如果您正苦于以下问题:Golang Prog.Reg方法的具体用法?Golang Prog.Reg怎么用?Golang Prog.Reg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rsc/io/tmp/slowgc/liblink.Prog
的用法示例。
在下文中一共展示了Prog.Reg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = int32(rdint(b))
p.Link = rdprog(b)
p.As = int16(rdint(b))
p.Reg = uint8(rdint(b))
p.Scond = uint8(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 int32, noctxt int) *liblink.Prog {
// MOVW g_stackguard(g), R1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Type_ = D_OREG
p.From.Reg = REGG
p.From.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
if ctxt.Cursym.Cfunc != 0 {
p.From.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
}
p.To.Type_ = 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.Type_ = 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.Type_ = D_CONST
p.From.Reg = REGSP
p.From.Offset = int64(-framesize)
p.To.Type_ = D_REG
p.To.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Type_ = 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.Type_ = D_CONST
p.From.Offset = int64(uint32(liblink.StackPreempt & (1<<32 - 1)))
p.Reg = 1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Type_ = D_CONST
p.From.Reg = REGSP
p.From.Offset = liblink.StackGuard
p.To.Type_ = D_REG
p.To.Reg = 2
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = ASUB
p.From.Type_ = D_REG
p.From.Reg = 1
p.To.Type_ = D_REG
p.To.Reg = 2
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Type_ = D_CONST
p.From.Offset = int64(framesize) + (liblink.StackGuard - liblink.StackSmall)
p.To.Type_ = D_REG
p.To.Reg = 3
p.Scond = C_SCOND_NE
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Type_ = D_REG
p.From.Reg = 3
p.Reg = 2
p.Scond = C_SCOND_NE
}
// MOVW.LS R14, R3
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.Scond = C_SCOND_LS
p.From.Type_ = D_REG
p.From.Reg = REGLINK
//.........这里部分代码省略.........
示例3: settextflag
func settextflag(p *liblink.Prog, f int) {
p.Reg = uint8(f)
}
示例4: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var pl *liblink.Prog
var p1 *liblink.Prog
var p2 *liblink.Prog
var q *liblink.Prog
var q1 *liblink.Prog
var q2 *liblink.Prog
var o int
var autosize int32
var autoffset int32
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 = int32(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.Type_ = D_CONST
p.From.Reg = 13
p.From.Offset = 4
p.To.Type_ = D_REG
p.To.Reg = 1
// MOVW $n(R13), R2
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Type_ = D_CONST
p.From.Reg = 13
p.From.Offset = 4 + int64(autoffset)
p.To.Type_ = D_REG
p.To.Reg = 2
// MOVW $0, R3
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Type_ = D_CONST
p.From.Offset = 0
p.To.Type_ = 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.Type_ = D_REG
p.From.Reg = 3
p.To.Type_ = D_OREG
p.To.Reg = 1
p.To.Offset = 4
p.Scond |= C_PBIT
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Type_ = D_REG
p.From.Reg = 1
p.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ABNE
p.To.Type_ = D_BRANCH
p.Pcond = pl
}
}
/*
* find leaf subroutines
* strip NOPs
* expand RET
//.........这里部分代码省略.........
示例5: stacksplit
/*
// instruction scheduling
if(debug['Q'] == 0)
return;
curtext = nil;
q = nil; // p - 1
q1 = firstp; // top of block
o = 0; // count of instructions
for(p = firstp; p != nil; p = p1) {
p1 = p->link;
o++;
if(p->mark & NOSCHED){
if(q1 != p){
sched(q1, q);
}
for(; p != nil; p = p->link){
if(!(p->mark & NOSCHED))
break;
q = p;
}
p1 = p;
q1 = p;
o = 0;
continue;
}
if(p->mark & (LABEL|SYNC)) {
if(q1 != p)
sched(q1, q);
q1 = p;
o = 1;
}
if(p->mark & (BRANCH|SYNC)) {
sched(q1, p);
q1 = p1;
o = 0;
}
if(o >= NSCHED) {
sched(q1, p);
q1 = p1;
o = 0;
}
q = p;
}
*/
func stacksplit(ctxt *liblink.Link, p *liblink.Prog, framesize int32, noctxt int) *liblink.Prog {
var q *liblink.Prog
var q1 *liblink.Prog
// MOVD g_stackguard(g), R3
p = liblink.Appendp(ctxt, p)
p.As = AMOVD
p.From.Type_ = D_OREG
p.From.Reg = REGG
p.From.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
if ctxt.Cursym.Cfunc != 0 {
p.From.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
}
p.To.Type_ = D_REG
p.To.Reg = 3
q = nil
if framesize <= liblink.StackSmall {
// small stack: SP < stackguard
// CMP stackguard, SP
p = liblink.Appendp(ctxt, p)
p.As = ACMPU
p.From.Type_ = D_REG
p.From.Reg = 3
p.To.Type_ = D_REG
p.To.Reg = REGSP
} else if framesize <= liblink.StackBig {
// large stack: SP-framesize < stackguard-StackSmall
// ADD $-framesize, SP, R4
// CMP stackguard, R4
p = liblink.Appendp(ctxt, p)
p.As = AADD
p.From.Type_ = D_CONST
p.From.Offset = int64(-framesize)
p.Reg = REGSP
p.To.Type_ = D_REG
p.To.Reg = 4
p = liblink.Appendp(ctxt, p)
p.As = ACMPU
p.From.Type_ = D_REG
p.From.Reg = 3
p.To.Type_ = D_REG
p.To.Reg = 4
} 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.
//.........这里部分代码省略.........
示例6: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var q *liblink.Prog
var p1 *liblink.Prog
var p2 *liblink.Prog
var q1 *liblink.Prog
var o int
var mov int
var aoffset int
var textstksiz int64
var textarg int64
var autosize int32
if ctxt.Symmorestack[0] == nil {
ctxt.Symmorestack[0] = liblink.Linklookup(ctxt, "runtime.morestack", 0)
ctxt.Symmorestack[1] = liblink.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
}
// TODO(minux): add morestack short-cuts with small fixed frame-size.
ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil {
return
}
p = cursym.Text
parsetextconst(p.To.Offset, &textstksiz, &textarg)
cursym.Args = int32(p.To.Offset >> 32)
cursym.Locals = int32(textstksiz)
/*
* find leaf subroutines
* strip NOPs
* expand RET
* expand BECOME pseudo
*/
if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", liblink.Cputime())
}
liblink.Bflush(ctxt.Bso)
q = nil
for p = cursym.Text; p != nil; p = p.Link {
switch p.As {
/* too hard, just leave alone */
case ATEXT:
q = p
p.Mark |= LABEL | LEAF | SYNC
if p.Link != nil {
p.Link.Mark |= LABEL
}
case ANOR:
q = p
if p.To.Type_ == D_REG {
if p.To.Reg == REGZERO {
p.Mark |= LABEL | SYNC
}
}
case ALWAR,
ASTWCCC,
AECIWX,
AECOWX,
AEIEIO,
AICBI,
AISYNC,
ATLBIE,
ATLBIEL,
ASLBIA,
ASLBIE,
ASLBMFEE,
ASLBMFEV,
ASLBMTE,
ADCBF,
ADCBI,
ADCBST,
ADCBT,
ADCBTST,
ADCBZ,
ASYNC,
ATLBSYNC,
APTESYNC,
ATW,
AWORD,
ARFI,
ARFCI,
ARFID,
AHRFID:
q = p
p.Mark |= LABEL | SYNC
continue
case AMOVW,
AMOVWZ,
AMOVD:
q = p
//.........这里部分代码省略.........