aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2021-11-15 10:21:04 -0800
committerDavid Faust <david.faust@oracle.com>2021-11-16 13:15:55 -0800
commit01a52df9440a78ec5221c7f2430f06e770133e06 (patch)
treedb3918137c768b4cc351e28b506ba42263bb454c /gcc/rust/backend
parenta4e5aee5863c7d898ee640296bc837e0baa8e796 (diff)
downloadgcc-01a52df9440a78ec5221c7f2430f06e770133e06.zip
gcc-01a52df9440a78ec5221c7f2430f06e770133e06.tar.gz
gcc-01a52df9440a78ec5221c7f2430f06e770133e06.tar.bz2
Replace Blabel with GCC tree
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-context.h19
-rw-r--r--gcc/rust/backend/rust-compile-expr.h12
2 files changed, 14 insertions, 17 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 1fe67d2..72ab4f2 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -221,12 +221,9 @@ public:
return true;
}
- void insert_label_decl (HirId id, ::Blabel *label)
- {
- compiled_labels[id] = label;
- }
+ void insert_label_decl (HirId id, tree label) { compiled_labels[id] = label; }
- bool lookup_label_decl (HirId id, ::Blabel **label)
+ bool lookup_label_decl (HirId id, tree *label)
{
auto it = compiled_labels.find (id);
if (it == compiled_labels.end ())
@@ -278,16 +275,16 @@ public:
return back;
}
- void push_loop_begin_label (Blabel *label)
+ void push_loop_begin_label (tree label)
{
loop_begin_labels.push_back (label);
}
- Blabel *peek_loop_begin_label () { return loop_begin_labels.back (); }
+ tree peek_loop_begin_label () { return loop_begin_labels.back (); }
- Blabel *pop_loop_begin_label ()
+ tree pop_loop_begin_label ()
{
- Blabel *pop = loop_begin_labels.back ();
+ tree pop = loop_begin_labels.back ();
loop_begin_labels.pop_back ();
return pop;
}
@@ -321,11 +318,11 @@ private:
std::map<HirId, tree> compiled_type_map;
std::map<HirId, tree> compiled_fn_map;
std::map<HirId, tree> compiled_consts;
- std::map<HirId, ::Blabel *> compiled_labels;
+ std::map<HirId, tree> compiled_labels;
std::vector<::std::vector<tree>> statements;
std::vector<tree> scope_stack;
std::vector<::Bvariable *> loop_value_stack;
- std::vector<::Blabel *> loop_begin_labels;
+ std::vector<tree> loop_begin_labels;
std::map<const TyTy::BaseType *, std::pair<HirId, ::tree >> mono;
std::map<DefId, std::vector<std::pair<const TyTy::BaseType *, tree>>>
mono_fns;
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 52cc58a..2bf969b 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -755,7 +755,7 @@ public:
if (expr.has_loop_label ())
{
HIR::LoopLabel &loop_label = expr.get_loop_label ();
- Blabel *label
+ tree label
= ctx->get_backend ()->label (fnctx.fndecl,
loop_label.get_lifetime ().get_name (),
loop_label.get_locus ());
@@ -766,7 +766,7 @@ public:
loop_label.get_lifetime ().get_mappings ().get_hirid (), label);
}
- Blabel *loop_begin_label
+ tree loop_begin_label
= ctx->get_backend ()->label (fnctx.fndecl, "", expr.get_locus ());
tree loop_begin_label_decl
= ctx->get_backend ()->label_definition_statement (loop_begin_label);
@@ -796,7 +796,7 @@ public:
if (expr.has_loop_label ())
{
HIR::LoopLabel &loop_label = expr.get_loop_label ();
- Blabel *label
+ tree label
= ctx->get_backend ()->label (fnctx.fndecl,
loop_label.get_lifetime ().get_name (),
loop_label.get_locus ());
@@ -817,7 +817,7 @@ public:
start_location, end_location);
ctx->push_block (loop_block);
- Blabel *loop_begin_label
+ tree loop_begin_label
= ctx->get_backend ()->label (fnctx.fndecl, "", expr.get_locus ());
tree loop_begin_label_decl
= ctx->get_backend ()->label_definition_statement (loop_begin_label);
@@ -887,7 +887,7 @@ public:
return;
}
- Blabel *label = nullptr;
+ tree label = NULL_TREE;
if (!ctx->lookup_label_decl (ref, &label))
{
rust_error_at (expr.get_label ().get_locus (),
@@ -912,7 +912,7 @@ public:
void visit (HIR::ContinueExpr &expr) override
{
- Blabel *label = ctx->peek_loop_begin_label ();
+ tree label = ctx->peek_loop_begin_label ();
if (expr.has_label ())
{
NodeId resolved_node_id = UNKNOWN_NODEID;