diff options
| author | Richard Musiol <mail@richard-musiol.de> | 2018-03-29 00:55:53 +0200 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-05-04 17:56:12 +0000 |
| commit | 3b137dd2df19c261a007b8a620a2182cd679d700 (patch) | |
| tree | 1008f11b278e1fc1dc6dc222c0c67654a6fee534 /src/cmd/asm/internal/arch | |
| parent | a9fc37525891e47b4277cde040a06db585e1780d (diff) | |
| download | go-3b137dd2df19c261a007b8a620a2182cd679d700.tar.xz | |
cmd/compile: add wasm architecture
This commit adds the wasm architecture to the compile command.
A later commit will contain the corresponding linker changes.
Design doc: https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0_Nv3OUwjEY5qVCxCup4
The following files are generated:
- src/cmd/compile/internal/ssa/opGen.go
- src/cmd/compile/internal/ssa/rewriteWasm.go
- src/cmd/internal/obj/wasm/anames.go
Updates #18892
Change-Id: Ifb4a96a3e427aac2362a1c97967d5667450fba3b
Reviewed-on: https://go-review.googlesource.com/103295
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/asm/internal/arch')
| -rw-r--r-- | src/cmd/asm/internal/arch/arch.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/arch/arch.go b/src/cmd/asm/internal/arch/arch.go index 357ec757bc..0e4d63744b 100644 --- a/src/cmd/asm/internal/arch/arch.go +++ b/src/cmd/asm/internal/arch/arch.go @@ -11,6 +11,7 @@ import ( "cmd/internal/obj/mips" "cmd/internal/obj/ppc64" "cmd/internal/obj/s390x" + "cmd/internal/obj/wasm" "cmd/internal/obj/x86" "fmt" "strings" @@ -87,6 +88,8 @@ func Set(GOARCH string) *Arch { a := archS390x() a.LinkArch = &s390x.Links390x return a + case "wasm": + return archWasm() } return nil } @@ -95,6 +98,10 @@ func jumpX86(word string) bool { return word[0] == 'J' || word == "CALL" || strings.HasPrefix(word, "LOOP") || word == "XBEGIN" } +func jumpWasm(word string) bool { + return word == "JMP" || word == "CALL" || word == "Call" || word == "Br" || word == "BrIf" +} + func archX86(linkArch *obj.LinkArch) *Arch { register := make(map[string]int16) // Create maps for easy lookup of instruction names etc. @@ -577,3 +584,24 @@ func archS390x() *Arch { IsJump: jumpS390x, } } + +func archWasm() *Arch { + instructions := make(map[string]obj.As) + for i, s := range obj.Anames { + instructions[s] = obj.As(i) + } + for i, s := range wasm.Anames { + if obj.As(i) >= obj.A_ARCHSPECIFIC { + instructions[s] = obj.As(i) + obj.ABaseWasm + } + } + + return &Arch{ + LinkArch: &wasm.Linkwasm, + Instructions: instructions, + Register: wasm.Register, + RegisterPrefix: nil, + RegisterNumber: nilRegisterNumber, + IsJump: jumpWasm, + } +} |
