aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-asm.cc8
-rw-r--r--gcc/rust/backend/rust-compile-asm.h67
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc4
3 files changed, 10 insertions, 69 deletions
diff --git a/gcc/rust/backend/rust-compile-asm.cc b/gcc/rust/backend/rust-compile-asm.cc
index 045cc28..8294feb 100644
--- a/gcc/rust/backend/rust-compile-asm.cc
+++ b/gcc/rust/backend/rust-compile-asm.cc
@@ -7,14 +7,8 @@ namespace Compile {
CompileAsm::CompileAsm (Context *ctx)
: HIRCompileBase (ctx), translated (error_mark_node)
{}
-void
-CompileAsm::visit (HIR::InlineAsm &expr)
-{
- ctx->add_statement (asm_build_expr (expr));
-}
-
tree
-CompileAsm::asm_build_expr (HIR::InlineAsm &expr)
+CompileAsm::tree_codegen_asm (HIR::InlineAsm &expr)
{
auto asm_expr
= asm_build_stmt (expr.get_locus (), {asm_construct_string_tree (expr),
diff --git a/gcc/rust/backend/rust-compile-asm.h b/gcc/rust/backend/rust-compile-asm.h
index 9779a4a..402d950 100644
--- a/gcc/rust/backend/rust-compile-asm.h
+++ b/gcc/rust/backend/rust-compile-asm.h
@@ -1,4 +1,3 @@
-
// Copyright (C) 2020-2024 Free Software Foundation, Inc.
// This file is part of GCC.
@@ -26,16 +25,11 @@
namespace Rust {
namespace Compile {
-class CompileAsm : private HIRCompileBase, protected HIR::HIRExpressionVisitor
+class CompileAsm : private HIRCompileBase
{
private:
tree translated;
-public:
- // WE WILL OPEN THIS UP WHEN WE WANT TO ADD A DEDICATED PASS OF HIR'S ASM
- // translation.
- // static tree Compile (HIR::Expr *expr, Context *ctx);
-
// RELEVANT MEMBER FUNCTIONS
// The limit is 5 because it stands for the 5 things that the C version of
@@ -46,7 +40,6 @@ public:
// build_asm_expr (location_t loc, tree string, tree outputs, tree inputs,
// tree clobbers, tree labels, bool simple, bool is_inline)
static const int ASM_TREE_ARRAY_LENGTH = 5;
- tree asm_build_expr (HIR::InlineAsm &);
tree asm_build_stmt (location_t,
const std::array<tree, ASM_TREE_ARRAY_LENGTH> &);
@@ -56,60 +49,14 @@ public:
tree asm_construct_clobber_tree (HIR::InlineAsm &);
tree asm_construct_label_tree (HIR::InlineAsm &);
- CompileAsm (Context *ctx);
-
- void visit (HIR::InlineAsm &) override;
+public:
+ // WE WILL OPEN THIS UP WHEN WE WANT TO ADD A DEDICATED PASS OF HIR'S ASM
+ // translation.
+ // static tree Compile (HIR::Expr *expr, Context *ctx);
- // NON RELEVANT MEMBER FUNCTIONS
+ CompileAsm (Context *ctx);
- void visit (HIR::TupleIndexExpr &) override {}
- void visit (HIR::TupleExpr &) override {}
- void visit (HIR::ReturnExpr &) override {}
- void visit (HIR::CallExpr &) override {}
- void visit (HIR::MethodCallExpr &) override {}
- void visit (HIR::LiteralExpr &) override {}
- void visit (HIR::AssignmentExpr &) override {}
- void visit (HIR::CompoundAssignmentExpr &) override {}
- void visit (HIR::ArrayIndexExpr &) override {}
- void visit (HIR::ArrayExpr &) override {}
- void visit (HIR::ArithmeticOrLogicalExpr &) override {}
- void visit (HIR::ComparisonExpr &) override {}
- void visit (HIR::LazyBooleanExpr &) override {}
- void visit (HIR::NegationExpr &) override {}
- void visit (HIR::TypeCastExpr &) override {}
- void visit (HIR::IfExpr &) override {}
- void visit (HIR::IfExprConseqElse &) override {}
- void visit (HIR::BlockExpr &) override {}
- void visit (HIR::UnsafeBlockExpr &) override {}
- void visit (HIR::StructExprStruct &struct_) override {}
- void visit (HIR::StructExprStructFields &struct_) override {}
- void visit (HIR::GroupedExpr &) override {}
- void visit (HIR::FieldAccessExpr &) override {}
- void visit (HIR::QualifiedPathInExpression &) override {}
- void visit (HIR::PathInExpression &) override {}
- void visit (HIR::LoopExpr &) override {}
- void visit (HIR::WhileLoopExpr &) override {}
- void visit (HIR::BreakExpr &) override {}
- void visit (HIR::ContinueExpr &) override {}
- void visit (HIR::BorrowExpr &) override {}
- void visit (HIR::DereferenceExpr &) override {}
- void visit (HIR::MatchExpr &) override {}
- void visit (HIR::RangeFromToExpr &) override {}
- void visit (HIR::RangeFromExpr &) override {}
- void visit (HIR::RangeToExpr &) override {}
- void visit (HIR::RangeFullExpr &) override {}
- void visit (HIR::RangeFromToInclExpr &) override {}
- void visit (HIR::ClosureExpr &) override {}
- void visit (HIR::ErrorPropagationExpr &) override {}
- void visit (HIR::RangeToInclExpr &) override {}
- void visit (HIR::WhileLetLoopExpr &) override {}
- void visit (HIR::IfLetExpr &) override {}
- void visit (HIR::IfLetExprConseqElse &) override {}
- void visit (HIR::AwaitExpr &) override {}
- void visit (HIR::AsyncBlockExpr &) override {}
- void visit (HIR::StructExprFieldIdentifier &) override {}
- void visit (HIR::StructExprFieldIdentifierValue &) override {}
- void visit (HIR::StructExprFieldIndexValue &) override {}
+ tree tree_codegen_asm (HIR::InlineAsm &);
};
} // namespace Compile
} // namespace Rust
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index 31f9809..4c06e8e 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -321,8 +321,8 @@ CompileExpr::visit (HIR::IfExpr &expr)
void
CompileExpr::visit (HIR::InlineAsm &expr)
{
- CompileAsm a (ctx);
- a.visit (expr);
+ CompileAsm asm_codegen (ctx);
+ ctx->add_statement (asm_codegen.tree_codegen_asm (expr));
// translated = build_asm_expr (0, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,
// NULL_TREE, true, true);
// CompileAsm::asm_build_expr (expr);