compiler: improve escape analysis diagnostics
commit59aae4f062661a66e9757fde548654ad84687529
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Dec 2017 03:27:00 +0000 (22 03:27 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Dec 2017 03:27:00 +0000 (22 03:27 +0000)
tree892b43b84034703019bbd9603fb9addb85180bab
parent02eb0013dcf9c700460a073eaabaea10ac9a1b8c
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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255967 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/escape.cc
gcc/go/gofrontend/escape.h
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/names.cc