diff options
author | jjasmine <tanghocle456@gmail.com> | 2024-06-22 11:56:50 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-09-02 09:44:55 +0000 |
commit | b088273a2caf5260e0d22c0b4ec2c7d1213c50ee (patch) | |
tree | f51ae14015901f7a836e14454c5d3b485fa444b7 /gcc | |
parent | 716dadc80001a1d2c896f98f2713573a1616ea34 (diff) | |
download | gcc-b088273a2caf5260e0d22c0b4ec2c7d1213c50ee.zip gcc-b088273a2caf5260e0d22c0b4ec2c7d1213c50ee.tar.gz gcc-b088273a2caf5260e0d22c0b4ec2c7d1213c50ee.tar.bz2 |
Scaffolding asm codegen
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-block.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 1 | ||||
-rw-r--r-- | gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc | 5 | ||||
-rw-r--r-- | gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.h | 1 | ||||
-rw-r--r-- | gcc/rust/checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h | 2 | ||||
-rw-r--r-- | gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc | 6 | ||||
-rw-r--r-- | gcc/rust/checks/errors/privacy/rust-privacy-reporter.h | 1 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-expr.h | 10 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-visitor.h | 1 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-expr.cc | 6 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-expr.h | 1 |
12 files changed, 40 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-block.h b/gcc/rust/backend/rust-compile-block.h index 52cf057..112f7b0 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 557b9fe..2d58194 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -319,6 +319,10 @@ CompileExpr::visit (HIR::IfExpr &expr) } void +CompileExpr::visit (HIR::InlineAsm &expr) +{} + +void CompileExpr::visit (HIR::IfExprConseqElse &expr) { TyTy::BaseType *if_type = nullptr; diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index af2e1bc..8f18702 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 887b5f6..e9f1d97 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 { @@ -318,6 +319,10 @@ ExprStmtBuilder::visit (HIR::CallExpr &expr) } 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 1597ff2..d67d86f 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 0a013bd..5a475e4 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 d2e448c..048b4aa 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc @@ -284,6 +284,12 @@ PrivacyReporter::visit (HIR::TypePathSegmentFunction &) } void +PrivacyReporter::visit (HIR::InlineAsm &) +{ + return; +} + +void PrivacyReporter::visit (HIR::TypePath &path) { check_for_privacy_violation (path.get_mappings ().get_nodeid (), diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h index d54732f..c00ab37 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 59023a9..d82462e 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 09ce053..840dc2e 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 12a8b65..cd41f86 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc @@ -776,6 +776,12 @@ TypeCheckExpr::visit (HIR::RangeToExpr &expr) } void +TypeCheckExpr::visit (HIR::InlineAsm &expr) +{ + return; +} + +void TypeCheckExpr::visit (HIR::RangeFullExpr &expr) { auto lang_item_type = LangItem::Kind::RANGE_FULL; diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h index 9ea4dc6..2f4a2c5 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 {} |