diff options
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-block.h | 11 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 6 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 35 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-stmt.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 14 |
8 files changed, 38 insertions, 40 deletions
diff --git a/gcc/rust/backend/rust-compile-block.h b/gcc/rust/backend/rust-compile-block.h index 6876e8a..0e631e1 100644 --- a/gcc/rust/backend/rust-compile-block.h +++ b/gcc/rust/backend/rust-compile-block.h @@ -53,8 +53,7 @@ class CompileConditionalBlocks : public HIRCompileBase using Rust::Compile::HIRCompileBase::visit; public: - static Bstatement *compile (HIR::IfExpr *expr, Context *ctx, - Bvariable *result) + static tree compile (HIR::IfExpr *expr, Context *ctx, Bvariable *result) { CompileConditionalBlocks resolver (ctx, result); expr->accept_vis (resolver); @@ -72,7 +71,7 @@ private: : HIRCompileBase (ctx), translated (nullptr), result (result) {} - Bstatement *translated; + tree translated; Bvariable *result; }; @@ -81,8 +80,8 @@ class CompileExprWithBlock : public HIRCompileBase using Rust::Compile::HIRCompileBase::visit; public: - static Bstatement *compile (HIR::ExprWithBlock *expr, Context *ctx, - Bvariable *result) + static tree compile (HIR::ExprWithBlock *expr, Context *ctx, + Bvariable *result) { CompileExprWithBlock resolver (ctx, result); expr->accept_vis (resolver); @@ -109,7 +108,7 @@ private: : HIRCompileBase (ctx), translated (nullptr), result (result) {} - Bstatement *translated; + tree translated; Bvariable *result; }; diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 35ea012..1128fa8 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -139,12 +139,12 @@ public: return scope_stack.back (); } - void add_statement_to_enclosing_scope (Bstatement *stmt) + void add_statement_to_enclosing_scope (tree stmt) { statements.at (statements.size () - 2).push_back (stmt); } - void add_statement (Bstatement *stmt) { statements.back ().push_back (stmt); } + void add_statement (tree stmt) { statements.back ().push_back (stmt); } void insert_var_decl (HirId id, ::Bvariable *decl) { @@ -323,7 +323,7 @@ private: std::map<HirId, ::Bfunction *> compiled_fn_map; std::map<HirId, tree> compiled_consts; std::map<HirId, ::Blabel *> compiled_labels; - std::vector<::std::vector<Bstatement *>> statements; + std::vector<::std::vector<tree>> statements; std::vector<::Bblock *> scope_stack; std::vector<::Bvariable *> loop_value_stack; std::vector<::Blabel *> loop_begin_labels; diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index d475ec4..8786702 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -86,7 +86,7 @@ CompileExpr::visit (HIR::CompoundAssignmentExpr &expr) auto operator_expr = ctx->get_backend ()->arithmetic_or_logical_expression (op, lhs, rhs, expr.get_locus ()); - Bstatement *assignment + tree assignment = ctx->get_backend ()->assignment_statement (fn.fndecl, lhs, operator_expr, expr.get_locus ()); ctx->add_statement (assignment); @@ -178,7 +178,7 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, fncontext fnctx = ctx->peek_fn (); Bblock *enclosing_scope = ctx->peek_enclosing_scope (); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; Bvariable *fn_convert_expr_tmp = ctx->get_backend ()->temporary_variable (fnctx.fndecl, enclosing_scope, expected_fntype, fn_convert_expr, diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index 2f6395c..14d4345 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -379,7 +379,7 @@ public: rvalue = coercion_site (rvalue, actual, expected, expr.get_locus ()); - Bstatement *assignment + tree assignment = ctx->get_backend ()->assignment_statement (fn.fndecl, lvalue, rvalue, expr.get_locus ()); @@ -518,7 +518,7 @@ public: tree block_type = TyTyResolveCompile::compile (ctx, if_type); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = nullptr; tmp = ctx->get_backend ()->temporary_variable ( fnctx.fndecl, enclosing_scope, block_type, NULL, is_address_taken, expr.get_locus (), &ret_var_stmt); @@ -555,7 +555,7 @@ public: tree block_type = TyTyResolveCompile::compile (ctx, if_type); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = nullptr; tmp = ctx->get_backend ()->temporary_variable ( fnctx.fndecl, enclosing_scope, block_type, NULL, is_address_taken, expr.get_locus (), &ret_var_stmt); @@ -591,7 +591,7 @@ public: tree block_type = TyTyResolveCompile::compile (ctx, block_tyty); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = nullptr; tmp = ctx->get_backend ()->temporary_variable ( fnctx.fndecl, enclosing_scope, block_type, NULL, is_address_taken, expr.get_locus (), &ret_var_stmt); @@ -744,7 +744,7 @@ public: tree block_type = TyTyResolveCompile::compile (ctx, block_tyty); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; tmp = ctx->get_backend ()->temporary_variable ( fnctx.fndecl, enclosing_scope, block_type, NULL, is_address_taken, expr.get_locus (), &ret_var_stmt); @@ -759,7 +759,7 @@ public: = ctx->get_backend ()->label (fnctx.fndecl, loop_label.get_lifetime ().get_name (), loop_label.get_locus ()); - Bstatement *label_decl + tree label_decl = ctx->get_backend ()->label_definition_statement (label); ctx->add_statement (label_decl); ctx->insert_label_decl ( @@ -768,7 +768,7 @@ public: Blabel *loop_begin_label = ctx->get_backend ()->label (fnctx.fndecl, "", expr.get_locus ()); - Bstatement *loop_begin_label_decl + tree loop_begin_label_decl = ctx->get_backend ()->label_definition_statement (loop_begin_label); ctx->add_statement (loop_begin_label_decl); ctx->push_loop_begin_label (loop_begin_label); @@ -777,7 +777,7 @@ public: = CompileBlock::compile (expr.get_loop_block ().get (), ctx, nullptr); tree loop_expr = ctx->get_backend ()->loop_expression (code_block, expr.get_locus ()); - Bstatement *loop_stmt + tree loop_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, loop_expr); ctx->add_statement (loop_stmt); @@ -800,7 +800,7 @@ public: = ctx->get_backend ()->label (fnctx.fndecl, loop_label.get_lifetime ().get_name (), loop_label.get_locus ()); - Bstatement *label_decl + tree label_decl = ctx->get_backend ()->label_definition_statement (label); ctx->add_statement (label_decl); ctx->insert_label_decl ( @@ -819,7 +819,7 @@ public: Blabel *loop_begin_label = ctx->get_backend ()->label (fnctx.fndecl, "", expr.get_locus ()); - Bstatement *loop_begin_label_decl + tree loop_begin_label_decl = ctx->get_backend ()->label_definition_statement (loop_begin_label); ctx->add_statement (loop_begin_label_decl); ctx->push_loop_begin_label (loop_begin_label); @@ -828,14 +828,13 @@ public: = CompileExpr::Compile (expr.get_predicate_expr ().get (), ctx); tree exit_expr = ctx->get_backend ()->exit_expression (condition, expr.get_locus ()); - Bstatement *break_stmt + tree break_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, exit_expr); ctx->add_statement (break_stmt); Bblock *code_block = CompileBlock::compile (expr.get_loop_block ().get (), ctx, nullptr); - Bstatement *code_block_stmt - = ctx->get_backend ()->block_statement (code_block); + tree code_block_stmt = ctx->get_backend ()->block_statement (code_block); ctx->add_statement (code_block_stmt); ctx->pop_loop_begin_label (); @@ -843,7 +842,7 @@ public: tree loop_expr = ctx->get_backend ()->loop_expression (loop_block, expr.get_locus ()); - Bstatement *loop_stmt + tree loop_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, loop_expr); ctx->add_statement (loop_stmt); } @@ -860,7 +859,7 @@ public: tree result_reference = ctx->get_backend ()->var_expression ( loop_result_holder, expr.get_expr ()->get_locus ()); - Bstatement *assignment = ctx->get_backend ()->assignment_statement ( + tree assignment = ctx->get_backend ()->assignment_statement ( fnctx.fndecl, result_reference, compiled_expr, expr.get_locus ()); ctx->add_statement (assignment); } @@ -896,7 +895,7 @@ public: return; } - Bstatement *goto_label + tree goto_label = ctx->get_backend ()->goto_statement (label, expr.get_locus ()); ctx->add_statement (goto_label); } @@ -905,7 +904,7 @@ public: tree exit_expr = ctx->get_backend ()->exit_expression ( ctx->get_backend ()->boolean_constant_expression (true), expr.get_locus ()); - Bstatement *break_stmt + tree break_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, exit_expr); ctx->add_statement (break_stmt); } @@ -945,7 +944,7 @@ public: } } - Bstatement *goto_label + tree goto_label = ctx->get_backend ()->goto_statement (label, expr.get_locus ()); ctx->add_statement (goto_label); } diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index 65f3d2c..fb3b381 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -278,7 +278,7 @@ public: tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; return_address = ctx->get_backend ()->temporary_variable ( fndecl, code_block, return_type, NULL, address_is_taken, @@ -538,7 +538,7 @@ public: tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; return_address = ctx->get_backend ()->temporary_variable ( fndecl, code_block, return_type, NULL, address_is_taken, diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 95de611..0e7737c 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -277,7 +277,7 @@ public: tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; return_address = ctx->get_backend ()->temporary_variable ( fndecl, code_block, return_type, NULL, address_is_taken, diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h index 604d9a5..f3ee69d 100644 --- a/gcc/rust/backend/rust-compile-stmt.h +++ b/gcc/rust/backend/rust-compile-stmt.h @@ -118,7 +118,7 @@ public: auto fnctx = ctx->peek_fn (); if (ty->is_unit ()) { - Bstatement *expr_stmt + tree expr_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, init); ctx->add_statement (expr_stmt); } diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 3531930..8b74c77 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -349,7 +349,7 @@ CompileBlock::visit (HIR::BlockExpr &expr) auto compiled_expr = CompileStmt::Compile (s.get (), ctx); if (compiled_expr != nullptr) { - Bstatement *compiled_stmt + tree compiled_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, compiled_expr); ctx->add_statement (compiled_stmt); @@ -365,7 +365,7 @@ CompileBlock::visit (HIR::BlockExpr &expr) { if (result == nullptr) { - Bstatement *final_stmt + tree final_stmt = ctx->get_backend ()->expression_statement (fnctx.fndecl, compiled_expr); ctx->add_statement (final_stmt); @@ -375,7 +375,7 @@ CompileBlock::visit (HIR::BlockExpr &expr) tree result_reference = ctx->get_backend ()->var_expression ( result, expr.get_final_expr ()->get_locus ()); - Bstatement *assignment + tree assignment = ctx->get_backend ()->assignment_statement (fnctx.fndecl, result_reference, compiled_expr, @@ -438,7 +438,7 @@ CompileConditionalBlocks::visit (HIR::IfExprConseqIf &expr) start_location, end_location); ctx->push_block (else_block); - Bstatement *else_stmt_decl + tree else_stmt_decl = CompileConditionalBlocks::compile (expr.get_conseq_if_expr (), ctx, result); ctx->add_statement (else_stmt_decl); @@ -486,7 +486,7 @@ HIRCompileBase::compile_function_body ( auto compiled_expr = CompileStmt::Compile (s.get (), ctx); if (compiled_expr != nullptr) { - Bstatement *compiled_stmt + tree compiled_stmt = ctx->get_backend ()->expression_statement (fndecl, compiled_expr); ctx->add_statement (compiled_stmt); } @@ -513,7 +513,7 @@ HIRCompileBase::compile_function_body ( } else { - Bstatement *final_stmt + tree final_stmt = ctx->get_backend ()->expression_statement (fndecl, compiled_expr); ctx->add_statement (final_stmt); @@ -612,7 +612,7 @@ HIRCompileBase::coerce_to_dyn_object (tree compiled_ref, fncontext fnctx = ctx->peek_fn (); Bblock *enclosing_scope = ctx->peek_enclosing_scope (); bool is_address_taken = false; - Bstatement *ret_var_stmt = nullptr; + tree ret_var_stmt = NULL_TREE; Bvariable *dyn_tmp = ctx->get_backend ()->temporary_variable ( fnctx.fndecl, enclosing_scope, dynamic_object, constructed_trait_object, |