compiler: rework static initializer code
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Nov 2016 21:41:58 +0000 (21:41 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Nov 2016 21:41:58 +0000 (21:41 +0000)
commit39de19551b6b39d83ad791a39c72ec51f958b48b
treeabdcd33bd886840743880175f64b9cbfa3db1468
parent677aa9b4b79ce0e26cadbdbc9effdbaa00487e6a
compiler: rework static initializer code

    Rename is_immutable to is_static_initializer to try to capture what it
    really means.  Be more precise about when an address expression, or a
    binary expression, can be a static initializer.  Don't check whether a
    type has pointers when deciding whether an initializer must be
    read-write, just check whether it is being used to initialize a global
    variable.  To make that work set the Translate_context function to NULL
    for a global variable with a static initializer.

    The effect of this is to let more global variables be initialized
    directly, rather than being initialized in the generated init function.

    Reviewed-on: https://go-review.googlesource.com/32917

From-SVN: r242024
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/gogo.cc