diff options
author | Ian Lance Taylor <iant@google.com> | 2011-04-05 05:57:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-04-05 05:57:39 +0000 |
commit | d56e667993d46456e38c70d7e36c9be3c4dbf37f (patch) | |
tree | 577d44ef128d82982e60ea0b47f375eebb0187b5 /gcc/go/gofrontend/backend.h | |
parent | 566475c80091b451af0513f2144d853b702eb73b (diff) | |
download | gcc-d56e667993d46456e38c70d7e36c9be3c4dbf37f.zip gcc-d56e667993d46456e38c70d7e36c9be3c4dbf37f.tar.gz gcc-d56e667993d46456e38c70d7e36c9be3c4dbf37f.tar.bz2 |
Use backend interface for labels and goto statements.
* go-gcc.c (class Blabel): Define.
(Gcc_backend::make_expression): New function.
(get_identifier_from_string): New function.
(Gcc_backend::label): New function.
(Gcc_backend::label_definition_statement): New function.
(Gcc_backend::goto_statement): New function.
(Gcc_backend::label_address): New function.
(expression_to_tree): New function.
* Make-lang.in (go/expressions.o): Depend on
go/gofrontend/backend.h.
(go/gogo.o): Likewise.
From-SVN: r171968
Diffstat (limited to 'gcc/go/gofrontend/backend.h')
-rw-r--r-- | gcc/go/gofrontend/backend.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index 959fc78..814263e 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -27,6 +27,9 @@ class Bstatement; // The backend representation of a function definition. class Bfunction; +// The backend representation of a label. +class Blabel; + // A list of backend types. typedef std::vector<Btype*> Btypes; @@ -114,6 +117,30 @@ class Backend virtual Bstatement* return_statement(Bfunction*, const std::vector<Bexpression*>&, source_location) = 0; + + // Labels. + + // Create a new label. NAME will be empty if this is a label + // created by the frontend for a loop construct. The location is + // where the the label is defined. + virtual Blabel* + label(Bfunction*, const std::string& name, source_location) = 0; + + // Create a statement which defines a label. This statement will be + // put into the codestream at the point where the label should be + // defined. + virtual Bstatement* + label_definition_statement(Blabel*) = 0; + + // Create a goto statement to a label. + virtual Bstatement* + goto_statement(Blabel*, source_location) = 0; + + // Create an expression for the address of a label. This is used to + // get the return address of a deferred function which may call + // recover. + virtual Bexpression* + label_address(Blabel*, source_location) = 0; }; // The backend interface has to define this function. @@ -125,6 +152,7 @@ extern Backend* go_get_backend(); extern Bexpression* tree_to_expr(tree); extern Bfunction* tree_to_function(tree); +extern tree expression_to_tree(Bexpression*); extern tree statement_to_tree(Bstatement*); #endif // !defined(GO_BACKEND_H) |