aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2014-06-04 23:15:33 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-06-04 23:15:33 +0000
commitbae90c989cb020d17a24919ec84c0b8dd2fae2da (patch)
tree89766166feb4ceca2d983169c5360e3f6f521b12 /gcc/go/go-gcc.cc
parent82b3da6a714493644a4333bfd8205e3341ed3b8e (diff)
downloadgcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.zip
gcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.tar.gz
gcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.tar.bz2
libgo: Merge from revision 18783:00cce3a34d7e of master library.
This revision was committed January 7, 2014. The next revision deleted runtime/mfinal.c. That will be done in a subsequent merge. This merge changes type descriptors to add a zero field, pointing to a zero value for that type. This is implemented as a common variable. * go-gcc.cc (Gcc_backend::implicit_variable): Add is_common and alignment parameters. Permit init parameter to be NULL. From-SVN: r211249
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 5b95e5d..df4b670 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -389,7 +389,8 @@ class Gcc_backend : public Backend
Location, Bstatement**);
Bvariable*
- implicit_variable(const std::string&, Btype*, Bexpression*, bool);
+ implicit_variable(const std::string&, Btype*, Bexpression*, bool, bool,
+ size_t);
Bvariable*
immutable_struct(const std::string&, bool, bool, Btype*, Location);
@@ -2497,10 +2498,15 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
Bvariable*
Gcc_backend::implicit_variable(const std::string& name, Btype* type,
- Bexpression* init, bool is_constant)
+ Bexpression* init, bool is_constant,
+ bool is_common, size_t alignment)
{
tree type_tree = type->get_tree();
- tree init_tree = init->get_tree();
+ tree init_tree;
+ if (init == NULL)
+ init_tree = NULL_TREE;
+ else
+ init_tree = init->get_tree();
if (type_tree == error_mark_node || init_tree == error_mark_node)
return this->error_variable();
@@ -2510,12 +2516,25 @@ Gcc_backend::implicit_variable(const std::string& name, Btype* type,
TREE_PUBLIC(decl) = 0;
TREE_STATIC(decl) = 1;
DECL_ARTIFICIAL(decl) = 1;
- if (is_constant)
+ if (is_common)
+ {
+ DECL_COMMON(decl) = 1;
+ TREE_PUBLIC(decl) = 1;
+ gcc_assert(init_tree == NULL_TREE);
+ }
+ else if (is_constant)
{
TREE_READONLY(decl) = 1;
TREE_CONSTANT(decl) = 1;
}
DECL_INITIAL(decl) = init_tree;
+
+ if (alignment != 0)
+ {
+ DECL_ALIGN(decl) = alignment * BITS_PER_UNIT;
+ DECL_USER_ALIGN(decl) = 1;
+ }
+
rest_of_decl_compilation(decl, 1, 0);
return new Bvariable(decl);