aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/mips
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2017-03-10 18:34:41 -0800
committerMatthew Dempsky <mdempsky@google.com>2017-03-13 21:04:16 +0000
commit118b3fe7bbf855196db727daefbb403b84a4f67d (patch)
treee721b1fdc9b7dceee206fd5a41a31152b7f36935 /src/cmd/compile/internal/mips
parent2e7c3b3f555853202fe0bdf2ea5ce37d7a56a7f7 (diff)
downloadgo-118b3fe7bbf855196db727daefbb403b84a4f67d.tar.gz
go-118b3fe7bbf855196db727daefbb403b84a4f67d.zip
cmd/compile/internal/gc: refactor ACALL Prog creation
This abstracts creation of ACALL Progs into package gc. The main benefit of this today is we can refactor away a lot of common boilerplate code. Later, once liveness analysis happens on the SSA graph, this will also provide an easy insertion point for emitting the PCDATA Progs immediately before call instructions. Passes toolstash-check -all. Change-Id: Ia15108ace97201cd84314f1ca916dfeb4f09d61c Reviewed-on: https://go-review.googlesource.com/38081 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/mips')
-rw-r--r--src/cmd/compile/internal/mips/galign.go1
-rw-r--r--src/cmd/compile/internal/mips/ssa.go37
2 files changed, 3 insertions, 35 deletions
diff --git a/src/cmd/compile/internal/mips/galign.go b/src/cmd/compile/internal/mips/galign.go
index 39f5d2bf64..9c7791740a 100644
--- a/src/cmd/compile/internal/mips/galign.go
+++ b/src/cmd/compile/internal/mips/galign.go
@@ -19,6 +19,7 @@ func Init() {
gc.Thearch.REGSP = mips.REGSP
gc.Thearch.MAXWIDTH = (1 << 31) - 1
gc.Thearch.Defframe = defframe
+ gc.Thearch.Ginsnop = ginsnop
gc.Thearch.Proginfo = proginfo
gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
gc.Thearch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/mips/ssa.go b/src/cmd/compile/internal/mips/ssa.go
index 0d5a2a2bc8..8ef39b5f60 100644
--- a/src/cmd/compile/internal/mips/ssa.go
+++ b/src/cmd/compile/internal/mips/ssa.go
@@ -477,41 +477,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p6.Reg = mips.REG_R1
p6.To.Type = obj.TYPE_BRANCH
gc.Patch(p6, p2)
- case ssa.OpMIPSCALLstatic:
- if v.Aux.(*obj.LSym) == gc.Deferreturn {
- // Deferred calls will appear to be returning to
- // the CALL deferreturn(SB) that we are about to emit.
- // However, the stack trace code will show the line
- // of the instruction byte before the return PC.
- // To avoid that being an unrelated instruction,
- // insert an actual hardware NOP that will have the right line number.
- // This is different from obj.ANOP, which is a virtual no-op
- // that doesn't make it into the instruction stream.
- ginsnop()
- }
- p := gc.Prog(obj.ACALL)
- p.To.Type = obj.TYPE_MEM
- p.To.Name = obj.NAME_EXTERN
- p.To.Sym = v.Aux.(*obj.LSym)
- if gc.Maxarg < v.AuxInt {
- gc.Maxarg = v.AuxInt
- }
- case ssa.OpMIPSCALLclosure:
- p := gc.Prog(obj.ACALL)
- p.To.Type = obj.TYPE_MEM
- p.To.Offset = 0
- p.To.Reg = v.Args[0].Reg()
- if gc.Maxarg < v.AuxInt {
- gc.Maxarg = v.AuxInt
- }
- case ssa.OpMIPSCALLinter:
- p := gc.Prog(obj.ACALL)
- p.To.Type = obj.TYPE_MEM
- p.To.Offset = 0
- p.To.Reg = v.Args[0].Reg()
- if gc.Maxarg < v.AuxInt {
- gc.Maxarg = v.AuxInt
- }
+ case ssa.OpMIPSCALLstatic, ssa.OpMIPSCALLclosure, ssa.OpMIPSCALLinter:
+ s.Call(v)
case ssa.OpMIPSLoweredAtomicLoad:
gc.Prog(mips.ASYNC)