diff options
author | Than McIntosh <thanm@google.com> | 2016-12-06 22:31:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-12-06 22:31:25 +0000 |
commit | a5a56d88a1040a42a1bfc22587364f3bfb1efa76 (patch) | |
tree | d29a67292ff3a155b5c23dfb0a6145f8ddbee486 /gcc/go/go-gcc.cc | |
parent | dd5af1d61761e9bf466cd64360e6321cde0a2c5f (diff) | |
download | gcc-a5a56d88a1040a42a1bfc22587364f3bfb1efa76.zip gcc-a5a56d88a1040a42a1bfc22587364f3bfb1efa76.tar.gz gcc-a5a56d88a1040a42a1bfc22587364f3bfb1efa76.tar.bz2 |
compiler: pass lvalue/rvalue context to back end for var exprs
Add a new flag on the Var_expression class that indicates
whether the var reference appears in an "lvalue" context
(for example, on the LHS of an assignment stmt) or an
"rvalue" context (for example, as an argument of a call).
Add a traversal pass that visits assignment stmt LHS subtrees
so as to mark things prior to backend gen. Select the right
context value in other places where Backend::var_expression is
called.
Reviewed-on: https://go-review.googlesource.com/33990
* go-gcc.cc (Gcc_backend::var_expression): Add Varexpr_context
parameter.
From-SVN: r243321
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index dc00413..f1ac522 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -276,7 +276,7 @@ class Gcc_backend : public Backend { return this->make_expression(null_pointer_node); } Bexpression* - var_expression(Bvariable* var, Location); + var_expression(Bvariable* var, Varexpr_context, Location); Bexpression* indirect_expression(Btype*, Bexpression* expr, bool known_valid, Location); @@ -1243,7 +1243,7 @@ Gcc_backend::zero_expression(Btype* btype) // An expression that references a variable. Bexpression* -Gcc_backend::var_expression(Bvariable* var, Location location) +Gcc_backend::var_expression(Bvariable* var, Varexpr_context, Location location) { tree ret = var->get_tree(location); if (ret == error_mark_node) |