]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: allow naming of subexpressions
authorKeith Randall <khr@golang.org>
Mon, 21 Mar 2016 23:18:45 +0000 (16:18 -0700)
committerKeith Randall <khr@golang.org>
Tue, 22 Mar 2016 00:18:31 +0000 (00:18 +0000)
commit259b7edf5c3a9b898d9b250c44d4f2c94bc90ca5
tree1f4298d8f9165512c0dfd3f06f5aad69bdfe6ce4
parentd4663e13536d7d43666e53ae21114008cb65d790
cmd/compile: allow naming of subexpressions

Allow names to be used for subexpressions of match rules.
For example:

(OpA x:(OpB y)) -> ..use x here to refer to the OpB value..

This gets rid of the .Args[0].Args[0]... way of naming we
used to use.

While we're here, give all subexpression matches names instead
of recomputing them with .Args[i] sequences each time they
are referenced.  Makes the generated rule code a bit smaller.

Change-Id: Ie42139f6f208933b75bd2ae8bd34e95419bc0e4e
Reviewed-on: https://go-review.googlesource.com/20997
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewritedec.go
src/cmd/compile/internal/ssa/rewritegeneric.go