diff options
author | jjasmine <tanghocle456@gmail.com> | 2024-06-10 16:54:34 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-06-13 15:31:07 +0000 |
commit | 9d812b8af76d7517f21060708deb060ccf8c7a8c (patch) | |
tree | a652ef2355f8c1f70754487b3d415a1765bbe846 /gcc/rust/ast/rust-expr.h | |
parent | 57c1f3a0f0d974662ded3a48200318dde763e4c6 (diff) | |
download | gcc-9d812b8af76d7517f21060708deb060ccf8c7a8c.zip gcc-9d812b8af76d7517f21060708deb060ccf8c7a8c.tar.gz gcc-9d812b8af76d7517f21060708deb060ccf8c7a8c.tar.bz2 |
Partial support for operand
gcc/rust/ChangeLog:
* ast/rust-expr.h (struct InlineAsmOperand):
Partial support for operand
* expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.
(parse_label): Likewise.
* expand/rust-macro-builtins-asm.h (parse_label): Likewise.
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 30146b2..ba413da 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -7,6 +7,7 @@ #include "rust-macro.h" #include "rust-operators.h" #include "rust-system.h" +#include <memory> namespace Rust { namespace AST { @@ -4777,6 +4778,7 @@ struct InlineAsmOperand SplitInOut, Const, Sym, + Label, }; struct In @@ -4933,6 +4935,34 @@ struct InlineAsmOperand return *this; } }; + + struct Label + { + std::string label_name; + std::unique_ptr<Expr> expr; + + Label () {} + + Label (tl::optional<std::string> label_name, std::unique_ptr<Expr> expr) + : expr (std::move (expr)) + { + if (label_name.has_value ()) + this->label_name = label_name.value (); + } + Label (const struct Label &other) + { + if (other.expr) + expr = std::unique_ptr<Expr> (other.expr->clone_expr ()); + } + + Label operator= (const struct Label &other) + { + if (other.expr) + expr = std::unique_ptr<Expr> (other.expr->clone_expr ()); + return *this; + } + }; + RegisterType register_type; struct In in; @@ -4941,6 +4971,7 @@ struct InlineAsmOperand struct SplitInOut split_in_out; struct Const cnst; struct Sym sym; + struct Label label; InlineAsmOperand () {} InlineAsmOperand (const InlineAsmOperand &other) @@ -4992,6 +5023,13 @@ struct InlineAsmOperand this->sym = reg.value (); } + void set_label (const tl::optional<struct Label> ®) + { + this->register_type = Label; + if (reg.has_value ()) + this->label = reg.value (); + } + location_t locus; }; |