aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-02-11 13:42:07 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-02-13 09:54:32 +0000
commitebb5de23436436d4206766552e76cd4b802e0c74 (patch)
treefa7cf962d5c796e4a1c5e2dc72b6cf6345414671 /gcc/rust/backend/rust-compile-context.h
parent7366f6decf5ff3c652844913977582c9dec68d53 (diff)
downloadgcc-ebb5de23436436d4206766552e76cd4b802e0c74.zip
gcc-ebb5de23436436d4206766552e76cd4b802e0c74.tar.gz
gcc-ebb5de23436436d4206766552e76cd4b802e0c74.tar.bz2
Add in ContinueExpr support
We made an implicit loop begin label that can be referenced in a goto to restart the loop. Fixes #188
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r--gcc/rust/backend/rust-compile-context.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 288b917..76255b0 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -219,6 +219,20 @@ public:
return back;
}
+ void push_loop_begin_label (Blabel *label)
+ {
+ loop_begin_labels.push_back (label);
+ }
+
+ Blabel *peek_loop_begin_label () { return loop_begin_labels.back (); }
+
+ Blabel *pop_loop_begin_label ()
+ {
+ Blabel *pop = loop_begin_labels.back ();
+ loop_begin_labels.pop_back ();
+ return pop;
+ }
+
private:
::Backend *backend;
Resolver::Resolver *resolver;
@@ -235,6 +249,7 @@ private:
std::vector< ::std::vector<Bstatement *> > statements;
std::vector< ::Bblock *> scope_stack;
std::vector< ::Bvariable *> loop_value_stack;
+ std::vector< ::Blabel *> loop_begin_labels;
// To GCC middle-end
std::vector< ::Btype *> type_decls;