From: badumbatish <tanghocle...@gmail.com>

gcc/rust/ChangeLog:

        * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
        Use expr's is_simple_asm and is_inline_asm
        (CompileAsm::asm_is_simple): removed
        (CompileAsm::asm_is_inline): removed
        * backend/rust-compile-asm.h: Add docs to ASM_TREE_ARRAY_LENGTH
        * hir/tree/rust-hir-expr.h: Add is_simple_asm, is_inline_asm
        and remove #include tree
---
 gcc/rust/backend/rust-compile-asm.cc | 17 ++---------------
 gcc/rust/backend/rust-compile-asm.h  | 10 ++++++++--
 gcc/rust/hir/tree/rust-hir-expr.h    | 12 +++++++++++-
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-asm.cc 
b/gcc/rust/backend/rust-compile-asm.cc
index 8fd62dd48c9..0dd4f672008 100644
--- a/gcc/rust/backend/rust-compile-asm.cc
+++ b/gcc/rust/backend/rust-compile-asm.cc
@@ -36,9 +36,9 @@ CompileAsm::asm_build_expr (HIR::InlineAsm &expr)
                                          asm_construct_clobber_tree (expr),
                                          asm_construct_label_tree (expr)});
 
-  ASM_BASIC_P (asm_expr) = CompileAsm::asm_is_simple (expr);
+  ASM_BASIC_P (asm_expr) = expr.is_simple_asm ();
   ASM_VOLATILE_P (asm_expr) = false;
-  ASM_INLINE_P (asm_expr) = CompileAsm::asm_is_inline (expr);
+  ASM_INLINE_P (asm_expr) = expr.is_inline_asm ();
   return asm_expr;
 }
 
@@ -120,18 +120,5 @@ CompileAsm::asm_construct_label_tree (HIR::InlineAsm &expr)
   return NULL_TREE;
 }
 
-bool
-CompileAsm::asm_is_simple (HIR::InlineAsm &expr)
-{
-  // TODO: Check back later to determine how an InlineAsm is simple.
-  return true;
-}
-
-bool
-CompileAsm::asm_is_inline (HIR::InlineAsm &expr)
-{
-  // TODO: Check back later to determine how an InlineAsm is inline.
-  return true;
-}
 } // namespace Compile
 } // namespace Rust
diff --git a/gcc/rust/backend/rust-compile-asm.h 
b/gcc/rust/backend/rust-compile-asm.h
index 15ffc707986..8307d895bd5 100644
--- a/gcc/rust/backend/rust-compile-asm.h
+++ b/gcc/rust/backend/rust-compile-asm.h
@@ -40,6 +40,14 @@ public:
   // 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
+  //  build_asm_expr accepts: string, output, input, clobber and label.
+  // The function signature is
+  //
+  // tree
+  // 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;
   static tree asm_build_expr (HIR::InlineAsm &);
   static tree asm_build_stmt (location_t,
@@ -50,8 +58,6 @@ public:
   static tree asm_construct_inputs (HIR::InlineAsm &);
   static tree asm_construct_clobber_tree (HIR::InlineAsm &);
   static tree asm_construct_label_tree (HIR::InlineAsm &);
-  static bool asm_is_simple (HIR::InlineAsm &);
-  static bool asm_is_inline (HIR::InlineAsm &);
 
   CompileAsm (Context *ctx);
 
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h 
b/gcc/rust/hir/tree/rust-hir-expr.h
index 2b86d59f969..8a42c8b3a67 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -25,7 +25,6 @@
 #include "rust-hir-path.h"
 #include "rust-operators.h"
 #include "rust-expr.h"
-#include "tree.h"
 namespace Rust {
 namespace HIR {
 
@@ -4147,6 +4146,17 @@ public:
 
   std::set<AST::InlineAsmOption> get_options () { return options; }
 
+  bool is_simple_asm ()
+  {
+    // TODO: Check back later to determine how an InlineAsm is simple.
+    return true;
+  }
+
+  bool is_inline_asm ()
+  {
+    // TODO: Check back later to determine how an InlineAsm is inline.
+    return true;
+  }
   InlineAsm (location_t locus, bool is_global_asm,
             std::vector<AST::InlineAsmTemplatePiece> template_,
             std::vector<AST::TupleTemplateStr> template_strs,
-- 
2.45.2

Reply via email to