diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-09-04 23:59:36 -0700 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:17 +0100 |
commit | 81397a9f53440ed6fb816480784fd9b14a3fca57 (patch) | |
tree | 76a41d0ebf02be308f7262f3fd3c260fcd783a1f /gcc/rust/backend/rust-compile-asm.cc | |
parent | 9753ae307b89cc1e6934ecc16736abe2158a7333 (diff) | |
download | gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.zip gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.tar.gz gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.tar.bz2 |
gccrs: Provide input operand for gccrs
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs):
Provide input operand for gccrs
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Move expr to In
(expand_inline_asm_strings):
Add comments to debug strings
gcc/testsuite/ChangeLog:
* rust/compile/inline_asm_parse_operand.rs:
Remove inout, functionality not supported. Remove redundant {}
* rust/execute/torture/inline_asm_mov_x_5_ARM.rs: Add operand in
* rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: Likewise
Diffstat (limited to 'gcc/rust/backend/rust-compile-asm.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-asm.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-asm.cc b/gcc/rust/backend/rust-compile-asm.cc index 8294feb..e85d08d 100644 --- a/gcc/rust/backend/rust-compile-asm.cc +++ b/gcc/rust/backend/rust-compile-asm.cc @@ -1,5 +1,4 @@ #include "rust-compile-asm.h" -#include "rust-system.h" #include "rust-compile-expr.h" namespace Rust { namespace Compile { @@ -107,7 +106,26 @@ tree CompileAsm::asm_construct_inputs (HIR::InlineAsm &expr) { // TODO: Do i need to do this? - return NULL_TREE; + tree head = NULL_TREE; + for (auto &input : expr.get_operands ()) + { + if (input.get_register_type () == AST::InlineAsmOperand::RegisterType::In) + { + auto in = input.get_in (); + + tree in_tree = CompileExpr::Compile (in.expr.get (), this->ctx); + // expects a tree list + // TODO: This assumes that the input is a register + std::string expr_name = "r"; + auto name = build_string (expr_name.size () + 1, expr_name.c_str ()); + head + = chainon (head, build_tree_list (build_tree_list (NULL_TREE, name), + in_tree)); + + /*head = chainon (head, out_tree);*/ + } + } + return head; } tree |