[dev.ssa] cmd/compile: support NaCl in SSA for ARM

NaCl code runs in sandbox and there are restrictions for its
instruction uses
(https://developer.chrome.com/native-client/reference/sandbox_internals/arm-32-bit-sandbox).

Like the legacy backend, on NaCl,
- don't use R9, which is used as NaCl's "thread pointer".
- don't use Duff's device.
- don't use indexed load/stores.
- the assembler rewrites DIV/MOD to runtime calls, which on NaCl
  clobbers R12, so R12 is marked as clobbered for DIV/MOD.
- other restrictions are satisfied by the assembler.

Enable SSA specific tests on nacl/arm, and disable non-SSA ones.

Updates #15365.

Change-Id: I9262693ec6756b89ca29d3ae4e52a96fe5403b02
Reviewed-on: https://go-review.googlesource.com/24859
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Cherry Zhang 2016-07-07 10:49:43 -04:00
parent 7d70f84f54
commit 6b6de15d32
10 changed files with 60 additions and 49 deletions

View file

@ -490,6 +490,9 @@ func (s *regAllocState) init(f *Func) {
s.f.Config.fe.Unimplementedf(0, "arch %s not implemented", s.f.Config.arch)
}
}
if s.f.Config.nacl && s.f.Config.arch == "arm" {
s.allocatable &^= 1 << 9 // R9 is "thread pointer" on nacl/arm
}
s.regs = make([]regState, s.numRegs)
s.values = make([]valState, f.NumValues())