diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-07-29 21:59:13 -0700 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:07 +0100 |
commit | e91b55fb3b48d219ac50d9744778fc91cb1f7d37 (patch) | |
tree | b7cda45e394ad16577b2c6c68c402bf724383a0e /gcc/rust | |
parent | 6ec82928851302bed173b40fb9f95d4cf53a26e4 (diff) | |
download | gcc-e91b55fb3b48d219ac50d9744778fc91cb1f7d37.zip gcc-e91b55fb3b48d219ac50d9744778fc91cb1f7d37.tar.gz gcc-e91b55fb3b48d219ac50d9744778fc91cb1f7d37.tar.bz2 |
gccrs: Lower the HIR to tree with CompileExpr
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs):
Lower the HIR to tree with CompileExpr
* backend/rust-compile-asm.h: Remove static from method
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/backend/rust-compile-asm.cc | 15 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-asm.h | 18 |
2 files changed, 20 insertions, 13 deletions
diff --git a/gcc/rust/backend/rust-compile-asm.cc b/gcc/rust/backend/rust-compile-asm.cc index 30a8cac..32ad84e 100644 --- a/gcc/rust/backend/rust-compile-asm.cc +++ b/gcc/rust/backend/rust-compile-asm.cc @@ -1,5 +1,6 @@ #include "rust-compile-asm.h" #include "rust-system.h" +#include "rust-compile-expr.h" namespace Rust { namespace Compile { @@ -82,14 +83,20 @@ tree CompileAsm::asm_construct_outputs (HIR::InlineAsm &expr) { // TODO: Do i need to do this? - int count = 0; + tree head = NULL_TREE; for (auto &output : expr.get_operands ()) { - if (output.register_type == AST::InlineAsmOperand::RegisterType::Out) - count++; + if (output.get_register_type () + == AST::InlineAsmOperand::RegisterType::Out) + { + auto out = output.get_out (); + tree out_tree = CompileExpr::Compile (out.expr.get (), this->ctx); + Backend::debug (out_tree); + /*head = chainon (head, out_tree);*/ + } } - return NULL_TREE; + return head; } tree diff --git a/gcc/rust/backend/rust-compile-asm.h b/gcc/rust/backend/rust-compile-asm.h index 05bb99a..9779a4a 100644 --- a/gcc/rust/backend/rust-compile-asm.h +++ b/gcc/rust/backend/rust-compile-asm.h @@ -46,15 +46,15 @@ public: // 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, - const std::array<tree, ASM_TREE_ARRAY_LENGTH> &); - - static tree asm_construct_string_tree (HIR::InlineAsm &); - static tree asm_construct_outputs (HIR::InlineAsm &); - static tree asm_construct_inputs (HIR::InlineAsm &); - static tree asm_construct_clobber_tree (HIR::InlineAsm &); - static tree asm_construct_label_tree (HIR::InlineAsm &); + tree asm_build_expr (HIR::InlineAsm &); + tree asm_build_stmt (location_t, + const std::array<tree, ASM_TREE_ARRAY_LENGTH> &); + + tree asm_construct_string_tree (HIR::InlineAsm &); + tree asm_construct_outputs (HIR::InlineAsm &); + tree asm_construct_inputs (HIR::InlineAsm &); + tree asm_construct_clobber_tree (HIR::InlineAsm &); + tree asm_construct_label_tree (HIR::InlineAsm &); CompileAsm (Context *ctx); |