aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-builtins-asm.cc
AgeCommit message (Collapse)AuthorFilesLines
2025-03-24gccrs: inline-asm: Fix some warningsArthur Cohen1-7/+17
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Special case empty strings ("\"\""). (parse_reg_operand): Remove use of the `struct` keyword. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. * expand/rust-macro-builtins.cc: Add llvm_asm! built-in macro as an alias to asm!.
2025-03-21gccrs: Remove Rust::make_uniqueOwen Avery1-4/+3
Since our bootstrap requirement has been bumped to C++14, we don't need a custom implementation of std::make_unique anymore. gcc/rust/ChangeLog: * ast/rust-ast-builder-type.cc: Remove inclusion of rust-make-unique.h. * ast/rust-ast-builder.cc: Likewise. (Builder::array): Use std::make_unique instead of Rust::make_unique. * ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise. * ast/rust-macro.h: Remove inclusion of rust-make-unique.h. (MacroRulesDefinition::mbe): Use std::make_unique instead of Rust::make_unique. (MacroRulesDefinition::decl_macro): Likewise. * ast/rust-path.h (PathInExpression::PathInExpression): Likewise. (QualifiedPathInExpression::QualifiedPathInExpression): Likewise. * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): Likewise. * expand/rust-derive-copy.cc (DeriveCopy::copy_impl): Likewise. * expand/rust-expand-format-args.cc (expand_format_args): Likewise. * expand/rust-macro-builtins-asm.cc: Remove inclusion of rust-make-unique.h. (parse_asm): Use std::make_unique instead of Rust::make_unique. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * hir/tree/rust-hir-expr.cc (StructExprStructFields::StructExprStructFields): Likewise. (StructExprStructFields::operator=): Likewise. * hir/tree/rust-hir.cc (TypePath::to_trait_bound): Likewise. * lex/rust-token.h: Remove inclusion of rust-make-unique.h. (Token::Token): Use std::make_unique instead of Rust::make_unique. * metadata/rust-import-archive.cc: Remove inclusion of rust-make-unique.h. (Import::find_archive_export_data): Use std::make_unique instead of Rust::make_unique. * metadata/rust-imports.cc: Remove inclusion of rust-make-unique.h. (Import::find_export_data): Use std::make_unique instead of Rust::make_unique. (Import::find_object_export_data): Likewise. * parse/rust-parse-impl.h: Remove inclusion of rust-make-unique.h. (Parser::parse_function_param): Use std::make_unique instead of Rust::make_unique. (Parser::parse_self_param): Likewise. (Parser::parse_array_expr): Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. * typecheck/rust-hir-type-check.cc: Remove inclusion of rust-make-unique.h. (TraitItemReference::get_type_from_fn): Use std::make_unique instead of Rust::make_unique. * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Likewise. * util/rust-make-unique.h: Removed. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Fix compiler error on ast wrong implicit construct push_backbadumbatish1-1/+2
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Fix compiler error on ast wrong implicit construct push_back
2025-03-19gccrs: Provide input operand for gccrsbadumbatish1-4/+5
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
2025-03-19gccrs: Rework InlineAsmOperandOwen Avery1-1/+2
Not thrilled with some of this boilerplate, but it does seem like an improvement. gcc/rust/ChangeLog: * ast/rust-expr.h (InlineAsmOperand): Replace multiple mutually-exclusive tl::optional fields with a std::unique_ptr and modify nested classes to allow this. Also, make getters return references where possible. * expand/rust-macro-builtins-asm.cc (parse_reg_operand_out): Pass location when constructing InlineAsmOperand. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Rehaul, Apply code review from Arthurbadumbatish1-37/+24
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::visit): Change API, public/private, comments, formatting from code review (CompileAsm::asm_build_expr): Likewise. (CompileAsm::tree_codegen_asm): Likewise. * backend/rust-compile-asm.h (class CompileAsm): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise. (parse_options): Likewise. (parse_asm_arg): Likewise. (expand_inline_asm_strings): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise. (expand_inline_asm_strings): Likewise. (expand_inline_asm_string): Likewise. * hir/tree/rust-hir-expr.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: Change comments
2025-03-19gccrs: Make inline mov compilesbadumbatish1-12/+55
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Remove debug * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): properly formatted via rust instead of c (parse_asm): formatted comment (parse_format_strings): formatted comment * hir/tree/rust-hir-expr.h: fix is_simple_asm() gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Fix format asm * rust/compile/inline_asm_parse_output_operand.rs: Fix format asm * rust/execute/torture/inline_asm_mov_x_5.rs: Move to... * rust/execute/inline_asm_mov_x_5.rs: ...here.
2025-03-19gccrs: Move strip double quotes, add scaffold expandbadumbatish1-11/+29
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Move strip double quotes to parse phase (CompileAsm::asm_construct_string_tree): Likewise * backend/rust-compile-asm.h (strip_double_quotes): Likewise * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise (expand_inline_asm): Renamed to expand_inline_asm_strings (expand_inline_asm_strings): Renamed from expand_inline_asm (parse_asm): Move strip double quotes to parse phase (parse_format_strings): Likewise * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise (expand_inline_asm_strings): Inline asm expansion fn (expand_inline_asm_string): Inline asm expansion fn
2025-03-19gccrs: Start work on expand inline asmbadumbatish1-2/+31
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Remove warnings (parse_reg_operand_out): Remove warnings (expand_inline_asm): New function for eventual expansion (parse_asm): Use expand_inline_asm gcc/testsuite/ChangeLog: * rust/execute/torture/inline_asm_mov_x_5.rs: New test.
2025-03-19gccrs: Fix the parser's operand and flags storagebadumbatish1-6/+15
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix parsing logic & reassignment logic (parse_reg_operand_in): Fix parsing (parse_reg_operand_out): Fix parsing (parse_reg_operand_inout): Fix parsing (parse_reg_operand_unexpected): Remove rust_unreachable() (parse_asm_arg): Fix parsing logic
2025-03-19gccrs: Use new constructors and control flow for operandbadumbatish1-24/+15
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): changed to class (class InlineAsmOperand): Have appropriate constructor, and getter * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Use the new implement constructors and new control flow. (parse_reg_operand_in): Likewise (parse_reg_operand_out): Likewise (parse_reg_operand_inout): Likewise (parse_reg_operand_const): Likewise
2025-03-19gccrs: Fix the parser's operand and flags storagebadumbatish1-20/+43
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Add construction for register_type * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix parsing logic & reassignment logic (parse_reg_operand_in): Fix parsing (parse_reg_operand_out): Fix parsing (parse_reg_operand_inout): Fix parsing (parse_reg_operand_unexpected): Remove rust_unreachable() (parse_asm_arg): Fix parsing logic * expand/rust-macro-builtins-asm.h: Add = operator overloading gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_operands.rs: Test now passing * rust/compile/inline_asm_parse_operand.rs: Remove _, not supported right now
2025-03-17gccrs: Safe-guard InlineAsm structsbadumbatish1-14/+13
gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): Safe-guard InlineAsm structs (struct InlineAsmOperand): Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_inout): Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Store parse result of parse_format_string(s)badumbatish1-1/+16
gcc/rust/ChangeLog: * ast/rust-expr.h (struct TupleTemplateStr): Store parse result of parse_format_string(s) * expand/rust-macro-builtins-asm.cc (parse_format_strings): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Clean up monadic operations on expected<>jjasmine1-5/+3
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Clean up monadic operations on expected<> Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Addresses warning, put warn unused in right placejjasmine1-10/+14
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Addresses warning, put warn unused in right place (parse_reg_operand_inout): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (enum WARN_UNUSED_RESULT): Likewise. (enum InlineAsmParseError): Likewise. (validate): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_clobber_abi): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_inlateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_sym): Likewise. (parse_reg_operand_unexpected): Likewise. (parse_asm): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_format_string): Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Added a test that is expected to failjjasmine1-27/+24
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): added comments (parse_options): Likewise (parse_asm_arg): Likewise (parse_asm): Likewise * expand/rust-macro-builtins-asm.h: Likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: new test * rust/compile/inline_asm_illegal_operands.rs: New test. This is expected to fail but we couldn't resolve parse_expr()'s general functionality yet Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Added tl::expected to parse_operandjjasmine1-9/+63
Added tl::expected to parse_operand by implementing the validation inside the parse_reg_operand function. gcc/rust/ChangeLog: * ast/rust-expr.h: Added tl::expected to parse_operand * expand/rust-macro-builtins-asm.cc (parse_reg): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_inout): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h: Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Scaffold expected on parse_options and asm_argjjasmine1-12/+27
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Scaffold expected on parse_options and asm_arg (parse_options): Likewise (parse_asm_arg): Likewise * expand/rust-macro-builtins-asm.h (check_and_set): Likewise (parse_label): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Finish expected parse_reg_operandjjasmine1-36/+32
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Finish expected parse_reg_operand (parse_reg_operand_unexpected): Likewise * expand/rust-macro-builtins-asm.h (parse_reg_operand_unexpected): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Finish incorporating expected of parse_reg_operandjjasmine1-88/+124
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Finish incorporating expected of parse_reg_operand (parse_reg): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_sym): Likewise. (MacroBuiltin::asm_handler): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. (parse_format_strings): Likewise. (validate): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise. (enum InlineAsmParseError): Likewise. (validate): Likewise. (parse_format_strings): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_inlateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_sym): Likewise.
2025-03-17gccrs: expand: Switch semicolon boolean to an enum instead.Arthur Cohen1-8/+12
gcc/rust/ChangeLog: * ast/rust-ast-fragment.h (enum class): Add InvocKind and AsmKind enums. * ast/rust-macro.h: Switch semicolon boolean to InvocKind enum. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. * expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * expand/rust-macro-builtins.cc (format_args_maker): Likewise. (enum class): Likewise. (inline_asm_maker): Likewise. (MacroBuiltin::sorry): Likewise. (MacroBuiltin::proc_macro_builtin): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_eager_invocations): Likewise. (MacroExpander::expand_invoc): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2025-03-17gccrs: expand: Keep track of semicoloned builtin macrosArthur Cohen1-6/+17
This is quite a rough fix (like a lot of the macro expansion code...) but it allows built-in macros to be treated as statements. I *think* asm!() might be the only one where it really matters, but also doing something like { line!(); } will now work, whereas before the macro invocation would not get expanded properly and would be ignored. gcc/rust/ChangeLog: * ast/rust-ast-fragment.h: Pass `is_semicolon` information to builtin macro transcribers. * ast/rust-macro.h: Pass semicolon information to transcriber.. * expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. * expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * expand/rust-macro-builtins.cc (format_args_maker): Likewise. (inline_asm_maker): Likewise. (MacroBuiltin::sorry): Likewise. (MacroBuiltin::proc_macro_builtin): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_invoc): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove rust_unreachable. * ast/rust-ast.cc (InlineAsm::accept_vis): Likewise. * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
2025-03-17gccrs: Partial second layer of expected in parsing asmjjasmine1-51/+30
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseDirSpec): Partial second layer of expected in parsing asm (parse_clobber_abi): Likewise (parse_operand): Likewise (parse_reg_operand): Likewise (parse_asm_arg): Likewise * expand/rust-macro-builtins-asm.h (parse_clobber_abi): Likewise (parse_reg_operand): Likewise (parse_operand): Likewise
2025-03-17gccrs: Expected first layer donejjasmine1-32/+42
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Expected first layer done (parse_reg_operand): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_asm): Likewise. (validate): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise. (validate): Likewise. (parse_format_strings): Likewise.
2025-03-17gccrs: Move parser and last_token_id to InlineAsmCtxjjasmine1-50/+50
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Move parser and last_token_id to InlineAsmCtx to prepapre for tl::expected. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise. (parse_asm_arg): Likewise. (check_and_set): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise. (parse_format_string): Likewise.
2025-03-17gccrs: Update parser to parse strings in the first stagejjasmine1-49/+13
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Update parser to parse strings in the first stage (parse_label): not needed right now
2025-03-17gccrs: Scaffolding validation of asm!jjasmine1-6/+25
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Scaffolding validation of asm! (validate): Likewise * expand/rust-macro-builtins-asm.h (validate): Likewise
2025-03-17gccrs: Partial support for operandjjasmine1-7/+55
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.
2025-03-17gccrs: Refactoring and supporting more parse_reg_operandjjasmine1-48/+73
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Refactoring and supporting more parse_reg_operand * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (rust_debug): Likewise.
2025-03-17gccrs: Fix visitor-related warningsjjasmine1-2/+17
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix visitor-related warnings * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-function-collector.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * expand/rust-derive.h: Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
2025-03-17gccrs: Add potentially_nonpromoted_keywords set strjjasmine1-80/+94
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Add potentially_nonpromoted_keywords set str (check_identifier): likewise * expand/rust-macro-builtins-asm.h (parse_format_string): likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: fix warnings
2025-03-17gccrs: Successful parse of in and inout, albeit with strjjasmine1-10/+98
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Successful parse of in and inout, albeit with str (check_identifier): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (parse_format_string): Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: New test.
2025-03-17gccrs: Fix warningsjjasmine1-3/+7
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix compile warnings. (parse_options): Likewise. (parse_asm): Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs:
2025-03-17gccrs: Refactoring for inline asm prjjasmine1-62/+77
gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): major refactoring of inline asm, mostly concerns naming convention, trinary conditionals, warnings, adding rust_unreachables in not-yet supported errors. (struct InlineAsmRegOrRegClass): Likewise. (struct InlineAsmOperand): Likewise. * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Likewise. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise. (check_identifier): Likewise. (check_and_set): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise. * expand/rust-macro-builtins.cc (enum class): Likewise. (inline_asm_maker): Likewise. * checks/errors/borrowck/ffi-polonius/Cargo.lock: Removed. Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: Likewise. * rust/compile/inline_asm_faulty_clobber_1.rs: Likewise. * rust/compile/inline_asm_faulty_clobber_2.rs: Likewise. * rust/compile/inline_asm_illegal_options.rs: Likewise.
2025-03-17gccrs: Got AST::Fragment to be created from InlineAsmjjasmine1-6/+25
gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): Got AST::Fragment to be created from InlineAsm. (struct InlineAsmOperand): Likewise. (class InlineAsm): Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (parse_asm): likewise
2025-03-17gccrs: Working towards parse_reg and parse_reg_operandjjasmine1-9/+20
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Working towards parse_reg and parse_reg_operand (parse_reg_operand): Working towards parse_reg and parse_reg_operand (parse_asm_arg): Add todo about errors * expand/rust-macro-builtins-asm.h (parse_global_asm): remove dead code. (parse_nonglobal_asm): remove dead code.
2025-03-17gccrs: Renamed parseAsmArg to conform to other function namesjjasmine1-3/+3
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseAsmArg): Renamed parseAsmArg to conform to other function names (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parseAsmArg): Likewise. (parse_asm_arg): Likewise.
2025-03-17gccrs: Big Refactor after meetingjjasmine1-43/+109
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmRegOrRegClass): Remove union (struct InlineAsmOperand): Make instances of inside struct. * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Change signature with inlineAsmCtx. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parseAsmArg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmContext): Likewise. (parseAsmArg): Likewise. (check_and_set): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise.
2025-03-17gccrs: Remove global_asm and non_global_asm handlerjjasmine1-13/+2
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (MacroBuiltin::global_asm_handler): Remove global_asm and non_global_asm handler (MacroBuiltin::nonglobal_asm_handler): Likewise. (MacroBuiltin::asm_handler): Likewise. * expand/rust-macro-builtins.cc (enum class): Likewise. (inline_asm_maker): Likewise. * expand/rust-macro-builtins.h: Likewise.
2025-03-17gccrs: Rename InlineAsmOptions to InlineAsmOptionjjasmine1-21/+21
Rename InlineAsmOptions to InlineAsmOption for clarity gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (enum class): Rename InlineAsmOptions to InlineAsmOption for clarity * ast/rust-expr.h (enum class): Likewise. * expand/rust-macro-builtins-asm.cc (check_and_set): Likewise. (parse_options): Likewise. * expand/rust-macro-builtins-asm.h (check_and_set): Likewise. * hir/tree/rust-hir-expr.h: Likewise.
2025-03-17gccrs: Scaffolding parse_regjjasmine1-1/+48
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmRegOrRegClass): Scaffolding parse_reg * expand/rust-macro-builtins-asm.cc (parse_reg): Likewise. (parse_operand): Likewise. (parseAsmArg): Likewise.
2025-03-17gccrs: Add checks for duplicate options in inline asmjjasmine1-10/+25
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Add checks for duplicate options in inline asm (parse_options): likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: New test.
2025-03-17gccrs: Parsing of options(...) done.jjasmine1-16/+14
This is without any mutually exclusive options checked, or any relationship with reg_operands. Very primitive. gcc/rust/ChangeLog: * ast/rust-expr.h: parsing of options(...) * expand/rust-macro-builtins-asm.cc (check_and_set): likewise. (parse_options): likewise. (parseAsmArg): likewise. * expand/rust-macro-builtins-asm.h (check_and_set): likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_legal_options.rs: New test.
2025-03-17gccrs: Implemented parse_clobber_abi to pass new testsjjasmine1-22/+59
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): implemented parse_clobber_abi (parse_format_string): likewise. (parseAsmArg): likewise. (parse_asm): likewise. * expand/rust-macro-builtins-asm.h (parseAsmArg): likewise.
2025-03-17gccrs: Replace scaffolded InlineAsm with real InlineAsm.jjasmine1-25/+29
Replace scaffolded InlineAsm with real InlineAsm node in rust-expr.h gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseDirSpec): replace scaffolded InlineAsm with real InlineAsm. (parse_clobber_abi): likewise. (check_and_set): likewise. (parse_options): likewise. (parseAsmArg): likewise. (parse_asm): likewise. * expand/rust-macro-builtins-asm.h (struct AsmParseError): likewise. (enum InlineAsmDirSpec): likewise. (enum InlineAsmRegOrRegClass): likewise. (struct AsmArg): likewise. (parseAsmArg): likewise. (check_and_set): likewise. (parse_operand): likewise. (parse_options): likewise. (parse_reg): likewise. (parse_clobber_abi): likewise.
2025-03-17gccrs: First draft of parse_option finishedjjasmine1-2/+82
Finish up on parse_option, formatted parse_clobber_abi gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): format (check_and_set): helper function, is try_set_option equivalent (parse_options): new function * expand/rust-macro-builtins-asm.h (enum InlineAsmOptions): removed (check_and_set): decl of helper function
2025-03-17gccrs: Fix clobber_api bracketsjjasmine1-8/+8
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title.
2025-03-17gccrs: Working on parse_options for a bit morejjasmine1-1/+13
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_options): title.
2025-03-17gccrs: Introduce first implementation of parse_clobber_abijjasmine1-1/+75
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title. (parseAsmArg): title. * expand/rust-macro-builtins-asm.h (parse_clobber_abi): title.