diff options
author | Than McIntosh <thanm@google.com> | 2016-12-16 22:11:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-12-16 22:11:28 +0000 |
commit | 8220e3f9bd3ce1ab9ff9696befdf773960f2802a (patch) | |
tree | 7be95802bcfe2fc53857c96560d39afd05204959 /gcc/go/gofrontend/backend.h | |
parent | 5cdc4b0ef0381439be6cebd6ba8925f69e4d51d6 (diff) | |
download | gcc-8220e3f9bd3ce1ab9ff9696befdf773960f2802a.zip gcc-8220e3f9bd3ce1ab9ff9696befdf773960f2802a.tar.gz gcc-8220e3f9bd3ce1ab9ff9696befdf773960f2802a.tar.bz2 |
compiler: add containing Bfunction to some backend interfaces.
Change the interfaces for backend methods that create statements to
always pass in the enclosing Bfunction for the statement. Having the
function available simplifies things if a temporary variable has to be
created during the construction of a statement.
This also includes a change to the Mark_lvalue_varexprs helper
class to handle indirections on the left hand side of assignments
(e.g. "*x.y = ...").
Reviewed-on: https://go-review.googlesource.com/34471
* go-gcc.cc (Gcc_backend::expression_statement): Add Bfunction*
parameter.
(Gcc_backend::init_statement): Likewise.
(Gcc_backend::assignment_statement): Likewise.
(Gcc_backend::if_statement): Likewise.
From-SVN: r243766
Diffstat (limited to 'gcc/go/gofrontend/backend.h')
-rw-r--r-- | gcc/go/gofrontend/backend.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index e9a1912..cad659a 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -389,19 +389,19 @@ class Backend virtual Bstatement* error_statement() = 0; - // Create an expression statement. + // Create an expression statement within the specified function. virtual Bstatement* - expression_statement(Bexpression*) = 0; + expression_statement(Bfunction*, Bexpression*) = 0; - // Create a variable initialization statement. This initializes a - // local variable at the point in the program flow where it is - // declared. + // Create a variable initialization statement in the specified + // function. This initializes a local variable at the point in the + // program flow where it is declared. virtual Bstatement* - init_statement(Bvariable* var, Bexpression* init) = 0; + init_statement(Bfunction*, Bvariable* var, Bexpression* init) = 0; - // Create an assignment statement. + // Create an assignment statement within the specified function. virtual Bstatement* - assignment_statement(Bexpression* lhs, Bexpression* rhs, + assignment_statement(Bfunction*, Bexpression* lhs, Bexpression* rhs, Location) = 0; // Create a return statement, passing the representation of the @@ -410,9 +410,10 @@ class Backend return_statement(Bfunction*, const std::vector<Bexpression*>&, Location) = 0; - // Create an if statement. ELSE_BLOCK may be NULL. + // Create an if statement within a function. ELSE_BLOCK may be NULL. virtual Bstatement* - if_statement(Bexpression* condition, Bblock* then_block, Bblock* else_block, + if_statement(Bfunction*, Bexpression* condition, + Bblock* then_block, Bblock* else_block, Location) = 0; // Create a switch statement where the case values are constants. |