diff options
author | Chris Manghane <cmang@google.com> | 2014-04-22 23:46:30 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-04-22 23:46:30 +0000 |
commit | aa4929209a17cc4070b900d9bd2947b50c6f83d1 (patch) | |
tree | 4a57f96317acc5e134415f90f182cd3b815dc14b /gcc/go/go-gcc.cc | |
parent | 2195867f1d6cdc9e8d36aeeefc3c0f000bccbda3 (diff) | |
download | gcc-aa4929209a17cc4070b900d9bd2947b50c6f83d1.zip gcc-aa4929209a17cc4070b900d9bd2947b50c6f83d1.tar.gz gcc-aa4929209a17cc4070b900d9bd2947b50c6f83d1.tar.bz2 |
compiler: Use backend interface for initialization functions.
* go-gcc.cc (Gcc_backend::temporary_variable): Push cfun around
call to create_tmp_var. Require that function be non-NULL.
From-SVN: r209665
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 1af639e..376e4dc 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -2214,10 +2214,21 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, return this->error_variable(); } + go_assert(function != NULL); + tree decl = function->get_tree(); + tree var; // We can only use create_tmp_var if the type is not addressable. if (!TREE_ADDRESSABLE(type_tree)) - var = create_tmp_var(type_tree, "GOTMP"); + { + if (DECL_STRUCT_FUNCTION(decl) == NULL) + push_struct_function(decl); + else + push_cfun(DECL_STRUCT_FUNCTION(decl)); + + var = create_tmp_var(type_tree, "GOTMP"); + pop_cfun(); + } else { gcc_assert(bblock != NULL); @@ -2227,16 +2238,7 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, DECL_ARTIFICIAL(var) = 1; DECL_IGNORED_P(var) = 1; TREE_USED(var) = 1; - // FIXME: Permitting function to be NULL here is a temporary - // measure until we have a proper representation of the init - // function. - if (function != NULL) - DECL_CONTEXT(var) = function->get_tree(); - else - { - gcc_assert(current_function_decl != NULL_TREE); - DECL_CONTEXT(var) = current_function_decl; - } + DECL_CONTEXT(var) = decl; // We have to add this variable to the BLOCK and the BIND_EXPR. tree bind_tree = bblock->get_tree(); |