mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: add Prog.SetFrom3{Reg,Const}
These are the the most common uses, and they reduce line noise. I don't love adding new deprecated APIs, but since they're trivial wrappers, it'll be very easy to update them along with the rest. No functional changes; passes toolstash-check. Change-Id: I691a8175cfef9081180e463c63f326376af3f3a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/296009 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
5f15af111c
commit
a61524d103
8 changed files with 41 additions and 30 deletions
|
|
@ -360,6 +360,20 @@ func (p *Prog) SetFrom3(a Addr) {
|
|||
p.RestArgs = []AddrPos{{a, Source}}
|
||||
}
|
||||
|
||||
// SetFrom3Reg calls p.SetFrom3 with a register Addr containing reg.
|
||||
//
|
||||
// Deprecated: for the same reasons as Prog.GetFrom3.
|
||||
func (p *Prog) SetFrom3Reg(reg int16) {
|
||||
p.SetFrom3(Addr{Type: TYPE_REG, Reg: reg})
|
||||
}
|
||||
|
||||
// SetFrom3Const calls p.SetFrom3 with a const Addr containing x.
|
||||
//
|
||||
// Deprecated: for the same reasons as Prog.GetFrom3.
|
||||
func (p *Prog) SetFrom3Const(off int64) {
|
||||
p.SetFrom3(Addr{Type: TYPE_CONST, Offset: off})
|
||||
}
|
||||
|
||||
// SetTo2 assigns []Args{{a, 1}} to p.RestArgs when the second destination
|
||||
// operand does not fit into prog.RegTo2.
|
||||
func (p *Prog) SetTo2(a Addr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue