diff options
author | David Faust <david.faust@oracle.com> | 2021-11-15 11:29:10 -0800 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2021-11-16 13:02:11 -0800 |
commit | 7a751f354a91a8459b877c60a5e5d78203aeb3ce (patch) | |
tree | 6905b25bbe6a6e9042ee93992e752987ed22dc15 /gcc/rust/backend | |
parent | 97c98deec7d4c698d7b8ee8a4e56888d5d85b8bd (diff) | |
download | gcc-7a751f354a91a8459b877c60a5e5d78203aeb3ce.zip gcc-7a751f354a91a8459b877c60a5e5d78203aeb3ce.tar.gz gcc-7a751f354a91a8459b877c60a5e5d78203aeb3ce.tar.bz2 |
Replace Btype use with GCC tree
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 102 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 6 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 26 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-extern.h | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-fnparam.h | 8 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 16 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 8 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-stmt.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-tyty.h | 16 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-var-decl.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 6 |
11 files changed, 98 insertions, 98 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 396cb10..82c02f8 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -60,20 +60,20 @@ public: ok = tyctx->lookup_type (ref, &lookup); rust_assert (ok); - Btype *compiled = TyTyCompile::compile (backend, lookup); - compiled_type_map.insert (std::pair<HirId, Btype *> (ref, compiled)); + tree compiled = TyTyCompile::compile (backend, lookup); + compiled_type_map.insert (std::pair<HirId, tree > (ref, compiled)); builtin_range.insert (ref); } } - bool lookup_compiled_types (HirId id, ::Btype **type, + bool lookup_compiled_types (HirId id, ::tree *type, const TyTy::BaseType *ref = nullptr) { if (ref != nullptr) { for (auto it = mono.begin (); it != mono.end (); it++) { - std::pair<HirId, ::Btype *> &val = it->second; + std::pair<HirId, ::tree > &val = it->second; const TyTy::BaseType *r = it->first; if (ref->is_equal (*r)) @@ -94,14 +94,14 @@ public: return true; } - void insert_compiled_type (HirId id, ::Btype *type, + void insert_compiled_type (HirId id, ::tree type, const TyTy::BaseType *ref = nullptr) { rust_assert (builtin_range.find (id) == builtin_range.end ()); - compiled_type_map.insert (std::pair<HirId, Btype *> (id, type)); + compiled_type_map.insert (std::pair<HirId, tree > (id, type)); if (ref != nullptr) { - std::pair<HirId, ::Btype *> elem (id, type); + std::pair<HirId, ::tree > elem (id, type); mono[ref] = std::move (elem); } } @@ -247,7 +247,7 @@ public: void pop_fn () { fn_stack.pop_back (); } fncontext peek_fn () { return fn_stack.back (); } - void push_type (::Btype *t) { type_decls.push_back (t); } + void push_type (::tree t) { type_decls.push_back (t); } void push_var (::Bvariable *v) { var_decls.push_back (v); } void push_const (::Bexpression *c) { const_decls.push_back (c); } void push_function (::Bfunction *f) { func_decls.push_back (f); } @@ -322,7 +322,7 @@ private: // state std::vector<fncontext> fn_stack; std::map<HirId, ::Bvariable *> compiled_var_decls; - std::map<HirId, ::Btype *> compiled_type_map; + std::map<HirId, ::tree > compiled_type_map; std::map<HirId, ::Bfunction *> compiled_fn_map; std::map<HirId, ::Bexpression *> compiled_consts; std::map<HirId, ::Blabel *> compiled_labels; @@ -330,12 +330,12 @@ private: std::vector<::Bblock *> scope_stack; std::vector<::Bvariable *> loop_value_stack; std::vector<::Blabel *> loop_begin_labels; - std::map<const TyTy::BaseType *, std::pair<HirId, ::Btype *>> mono; + std::map<const TyTy::BaseType *, std::pair<HirId, ::tree >> mono; std::map<DefId, std::vector<std::pair<const TyTy::BaseType *, ::Bfunction *>>> mono_fns; // To GCC middle-end - std::vector<::Btype *> type_decls; + std::vector<tree> type_decls; std::vector<::Bvariable *> var_decls; std::vector<::Bexpression *> const_decls; std::vector<::Bfunction *> func_decls; @@ -344,7 +344,7 @@ private: class TyTyResolveCompile : public TyTy::TyConstVisitor { public: - static ::Btype *compile (Context *ctx, const TyTy::BaseType *ty, + static tree compile (Context *ctx, const TyTy::BaseType *ty, bool trait_object_mode = false) { TyTyResolveCompile compiler (ctx, trait_object_mode); @@ -375,16 +375,16 @@ public: void visit (const TyTy::FnType &type) override { - Backend::Btyped_identifier receiver; - std::vector<Backend::Btyped_identifier> parameters; - std::vector<Backend::Btyped_identifier> results; + Backend::typed_identifier receiver; + std::vector<Backend::typed_identifier> parameters; + std::vector<Backend::typed_identifier> results; if (!type.get_return_type ()->is_unit ()) { auto hir_type = type.get_return_type (); auto ret = TyTyResolveCompile::compile (ctx, hir_type, trait_object_mode); - results.push_back (Backend::Btyped_identifier ( + results.push_back (Backend::typed_identifier ( "_", ret, ctx->get_mappings ()->lookup_location (hir_type->get_ref ()))); } @@ -395,7 +395,7 @@ public: auto compiled_param_type = TyTyResolveCompile::compile (ctx, param_tyty, trait_object_mode); - auto compiled_param = Backend::Btyped_identifier ( + auto compiled_param = Backend::typed_identifier ( param_pair.first->as_string (), compiled_param_type, ctx->get_mappings ()->lookup_location (param_tyty->get_ref ())); @@ -414,12 +414,12 @@ public: void visit (const TyTy::FnPtr &type) override { - Btype *result_type + tree result_type = TyTyResolveCompile::compile (ctx, type.get_return_type ()); - std::vector<Btype *> parameters; + std::vector<tree > parameters; type.iterate_params ([&] (TyTy::BaseType *p) mutable -> bool { - Btype *pty = TyTyResolveCompile::compile (ctx, p); + tree pty = TyTyResolveCompile::compile (ctx, p); parameters.push_back (pty); return true; }); @@ -439,25 +439,25 @@ public: rust_assert (type.number_of_variants () == 1); TyTy::VariantDef &variant = *type.get_variants ().at (0); - std::vector<Backend::Btyped_identifier> fields; + std::vector<Backend::typed_identifier> fields; for (size_t i = 0; i < variant.num_fields (); i++) { const TyTy::StructFieldType *field = variant.get_field_at_index (i); - Btype *compiled_field_ty + tree compiled_field_ty = TyTyResolveCompile::compile (ctx, field->get_field_type ()); - Backend::Btyped_identifier f (field->get_name (), compiled_field_ty, + Backend::typed_identifier f (field->get_name (), compiled_field_ty, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); fields.push_back (std::move (f)); } - Btype *type_record; + tree type_record; if (type.is_union ()) type_record = ctx->get_backend ()->union_type (fields); else type_record = ctx->get_backend ()->struct_type (fields); - Btype *named_struct + tree named_struct = ctx->get_backend ()->named_type (type.get_name (), type_record, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); @@ -482,11 +482,11 @@ public: return; // create implicit struct - std::vector<Backend::Btyped_identifier> fields; + std::vector<Backend::typed_identifier> fields; for (size_t i = 0; i < type.num_fields (); i++) { TyTy::BaseType *field = type.get_field (i); - Btype *compiled_field_ty = TyTyResolveCompile::compile (ctx, field); + tree compiled_field_ty = TyTyResolveCompile::compile (ctx, field); // rustc uses the convention __N, where N is an integer, to // name the fields of a tuple. We follow this as well, @@ -494,15 +494,15 @@ public: // this, rather than simply emitting the integer, is that this // approach makes it simpler to use a C-only debugger, or // GDB's C mode, when debugging Rust. - Backend::Btyped_identifier f ("__" + std::to_string (i), + Backend::typed_identifier f ("__" + std::to_string (i), compiled_field_ty, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); fields.push_back (std::move (f)); } - Btype *struct_type_record = ctx->get_backend ()->struct_type (fields); - Btype *named_struct + tree struct_type_record = ctx->get_backend ()->struct_type (fields); + tree named_struct = ctx->get_backend ()->named_type (type.as_string (), struct_type_record, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); @@ -514,7 +514,7 @@ public: void visit (const TyTy::ArrayType &type) override { - Btype *element_type + tree element_type = TyTyResolveCompile::compile (ctx, type.get_element_type ()); translated = ctx->get_backend ()->array_type (element_type, type.get_capacity ()); @@ -522,7 +522,7 @@ public: void visit (const TyTy::BoolType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -530,7 +530,7 @@ public: void visit (const TyTy::IntType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -538,7 +538,7 @@ public: void visit (const TyTy::UintType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -546,7 +546,7 @@ public: void visit (const TyTy::FloatType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -554,7 +554,7 @@ public: void visit (const TyTy::USizeType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -562,7 +562,7 @@ public: void visit (const TyTy::ISizeType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -570,7 +570,7 @@ public: void visit (const TyTy::CharType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -578,7 +578,7 @@ public: void visit (const TyTy::ReferenceType &type) override { - Btype *base_compiled_type + tree base_compiled_type = TyTyResolveCompile::compile (ctx, type.get_base (), trait_object_mode); if (type.is_mutable ()) { @@ -593,7 +593,7 @@ public: void visit (const TyTy::PointerType &type) override { - Btype *base_compiled_type + tree base_compiled_type = TyTyResolveCompile::compile (ctx, type.get_base (), trait_object_mode); if (type.is_mutable ()) { @@ -608,7 +608,7 @@ public: void visit (const TyTy::StrType &type) override { - ::Btype *compiled_type = nullptr; + ::tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -633,13 +633,13 @@ public: // create implicit struct auto items = type.get_object_items (); - std::vector<Backend::Btyped_identifier> fields; + std::vector<Backend::typed_identifier> fields; - Btype *uint = ctx->get_backend ()->integer_type ( + tree uint = ctx->get_backend ()->integer_type ( true, ctx->get_backend ()->get_pointer_size ()); - Btype *uintptr_ty = ctx->get_backend ()->pointer_type (uint); + tree uintptr_ty = ctx->get_backend ()->pointer_type (uint); - Backend::Btyped_identifier f ("__receiver_trait_obj_ptr", uintptr_ty, + Backend::typed_identifier f ("__receiver_trait_obj_ptr", uintptr_ty, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); fields.push_back (std::move (f)); @@ -647,18 +647,18 @@ public: for (size_t i = 0; i < items.size (); i++) { // mrustc seems to make a vtable consisting of uintptr's - Btype *uint = ctx->get_backend ()->integer_type ( + tree uint = ctx->get_backend ()->integer_type ( true, ctx->get_backend ()->get_pointer_size ()); - Btype *uintptr_ty = ctx->get_backend ()->pointer_type (uint); + tree uintptr_ty = ctx->get_backend ()->pointer_type (uint); - Backend::Btyped_identifier f ("__" + std::to_string (i), uintptr_ty, + Backend::typed_identifier f ("__" + std::to_string (i), uintptr_ty, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); fields.push_back (std::move (f)); } - Btype *type_record = ctx->get_backend ()->struct_type (fields); - Btype *named_struct + tree type_record = ctx->get_backend ()->struct_type (fields); + tree named_struct = ctx->get_backend ()->named_type (type.get_name (), type_record, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); @@ -679,7 +679,7 @@ private: Context *ctx; bool trait_object_mode; - ::Btype *translated; + ::tree translated; size_t recursion_count; static const size_t kDefaultRecusionLimit = 5; diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 594cfff..0279ef9 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -150,7 +150,7 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, { TyTy::ReferenceType *r = static_cast<TyTy::ReferenceType *> (receiver); auto indirect_ty = r->get_base (); - Btype *indrect_compiled_tyty + tree indrect_compiled_tyty = TyTyResolveCompile::compile (ctx, indirect_ty); Bexpression *indirect @@ -171,7 +171,7 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, expr_locus); // cast it to the correct fntype - Btype *expected_fntype = TyTyResolveCompile::compile (ctx, fntype, true); + tree expected_fntype = TyTyResolveCompile::compile (ctx, fntype, true); Bexpression *fn_convert_expr = ctx->get_backend ()->convert_expression (expected_fntype, fn_vtable_access, expr_locus); @@ -370,7 +370,7 @@ CompileExpr::resolve_operator_overload ( break; case Resolver::Adjustment::AdjustmentType::DEREF_REF: - Btype *expected_type + tree expected_type = TyTyResolveCompile::compile (ctx, adjustment.get_expected ()); self = ctx->get_backend ()->indirect_expression (expected_type, self, diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index b4079f7..d2f79ec 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -58,7 +58,7 @@ public: TyTy::ReferenceType *r = static_cast<TyTy::ReferenceType *> (tuple_expr_ty); TyTy::BaseType *tuple_type = r->get_base (); - Btype *tuple_tyty = TyTyResolveCompile::compile (ctx, tuple_type); + tree tuple_tyty = TyTyResolveCompile::compile (ctx, tuple_type); Bexpression *indirect = ctx->get_backend ()->indirect_expression (tuple_tyty, receiver_ref, @@ -88,7 +88,7 @@ public: return; } - Btype *tuple_type = TyTyResolveCompile::compile (ctx, tyty); + tree tuple_type = TyTyResolveCompile::compile (ctx, tyty); rust_assert (tuple_type != nullptr); // this assumes all fields are in order from type resolution @@ -259,7 +259,7 @@ public: return; } - Btype *type = TyTyResolveCompile::compile (ctx, tyty); + tree type = TyTyResolveCompile::compile (ctx, tyty); translated = ctx->get_backend ()->integer_constant_expression (type, ival); } @@ -285,7 +285,7 @@ public: return; } - Btype *type = TyTyResolveCompile::compile (ctx, tyty); + tree type = TyTyResolveCompile::compile (ctx, tyty); translated = ctx->get_backend ()->float_constant_expression (type, fval); } @@ -341,7 +341,7 @@ public: indexes.push_back (i); } - Btype *array_type = TyTyResolveCompile::compile (ctx, array_tyty); + tree array_type = TyTyResolveCompile::compile (ctx, array_tyty); Bexpression *constructed = ctx->get_backend ()->array_constructor_expression ( array_type, indexes, vals, expr.get_locus ()); @@ -414,7 +414,7 @@ public: TyTy::ArrayType *array_tyty = static_cast<TyTy::ArrayType *> (tyty); capacity_expr = array_tyty->get_capacity (); - Btype *array_type = TyTyResolveCompile::compile (ctx, array_tyty); + tree array_type = TyTyResolveCompile::compile (ctx, array_tyty); rust_assert (array_type != nullptr); expr.get_internal_elements ()->accept_vis (*this); @@ -517,7 +517,7 @@ public: { fncontext fnctx = ctx->peek_fn (); Bblock *enclosing_scope = ctx->peek_enclosing_scope (); - Btype *block_type = TyTyResolveCompile::compile (ctx, if_type); + tree block_type = TyTyResolveCompile::compile (ctx, if_type); bool is_address_taken = false; Bstatement *ret_var_stmt = nullptr; @@ -554,7 +554,7 @@ public: { fncontext fnctx = ctx->peek_fn (); Bblock *enclosing_scope = ctx->peek_enclosing_scope (); - Btype *block_type = TyTyResolveCompile::compile (ctx, if_type); + tree block_type = TyTyResolveCompile::compile (ctx, if_type); bool is_address_taken = false; Bstatement *ret_var_stmt = nullptr; @@ -590,7 +590,7 @@ public: { fncontext fnctx = ctx->peek_fn (); Bblock *enclosing_scope = ctx->peek_enclosing_scope (); - Btype *block_type = TyTyResolveCompile::compile (ctx, block_tyty); + tree block_type = TyTyResolveCompile::compile (ctx, block_tyty); bool is_address_taken = false; Bstatement *ret_var_stmt = nullptr; @@ -640,7 +640,7 @@ public: return; } - Btype *type = TyTyResolveCompile::compile (ctx, tyty); + tree type = TyTyResolveCompile::compile (ctx, tyty); rust_assert (type != nullptr); // this assumes all fields are in order from type resolution and if a base @@ -705,7 +705,7 @@ public: &field_index); rust_assert (ok); - Btype *adt_tyty = TyTyResolveCompile::compile (ctx, adt); + tree adt_tyty = TyTyResolveCompile::compile (ctx, adt); Bexpression *indirect = ctx->get_backend ()->indirect_expression (adt_tyty, receiver_ref, true, expr.get_locus ()); @@ -743,7 +743,7 @@ public: if (needs_temp) { Bblock *enclosing_scope = ctx->peek_enclosing_scope (); - Btype *block_type = TyTyResolveCompile::compile (ctx, block_tyty); + tree block_type = TyTyResolveCompile::compile (ctx, block_tyty); bool is_address_taken = false; Bstatement *ret_var_stmt = nullptr; @@ -975,7 +975,7 @@ public: return; } - Btype *expected_type = TyTyResolveCompile::compile (ctx, tyty); + tree expected_type = TyTyResolveCompile::compile (ctx, tyty); bool known_valid = true; translated = ctx->get_backend ()->indirect_expression (expected_type, main_expr, diff --git a/gcc/rust/backend/rust-compile-extern.h b/gcc/rust/backend/rust-compile-extern.h index 6e5a3fd..2d3d251 100644 --- a/gcc/rust/backend/rust-compile-extern.h +++ b/gcc/rust/backend/rust-compile-extern.h @@ -55,7 +55,7 @@ public: // FIXME this is assuming C ABI std::string asm_name = name; - Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); bool is_external = true; bool is_hidden = false; bool in_unique_section = false; @@ -128,7 +128,7 @@ public: return; } - ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); + tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); compiled_fn_type = ctx->get_backend ()->specify_abi_attribute (compiled_fn_type, fntype->get_abi ()); diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h index b246948..903f839 100644 --- a/gcc/rust/backend/rust-compile-fnparam.h +++ b/gcc/rust/backend/rust-compile-fnparam.h @@ -30,7 +30,7 @@ class CompileFnParam : public HIRCompileBase public: static Bvariable *compile (Context *ctx, Bfunction *fndecl, - HIR::FunctionParam *param, Btype *decl_type, + HIR::FunctionParam *param, tree decl_type, Location locus) { CompileFnParam compiler (ctx, fndecl, decl_type, locus); @@ -51,14 +51,14 @@ public: } private: - CompileFnParam (Context *ctx, ::Bfunction *fndecl, ::Btype *decl_type, + CompileFnParam (Context *ctx, ::Bfunction *fndecl, tree decl_type, Location locus) : HIRCompileBase (ctx), fndecl (fndecl), decl_type (decl_type), locus (locus), translated (nullptr) {} ::Bfunction *fndecl; - ::Btype *decl_type; + tree decl_type; Location locus; ::Bvariable *translated; }; @@ -67,7 +67,7 @@ class CompileSelfParam : public HIRCompileBase { public: static Bvariable *compile (Context *ctx, Bfunction *fndecl, - HIR::SelfParam &self, Btype *decl_type, + HIR::SelfParam &self, tree decl_type, Location locus) { bool is_immutable diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index 05c7910..51a691f 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -60,7 +60,7 @@ public: &resolved_type); rust_assert (ok); - ::Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); Bexpression *value = CompileExpr::Compile (constant.get_expr (), ctx); const Resolver::CanonicalPath *canonical_path = nullptr; @@ -136,7 +136,7 @@ public: } // convert to the actual function type - ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); + tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); unsigned int flags = 0; @@ -178,7 +178,7 @@ public: return; } - Btype *self_type = TyTyResolveCompile::compile (ctx, self_tyty_lookup); + tree self_type = TyTyResolveCompile::compile (ctx, self_tyty_lookup); if (self_type == nullptr) { rust_error_at (function.get_self_param ().get_locus (), @@ -275,7 +275,7 @@ public: Bvariable *return_address = nullptr; if (function.has_function_return_type ()) { - Btype *return_type = TyTyResolveCompile::compile (ctx, tyret); + tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; Bstatement *ret_var_stmt = nullptr; @@ -349,7 +349,7 @@ public: rust_assert (concrete != nullptr); TyTy::BaseType *resolved_type = concrete; - ::Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); Bexpression *value = CompileExpr::Compile (constant.get_expr ().get (), ctx); @@ -404,7 +404,7 @@ public: } // convert to the actual function type - ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); + tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); HIR::TraitFunctionDecl &function = func.get_decl (); unsigned int flags = 0; @@ -440,7 +440,7 @@ public: return; } - Btype *self_type = TyTyResolveCompile::compile (ctx, self_tyty_lookup); + tree self_type = TyTyResolveCompile::compile (ctx, self_tyty_lookup); if (self_type == nullptr) { rust_error_at (function.get_self ().get_locus (), @@ -536,7 +536,7 @@ public: Bvariable *return_address = nullptr; if (function.has_return_type ()) { - Btype *return_type = TyTyResolveCompile::compile (ctx, tyret); + tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; Bstatement *ret_var_stmt = nullptr; diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 6691c2a..87c577c 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -61,7 +61,7 @@ public: &resolved_type); rust_assert (ok); - Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); Bexpression *value = CompileExpr::Compile (var.get_expr (), ctx); const Resolver::CanonicalPath *canonical_path = nullptr; @@ -97,7 +97,7 @@ public: &resolved_type); rust_assert (ok); - ::Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); Bexpression *value = CompileExpr::Compile (constant.get_expr (), ctx); const Resolver::CanonicalPath *canonical_path = nullptr; @@ -174,7 +174,7 @@ public: fntype->override_context (); } - ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); + tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); unsigned int flags = 0; bool is_main_fn = function.get_function_name ().compare ("main") == 0; @@ -275,7 +275,7 @@ public: Bvariable *return_address = nullptr; if (function.has_function_return_type ()) { - Btype *return_type = TyTyResolveCompile::compile (ctx, tyret); + tree return_type = TyTyResolveCompile::compile (ctx, tyret); bool address_is_taken = false; Bstatement *ret_var_stmt = nullptr; diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h index 754c5d2..80566f6 100644 --- a/gcc/rust/backend/rust-compile-stmt.h +++ b/gcc/rust/backend/rust-compile-stmt.h @@ -56,7 +56,7 @@ public: &resolved_type); rust_assert (ok); - ::Btype *type = TyTyResolveCompile::compile (ctx, resolved_type); + tree type = TyTyResolveCompile::compile (ctx, resolved_type); Bexpression *value = CompileExpr::Compile (constant.get_expr (), ctx); const Resolver::CanonicalPath *canonical_path = nullptr; diff --git a/gcc/rust/backend/rust-compile-tyty.h b/gcc/rust/backend/rust-compile-tyty.h index 180b971..04a3ecd 100644 --- a/gcc/rust/backend/rust-compile-tyty.h +++ b/gcc/rust/backend/rust-compile-tyty.h @@ -34,7 +34,7 @@ namespace Compile { class TyTyCompile : public TyTy::TyVisitor { public: - static ::Btype *compile (::Backend *backend, TyTy::BaseType *ty) + static tree compile (::Backend *backend, TyTy::BaseType *ty) { TyTyCompile compiler (backend); ty->accept_vis (compiler); @@ -72,15 +72,15 @@ public: void visit (TyTy::FnType &type) override { - Backend::Btyped_identifier receiver; - std::vector<Backend::Btyped_identifier> parameters; - std::vector<Backend::Btyped_identifier> results; + Backend::typed_identifier receiver; + std::vector<Backend::typed_identifier> parameters; + std::vector<Backend::typed_identifier> results; if (!type.get_return_type ()->is_unit ()) { auto hir_type = type.get_return_type (); auto ret = TyTyCompile::compile (backend, hir_type); - results.push_back (Backend::Btyped_identifier ( + results.push_back (Backend::typed_identifier ( "_", ret, mappings->lookup_location (hir_type->get_ref ()))); } @@ -90,7 +90,7 @@ public: auto param_tyty = params.second; auto compiled_param_type = TyTyCompile::compile (backend, param_tyty); - auto compiled_param = Backend::Btyped_identifier ( + auto compiled_param = Backend::typed_identifier ( param_pattern->as_string (), compiled_param_type, mappings->lookup_location (param_tyty->get_ref ())); @@ -227,7 +227,7 @@ public: void visit (TyTy::StrType &) override { - Btype *raw_str = backend->raw_str_type (); + tree raw_str = backend->raw_str_type (); translated = backend->named_type ("str", raw_str, Linemap::predeclared_location ()); } @@ -248,7 +248,7 @@ private: {} ::Backend *backend; - ::Btype *translated; + tree translated; Analysis::Mappings *mappings; }; diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index 7a86e15..deabd7d 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -70,7 +70,7 @@ private: {} ::Bfunction *fndecl; - ::Btype *translated_type; + tree translated_type; Location locus; ::Bvariable *translated; }; diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index e53993a..cb736f3 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -72,7 +72,7 @@ CompileExpr::visit (HIR::CallExpr &expr) { rust_assert (tyty->get_kind () == TyTy::TypeKind::ADT); TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (tyty); - Btype *compiled_adt_type = TyTyResolveCompile::compile (ctx, tyty); + tree compiled_adt_type = TyTyResolveCompile::compile (ctx, tyty); rust_assert (!adt->is_enum ()); rust_assert (adt->number_of_variants () == 1); @@ -275,7 +275,7 @@ CompileExpr::visit (HIR::MethodCallExpr &expr) break; case Resolver::Adjustment::AdjustmentType::DEREF_REF: - Btype *expected_type + tree expected_type = TyTyResolveCompile::compile (ctx, adjustment.get_expected ()); self = ctx->get_backend ()->indirect_expression ( expected_type, self, true, /* known_valid*/ @@ -587,7 +587,7 @@ HIRCompileBase::coerce_to_dyn_object (Bexpression *compiled_ref, const TyTy::DynamicObjectType *ty, Location locus) { - Btype *dynamic_object = TyTyResolveCompile::compile (ctx, ty); + tree dynamic_object = TyTyResolveCompile::compile (ctx, ty); //' this assumes ordering and current the structure is // __trait_object_ptr |