1
2
3
4
5 package mips
6
7 import (
8 "cmd/compile/internal/base"
9 "cmd/compile/internal/objw"
10 "cmd/compile/internal/types"
11 "cmd/internal/obj"
12 "cmd/internal/obj/mips"
13 )
14
15
16 func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, _ *uint32) *obj.Prog {
17
18 if cnt == 0 {
19 return p
20 }
21 if cnt < int64(4*types.PtrSize) {
22 for i := int64(0); i < cnt; i += int64(types.PtrSize) {
23 p = pp.Append(p, mips.AMOVW, obj.TYPE_REG, mips.REGZERO, 0, obj.TYPE_MEM, mips.REGSP, base.Ctxt.Arch.FixedFrameSize+off+i)
24 }
25 } else {
26
27
28
29
30
31
32
33 p = pp.Append(p, mips.AADD, obj.TYPE_CONST, 0, base.Ctxt.Arch.FixedFrameSize+off-4, obj.TYPE_REG, mips.REGRT1, 0)
34 p.Reg = mips.REGSP
35 p = pp.Append(p, mips.AADD, obj.TYPE_CONST, 0, cnt, obj.TYPE_REG, mips.REGRT2, 0)
36 p.Reg = mips.REGRT1
37 p = pp.Append(p, mips.AMOVW, obj.TYPE_REG, mips.REGZERO, 0, obj.TYPE_MEM, mips.REGRT1, int64(types.PtrSize))
38 p1 := p
39 p = pp.Append(p, mips.AADD, obj.TYPE_CONST, 0, int64(types.PtrSize), obj.TYPE_REG, mips.REGRT1, 0)
40 p = pp.Append(p, mips.ABNE, obj.TYPE_REG, mips.REGRT1, 0, obj.TYPE_BRANCH, 0, 0)
41 p.Reg = mips.REGRT2
42 p.To.SetTarget(p1)
43 }
44
45 return p
46 }
47
48 func ginsnop(pp *objw.Progs) *obj.Prog {
49 p := pp.Prog(mips.ANOOP)
50 return p
51 }
52
View as plain text