These illegal addressing modes were caught downstream in the assembler
or link library, but we can give a better error message upstream.
Change-Id: Ib30ef4d94d5d8d44900276592edd7997e6f91e55
Reviewed-on: https://go-review.googlesource.com/4260
Reviewed-by: Russ Cox <rsc@golang.org>
a.Type = obj.TYPE_ADDR
}
a.Reg = r1
+ if r1 == arch.RPC && prefix != 0 {
+ p.errorf("illegal addressing mode for PC")
+ }
a.Scale = scale
p.get(')')
if scale == 0 && p.peek() == '(' {
}
a.Sym = obj.Linklookup(p.linkCtxt, name, isStatic)
if p.peek() == scanner.EOF {
+ if prefix != 0 {
+ p.errorf("illegal addressing mode for symbol %s", name)
+ }
return
}
- // Expect (SB) or (FP) or (SP).
+ // Expect (SB) or (FP), (PC), (SB), or (SP)
p.get('(')
reg := p.get(scanner.Ident).String()
switch reg {
case "FP":
a.Name = obj.NAME_PARAM
+ case "PC":
+ // Fine as is.
+ if prefix != 0 {
+ p.errorf("illegal addressing mode for PC")
+ }
case "SB":
a.Name = obj.NAME_EXTERN
if isStatic != 0 {