compiler: permit inlining references to global variables

Programming / Compilers / GCC - ian [138bc75d-0d04-0410-961f-82ee72b054a4] - 3 June 2019 23:04 EDT

This requires tracking all references to unexported variables, so that we can make them global symbols in the object file, and can export them so that other compilations can see the right definition for their own inline bodies.

This introduces a syntax for referencing names defined in other packages: a prefix, where NN is the package index. This will need to be added to gccgoimporter, but I didn't do it yet since it isn't yet possible to create an object for which gccgoimporter will see a prefix.

This increases the number of inlinable functions in the standard library from 181 to 215, adding functions like context.Background.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/177920

015399f943e compiler: permit inlining references to global variables
gcc/go/gofrontend/MERGE | 2 +-
gcc/go/gofrontend/export.cc | 163 +++++++++++++++++++++++++++++++++++----
gcc/go/gofrontend/export.h | 11 ++-
gcc/go/gofrontend/expressions.cc | 91 +++++++++++++++-------
gcc/go/gofrontend/expressions.h | 10 ++-
gcc/go/gofrontend/gogo.cc | 102 +++++++++++++++++++-----
gcc/go/gofrontend/gogo.h | 43 ++++++++---
gcc/go/gofrontend/import.cc | 97 +++++++++++++++++++----
gcc/go/gofrontend/import.h | 50 +++++++++++-
9 files changed, 482 insertions(+), 87 deletions(-)

Upstream: gcc.gnu.org


  • Share