aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjjasmine <tanghocle456@gmail.com>2024-06-23 19:47:17 -0700
committerCohenArthur <arthur.cohen@embecosm.com>2024-09-02 09:44:55 +0000
commitf9374ddf4782d5131dd4f3e3226baa5c989e99e7 (patch)
tree2aedf481cb876224f007b3d6b40dfa4d55f8e9c3 /gcc
parent163bd136710516f05bc197fec773e3009edf8319 (diff)
downloadgcc-f9374ddf4782d5131dd4f3e3226baa5c989e99e7.zip
gcc-f9374ddf4782d5131dd4f3e3226baa5c989e99e7.tar.gz
gcc-f9374ddf4782d5131dd4f3e3226baa5c989e99e7.tar.bz2
Setting up interfaces for codegen
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Setting up interfaces for codegen * hir/tree/rust-hir-expr.h: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc6
-rw-r--r--gcc/rust/hir/tree/rust-hir-expr.h26
2 files changed, 30 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index ab10af7..48493e0 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -321,8 +321,10 @@ CompileExpr::visit (HIR::IfExpr &expr)
void
CompileExpr::visit (HIR::InlineAsm &expr)
{
- tree test_string = build_string(expr.template_strs[0].symbol.size() + 1, expr.template_strs[0].symbol.c_str());
- debug(test_string);
+ // translated = build_asm_expr()(expr.get_locus(),
+ // expr.construct_string_tree(), expr.construct_outputs(),
+ // expr.construct_inputs(), expr.construct_clobber_tree(),
+ // expr.construct_label_tree(), expr.is_simple(), expr.is_inline_asm());
}
void
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h
index d82462e..ad51af3 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -25,6 +25,7 @@
#include "rust-hir-path.h"
#include "rust-operators.h"
#include "rust-expr.h"
+#include "tree.h"
namespace Rust {
namespace HIR {
@@ -4163,8 +4164,33 @@ public:
{}
+ tree construct_string_tree ()
+ {
+ if (template_strs.empty ())
+ return build_string (1, "");
+ // Initialize to NULL_TREE
+ tree string_chain = NULL_TREE;
+
+ for (const auto &template_str : template_strs)
+ {
+ auto str = template_str.symbol;
+ auto string_tree = build_string (str.size () + 1, str.c_str ());
+
+ string_chain = tree_cons (NULL_TREE, string_tree, string_chain);
+ }
+ // Reverse the chain before returning
+ return nreverse (string_chain);
+ }
+
+ tree construct_clobber_tree () { return NULL_TREE; }
+ tree construct_label_tree () { return NULL_TREE; }
+ tree construct_inputs () { return NULL_TREE; }
+ tree construct_outputs () { return NULL_TREE; }
// This function checks if the assembly macro is "simple" or not, according to
// the tree defition (tree.h) of the
+
+ // SIMPLE indicates whether there was anything at all after the
+ // string in the asm expression
bool is_simple ()
{
return operands.size () == 0 && clobber_abi.size () == 0