tools/go/ssa
Alan Donovan 514bdfb1b7 go.tools/go/ssa: improve generated code for addressable expressions.
If an expression is addressable, we compute its address then load, rather than
extracting the value of subelements.  For aggregates this avoids large copies.
Example:
        var x [2]struct{y [3]int}
        print(x[1].y[2])

Was:
t0 = local [3]struct{x [5]int} (x)                 *[3]struct{x [5]int}
t1 = *t0                                            [3]struct{x [5]int}
t2 = t1[1:int]                                         struct{x [5]int}
t3 = t2.x [#0]                                                   [5]int
t4 = t3[2:int]                                                      int

Now:
t1 = &t0[1:int]                                       *struct{x [5]int}
t2 = &t1.x [#0]                                                 *[5]int
t3 = &t2[2:int]                                                    *int
t4 = *t3                                                            int

Also:
- make emitFieldSelections responsible for calling emitDebugRef, as
  one of its two calls was forgetting to do it.
- relax the specification of (*Program).VarValue because not all
  subexpressions are materalized as values now.
- fix up the objlookup.go test expectations to match.

go/ssa/interp test runs 10% faster.

Thanks to Peter Collingbourne for pointing this out.

LGTM=pcc
R=pcc, gri
CC=golang-codereviews
https://golang.org/cl/109710043
2014-07-17 15:06:09 -04:00
..
interp go.tools/go/ssa: permit "for range x" 2014-07-15 17:34:50 +01:00
ssautil go.tools/go/loader: add Config.ParserMode configuration parameter. 2014-03-27 12:50:26 -04:00
testdata go.tools/go/ssa: improve generated code for addressable expressions. 2014-07-17 15:06:09 -04:00
blockopt.go go.tools/go/ssa: don't attempt fusion on single-pred blocks with φ-nodes 2014-04-24 09:08:21 -04:00
builder.go go.tools/go/ssa: improve generated code for addressable expressions. 2014-07-17 15:06:09 -04:00
builder_test.go go.tools/go/ssa: add a flag for selecting bare init functions 2014-06-16 21:34:51 -04:00
const.go go/ssa: make Builtin capable of representing non-spec-defined intrinsics. 2014-06-13 17:34:07 -04:00
create.go go.tools/go/loader: use new types.TypeAndValue mode predicates. 2014-07-11 10:50:09 +01:00
doc.go go/ssa: s/Capture/FreeVar/g 2014-06-11 14:04:45 -04:00
dom.go go.tools/go/ssa: use bytes.Buffer instead of io.Writer. 2014-01-28 17:48:10 -05:00
emit.go go.tools/go/ssa: improve generated code for addressable expressions. 2014-07-17 15:06:09 -04:00
example_test.go go.tools/go/ssa: fix incorrect indentation in SSA printout. 2014-05-16 12:37:17 -04:00
func.go go.tools/go/loader: use new types.TypeAndValue mode predicates. 2014-07-11 10:50:09 +01:00
lift.go go.tools/go/ssa: introduce a sanity check for dead referrers 2014-07-10 06:27:25 -04:00
lvalue.go go.tools: rename packages. 2014-01-16 09:33:58 -05:00
print.go go/ssa: s/Capture/FreeVar/g 2014-06-11 14:04:45 -04:00
promote.go go/ssa: make Builtin capable of representing non-spec-defined intrinsics. 2014-06-13 17:34:07 -04:00
sanity.go go.tools/go/ssa: introduce a sanity check for dead referrers 2014-07-10 06:27:25 -04:00
source.go go.tools/go/ssa: improve generated code for addressable expressions. 2014-07-17 15:06:09 -04:00
source_test.go go.tools/ssa: create thunks for method expressions T.f. 2014-06-11 13:10:26 -04:00
ssa.go go.tools/go/loader: use new types.TypeAndValue mode predicates. 2014-07-11 10:50:09 +01:00
stdlib_test.go go/loader: convert directory separators to slash when enumerating packages. 2014-03-04 13:48:09 -05:00
testmain.go go/ssa: make Builtin capable of representing non-spec-defined intrinsics. 2014-06-13 17:34:07 -04:00
util.go go/ssa: make Builtin capable of representing non-spec-defined intrinsics. 2014-06-13 17:34:07 -04:00