From: jjasmine <tanghocle...@gmail.com> gcc/rust/ChangeLog:
* backend/rust-compile-block.h: Scaffolding asm codegen * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. --- gcc/rust/backend/rust-compile-block.h | 2 ++ gcc/rust/backend/rust-compile-expr.cc | 4 ++++ gcc/rust/backend/rust-compile-expr.h | 1 + .../errors/borrowck/rust-bir-builder-expr-stmt.cc | 5 +++++ .../errors/borrowck/rust-bir-builder-expr-stmt.h | 1 + .../errors/borrowck/rust-bir-builder-lazyboolexpr.h | 2 ++ .../checks/errors/privacy/rust-privacy-reporter.cc | 6 ++++++ gcc/rust/checks/errors/privacy/rust-privacy-reporter.h | 1 + gcc/rust/hir/tree/rust-hir-expr.h | 10 ++++++++++ gcc/rust/hir/tree/rust-hir-visitor.h | 1 + gcc/rust/typecheck/rust-hir-type-check-expr.cc | 6 ++++++ gcc/rust/typecheck/rust-hir-type-check-expr.h | 1 + 12 files changed, 40 insertions(+) diff --git a/gcc/rust/backend/rust-compile-block.h b/gcc/rust/backend/rust-compile-block.h index b315c776513..d226b4be9f4 100644 --- a/gcc/rust/backend/rust-compile-block.h +++ b/gcc/rust/backend/rust-compile-block.h @@ -101,6 +101,7 @@ public: void visit (HIR::MatchExpr &) override {} void visit (HIR::AwaitExpr &) override {} void visit (HIR::AsyncBlockExpr &) override {} + void visit (HIR::InlineAsm &) override {} private: CompileConditionalBlocks (Context *ctx, Bvariable *result) @@ -184,6 +185,7 @@ public: void visit (HIR::MatchExpr &) override {} void visit (HIR::AwaitExpr &) override {} void visit (HIR::AsyncBlockExpr &) override {} + void visit (HIR::InlineAsm &) override {} private: CompileExprWithBlock (Context *ctx, Bvariable *result) diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index e2fa6dda09e..e23c691d1db 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -318,6 +318,10 @@ CompileExpr::visit (HIR::IfExpr &expr) ctx->add_statement (stmt); } +void +CompileExpr::visit (HIR::InlineAsm &expr) +{} + void CompileExpr::visit (HIR::IfExprConseqElse &expr) { diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index b257da5e59c..ef907d1ca62 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -68,6 +68,7 @@ public: void visit (HIR::RangeFullExpr &expr) override; void visit (HIR::RangeFromToInclExpr &expr) override; void visit (HIR::ClosureExpr &expr) override; + void visit (HIR::InlineAsm &expr) override; // TODO void visit (HIR::ErrorPropagationExpr &) override {} diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc index 3515bdf030b..8d4d90aab80 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc @@ -21,6 +21,7 @@ #include "rust-bir-builder-lazyboolexpr.h" #include "rust-bir-builder-pattern.h" #include "rust-bir-builder-struct.h" +#include "rust-hir-expr.h" namespace Rust { namespace BIR { @@ -317,6 +318,10 @@ ExprStmtBuilder::visit (HIR::CallExpr &expr) expr.get_locus (), true); } +void +ExprStmtBuilder::visit (HIR::InlineAsm &expr) +{} + void ExprStmtBuilder::visit (HIR::MethodCallExpr &expr) {} diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.h b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.h index 3a58611e338..574f0f36fdd 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.h @@ -99,6 +99,7 @@ protected: // Expr void visit (HIR::WhileLetLoopExpr &expr) override; void visit (HIR::IfExpr &expr) override; void visit (HIR::IfExprConseqElse &expr) override; + void visit (HIR::InlineAsm &expr) override; void visit (HIR::IfLetExpr &expr) override; void visit (HIR::IfLetExprConseqElse &expr) override; diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h b/gcc/rust/checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h index 3f46d57ea51..8c1cd449aba 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h @@ -213,6 +213,8 @@ public: return_place (ExprStmtBuilder (ctx).build (expr), expr.get_locus ()); } + void visit (HIR::InlineAsm &expr) override {} + protected: // Illegal at this position. void visit (HIR::StructExprFieldIdentifier &field) override { diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc index d16d6ed454c..2e810bf136f 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc @@ -283,6 +283,12 @@ PrivacyReporter::visit (HIR::TypePathSegmentFunction &) // FIXME: Do we need to do anything for this? } +void +PrivacyReporter::visit (HIR::InlineAsm &) +{ + return; +} + void PrivacyReporter::visit (HIR::TypePath &path) { diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h index 6f2937ce14b..c4f94ab3ed7 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h @@ -126,6 +126,7 @@ types virtual void visit (HIR::MatchExpr &expr); virtual void visit (HIR::AwaitExpr &expr); virtual void visit (HIR::AsyncBlockExpr &expr); + virtual void visit (HIR::InlineAsm &expr); virtual void visit (HIR::EnumItemTuple &); virtual void visit (HIR::EnumItemStruct &); diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 5d2cdd1814a..7b2e32ec259 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -4162,6 +4162,16 @@ public: options (std::move (options)) {} + + // This function checks if the assembly macro is "simple" or not, according to + // the tree defition (tree.h) of the + bool is_simple () + { + return operands.size () == 0 && clobber_abi.size () == 0 + && options.size () == 0; + } + + bool is_inline_asm () { return !is_global_asm; } }; } // namespace HIR } // namespace Rust diff --git a/gcc/rust/hir/tree/rust-hir-visitor.h b/gcc/rust/hir/tree/rust-hir-visitor.h index 72609f4c850..e69e951d656 100644 --- a/gcc/rust/hir/tree/rust-hir-visitor.h +++ b/gcc/rust/hir/tree/rust-hir-visitor.h @@ -450,6 +450,7 @@ public: virtual void visit (IfExprConseqElse &expr) = 0; virtual void visit (IfLetExpr &expr) = 0; virtual void visit (IfLetExprConseqElse &expr) = 0; + virtual void visit (InlineAsm &expr) = 0; virtual void visit (MatchExpr &expr) = 0; virtual void visit (AwaitExpr &expr) = 0; virtual void visit (AsyncBlockExpr &expr) = 0; diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc index 38734d58948..6635f13ea04 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc @@ -775,6 +775,12 @@ TypeCheckExpr::visit (HIR::RangeToExpr &expr) infered = SubstMapperInternal::Resolve (adt, subst); } +void +TypeCheckExpr::visit (HIR::InlineAsm &expr) +{ + return; +} + void TypeCheckExpr::visit (HIR::RangeFullExpr &expr) { diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h index 45fc330c089..7192cf4dbda 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.h +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h @@ -71,6 +71,7 @@ public: void visit (HIR::RangeFromToInclExpr &expr) override; void visit (HIR::WhileLoopExpr &expr) override; void visit (HIR::ClosureExpr &expr) override; + void visit (HIR::InlineAsm &expr) override; // TODO void visit (HIR::ErrorPropagationExpr &) override {} -- 2.45.2