]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/riscv: rework instruction generation
authorJoel Sing <joel@sing.id.au>
Wed, 18 Dec 2019 15:09:45 +0000 (02:09 +1100)
committerJoel Sing <joel@sing.id.au>
Sun, 15 Mar 2020 06:42:43 +0000 (06:42 +0000)
commit3e00061f526707dbc0fa1754a7e98a29b2c25939
tree7cbb7df6bf37f14bc168768f1f6ede14423d78ac
parent2b920cba8fa68f8ded28150ec1b1a5cea61ae0f0
cmd/internal/obj/riscv: rework instruction generation

Rework instruction generation so that multiple instructions are generated
from a single obj.Prog, rather than the current approach where obj.Progs
are rewritten. This allows the original obj.Prog to remain intact, before
being converted into an architecture specific instruction form.

This simplifies the code and removes a level of indirection that results
from trying to manipulate obj.Prog.To/obj.Prog.From into forms that match
the instruction encoding. Furthermore, the errors reported make more sense
since it matches up with the actual assembly that was parsed.

Note that the CALL/JMP/JALR type sequences have not yet been migrated to
this framework and will likely be converted at a later time.

Updates #27532

Change-Id: I9fd12562ed1db0a08cfdc32793897d2a1920ebaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/211917
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/asm/internal/asm/testdata/riscvenc.s
src/cmd/internal/obj/riscv/obj.go