-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline asm #2982
Draft
badumbatish
wants to merge
22
commits into
Rust-GCC:master
Choose a base branch
from
badumbatish:inline_asm
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Inline asm #2982
+680
−17
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
badumbatish
force-pushed
the
inline_asm
branch
6 times, most recently
from
May 22, 2024 04:28
5a0f0a9
to
69a06ce
Compare
CohenArthur
reviewed
May 24, 2024
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (struct AsmParseError): title. (enum InlineAsmDirSpec): title. (enum InlineAsmOptions): title. (struct AsmArg): title. (parseAsmArg): title. (parse_global_asm): title. (parse_nonglobal_asm): title. (parse_asm): title. (parseDirSpec): title. (parse_format_string): title. (MacroBuiltin::global_asm_handler): title. (MacroBuiltin::nonglobal_asm_handler): title. * expand/rust-macro-builtins.cc: title. * expand/rust-macro-builtins.h: title.
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (enum InlineAsmRegOrRegClass): title. (parseAsmArg): title. (check_identifier): title. (parse_operand): title. (parse_options): title. (parse_reg): title. (parseDirSpec): title. (parse_asm): title.
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.
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_options): title.
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title.
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
gcc/rust/ChangeLog: * ast/rust-expr.h: Introduced is_global_asm to InlineAsm AST
gcc/rust/ChangeLog: * ast/rust-expr.h: Make InlineAsm non-abstract for usage in parsing.
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.
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_nop.rs: Simple test for asm!
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_ident_first.rs: New test.
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_nop_2.rs: New test.
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: New test. * rust/compile/inline_asm_faulty_clobber_1.rs: New test. * rust/compile/inline_asm_faulty_clobber_2.rs: New test.
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.
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.
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: Wraps inline_asm tests in unsafe {} * rust/compile/inline_asm_faulty_clobber_1.rs: likewise. * rust/compile/inline_asm_faulty_clobber_2.rs: likewise. * rust/compile/inline_asm_ident_first.rs: likewise. * rust/compile/inline_asm_nop.rs: likewise. * rust/compile/inline_asm_nop_2.rs: likewise.
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.
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.h (parseAsmArg): Resolve static decl warning (parse_nonglobal_asm): Resolve static decl warning
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.
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.
Safegaurd InlineAsm's clone_expr_... with unreachable since we would never use them. gcc/rust/ChangeLog: * ast/rust-expr.h: Safegaurd InlineAsm's clone_expr_... with unreachable.
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft PR for my mentors