compiler: improve escape analysis diagnostics
This CL brings escape analysis diagnostics closer to the gc
compiler's. This makes porting and debugging escape analysis
code easier. A few changes:
- In the gc compiler, the variable expression is represented
with the variable node itself (ONAME), the location of which
is the location of definition. We add a definition_location
method to Node, and make use of it when the gc compiler emits
diagnostics at the definition locations.
- In the gc compiler, methods are named T.M or (*T).M. Add the
type to the method name when possible.
- Print "moved to heap" messages only for variables.
- Reduce some duplicated diagnostics.
- Print "does not escape" messages in more situations which the
gc compiler does.
- Remove the special handling for closure numbers. In gofrontend,
closures are named "$nested#" where # is a global counter
starting from 0, whereas in the gc compiler they are named
"outer.func#" where # is a per-function counter starting from
1. We tried to adjust the closure name to better matching the
ones in the gc compiler, however, it cannot match exactly
because of the difference of the counter. Instead, just print
"outer.$nested#".
Reviewed-on: https://go-review.googlesource.com/83875
From-SVN: r255967