aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-09-02Perform lowering hir output operand to treebadumbatish1-1/+11
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Add debug comment (CompileAsm::asm_construct_outputs): Perform lowering hir output operand to tree
2024-09-02Perform type check on InlineAsm's operandbadumbatish1-5/+60
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Perform type check on InlineAsm's operand (typecheck_inline_asm_operand): Likewise
2024-09-02Lower the HIR to tree with CompileExprbadumbatish2-13/+20
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
2024-09-02Move strip double quotes, add scaffold expandbadumbatish4-29/+39
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
2024-09-02Start work on expand inline asmbadumbatish2-2/+50
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.
2024-09-02Added counting to check for asm_construct_outputsbadumbatish1-0/+7
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs): Set up counting to check
2024-09-02Added new test for prep of output {}badumbatish1-0/+18
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_output_operand.rs: New test.
2024-09-02Minor fix to asm codegen prbadumbatish3-18/+21
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Use expr's is_simple_asm and is_inline_asm (CompileAsm::asm_is_simple): removed (CompileAsm::asm_is_inline): removed * backend/rust-compile-asm.h: Add docs to ASM_TREE_ARRAY_LENGTH * hir/tree/rust-hir-expr.h: Add is_simple_asm, is_inline_asm and remove #include tree
2024-09-02Refactor compile-asm for first round reviewbadumbatish2-271/+107
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Refactor compile-asm for first round review (CompileAsm::asm_build_asm_stmt): Likewise. (CompileAsm::asm_build_expr): Likewise. (CompileAsm::asm_get_locus): Likewise. (CompileAsm::asm_construct_string_tree): Likewise. (CompileAsm::asm_construct_outputs): Likewise. (CompileAsm::asm_construct_inputs): Likewise. (CompileAsm::asm_construct_clobber_tree): Likewise. (CompileAsm::asm_construct_label_tree): Likewise. (CompileAsm::asm_is_simple): Likewise. (CompileAsm::asm_is_inline): Likewise. * backend/rust-compile-asm.h (strip_double_quotes): Likewise. (class CompileAsm): Likewise.
2024-09-02Successfully produce pseudo-nopbadumbatish3-30/+224
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::add_stmt): Deleted (CompileAsm::CompileAsm): Successfully produce pseudo-nop (CompileAsm::visit): Likewise (CompileAsm::asm_build_asm_stmt): Likewise (CompileAsm::asm_construct_string_tree): Likewise (CompileAsm::asm_is_inline): Likewise * backend/rust-compile-asm.h (class CompileAsm): Likewise * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
2024-09-02Scaffolding codebadumbatish3-1/+97
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::add_stmt): Scaffolding code. (CompileAsm::asm_build_asm_stmt): Likewise. (CompileAsm::asm_build_expr): Likewise. (CompileAsm::asm_construct_string_tree): Likewise. * backend/rust-compile-asm.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
2024-09-02Scaffolding new compile-asm filesbadumbatish5-40/+131
gcc/rust/ChangeLog: * Make-lang.in: Scaffolding new compile-asm files * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise * hir/tree/rust-hir-expr.h: Likewise * backend/rust-compile-asm.cc: New file. Likewise * backend/rust-compile-asm.h: New file. Likewise
2024-09-02Setting up interfaces for codegenjjasmine2-2/+30
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Setting up interfaces for codegen * hir/tree/rust-hir-expr.h: Likewise.
2024-09-02Local testing for build_string and debug()jjasmine1-1/+4
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Local testing for build_string and debug()
2024-09-02Make sure CompileExpr::visit is reachedjjasmine3-4/+16
gcc/rust/ChangeLog: * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Make sure CompileExpr::visit is reached * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_compile_nop.rs: New test.
2024-09-02Scaffolding asm codegenjjasmine12-0/+40
gcc/rust/ChangeLog: * backend/rust-compile-block.h: Scaffolding asm codegen * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise.
2024-09-02Fix 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
2024-08-29Add pop guard for binderbadumbatish1-1/+4
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h: Add pop guard for binder
2024-08-29Add running cicd 32bitbadumbatish1-1/+4
ChangeLog: * .github/alpine_32bit_log_warnings: New file. * .github/workflows/ccpp32alpine.yml: New file. gcc/rust/ChangeLog: * resolve/rust-ast-resolve.cc (NameResolution::go): Fix warnings from const auto& to const auto
2024-08-28gccrs: emit error code for E0758Raiki Tamura2-7/+11
gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::build_token): Emit error code. * lex/rust-lex.h: Fix comment. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-28gccrs: Add typecheck for path patterns.Raiki Tamura6-28/+175
gcc/rust/ChangeLog: * hir/tree/rust-hir.cc (Item::item_kind_string): New function. * hir/tree/rust-hir.h: New function. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Modify to check all arms in match expressions even if some of them has errors. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add and fix check for path patterns. gcc/testsuite/ChangeLog: * rust/compile/issue-2324-2.rs: Fix error message. * rust/compile/match9.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-27rust: Add checking for union patternsRaiki Tamura2-25/+76
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add check for union patterns. gcc/testsuite/ChangeLog: * rust/compile/match8.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-22feature-gate: Cleanup visitor and constructorArthur Cohen15-169/+90
This commit turns a few of the fields into `tl::optional<T>` and cleanups the constructor with a couple default parameters. We can also reuse the variable that we are `switch`ing on, instead of repeating the enum variants each time. Most importantly, the `FeatureGate` visitor now uses the `DefaultAstVisitor` correctly, and will now visit nested items. This means that we have to fix a bunch of the testsuite as some feature attributes were missing. gcc/rust/ChangeLog: * checks/errors/rust-feature.cc (Feature::create): Reuse variable, remove now optional parameters from constructor. * checks/errors/rust-feature.h: Cleanup class definition. * checks/errors/rust-feature-gate.cc (FeatureGate::gate): Use optional. * checks/errors/rust-feature-gate.h: Cleanup visitor implementation. gcc/testsuite/ChangeLog: * rust/compile/assume.rs: Add missing feature attribute. * rust/compile/issue-1901.rs: Likewise. * rust/compile/issue-1981.rs: Likewise. * rust/compile/sizeof-stray-infer-var-bug.rs: Likewise. * rust/compile/torture/intrinsics-8.rs: Likewise. * rust/compile/torture/transmute-size-check-1.rs: Likewise. * rust/compile/torture/transmute1.rs: Likewise. * rust/compile/torture/uninit-intrinsic-1.rs: Likewise. * rust/execute/torture/issue-1436.rs: Likewise. * rust/execute/torture/issue-2583.rs: Likewise.
2024-08-22attributes: Start handling prelude_import properlyArthur Cohen7-2/+29
This commit adds basic handling for the `#[prelude_import]` attribute, without doing anything functionality wise. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add base feature gating for `#[feature(prelude_import)]`. * checks/errors/rust-feature-gate.h: Likewise. * checks/errors/rust-feature.cc (Feature::create): Likewise. * checks/errors/rust-feature.h: Likewise. * util/rust-attribute-values.h: Add base handling for `#[prelude_import]` attribute. * util/rust-attributes.cc: Likewise. gcc/testsuite/ChangeLog: * rust/compile/prelude_import.rs: New test.
2024-08-21Fix the disorder struct and class in inline asmbadumbatish2-2/+3
gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (struct InlineAsmOperand): Change to class (class InlineAsmOperand): Change from struct * hir/tree/rust-hir-full-decls.h (struct InlineAsmRegOrRegClass): Removed from decl, used from AST (struct AnonConst): new decl from rust-hir-expr.h (class InlineAsmOperand): new decl from rust-hir-expr.h
2024-08-19ast: Introduce class hierarchy for lang item pathsArthur Cohen13-42/+294
Create a base Path class which is derived into two children classes for regular paths and lang item paths. This allows it to hold either the segments of a fully formed path, or the node ID of a lang-item path. This is required in order to create these special paths which do not have segments, and do not necessarily have a canonical form - they only depend on where the item was defined. gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class PathPattern): Rename PathPattern to... (class Path): ...Path * ast/rust-ast-collector.cc (TokenCollector::visit): Add required methods for LangItemPath and RegularPath. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-path.cc (PathPattern::as_string): Likewise. (RegularPath::as_string): Likewise. (LangItemPath::as_string): Likewise. (PathPattern::convert_to_simple_path): Likewise. (RegularPath::convert_to_simple_path): Likewise. (RegularPath::accept_vis): Likewise. (LangItemPath::accept_vis): Likewise. (PathInExpression::as_string): Likewise. (QualifiedPathInExpression::as_string): Likewise. * ast/rust-path.h (class PathPattern): Likewise. (class Path): Likewise. (class RegularPath): Likewise. (class LangItemPath): Likewise. (class PathInExpression): Likewise. (class QualifiedPathInExpression): Likewise. * ast/rust-pattern.h (class PathPattern): Likewise. (class Path): Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
2024-08-19ast: Remove PathExpr abstract classArthur Cohen2-7/+2
Inherit directly from ExprWithoutBlock instead. gcc/rust/ChangeLog: * ast/rust-ast.h (class PathExpr): Remove class. * ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock. (class QualifiedPathInExpression): Likewise.
2024-08-19ast: PathPattern: Remove `remove_all_segments` methodArthur Cohen1-11/+6
This method was used only for stripping PathPattern AST nodes during `cfg-strip`, which seems like a misnomer and makes it a good candidate for simplification. gcc/rust/ChangeLog: * ast/rust-path.h (class PathInExpression): Remove `remove_all_segments` method, add a `marked_for_strip` flag instead.
2024-08-16Attempted to access a nonexistent field [E0609]Muhammad Mahad2-2/+19
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add error code and update error message gcc/testsuite/ChangeLog: * rust/compile/nonexistent-field.rs: New test. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-08-16Move errors with locationsKushal Pal3-10/+96
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_move_errors): Specify locations for code causing errors and related moves. gcc/testsuite/ChangeLog: * rust/borrowck/test_move.rs: Test rich-errors related to moves. * rust/borrowck/test_move_conditional.rs: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-16Subset errors with locationsKushal Pal3-9/+64
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_subset_errors): Highlight lifetime locations while reporting subset errors. (BorrowCheckerDiagnostics::get_lifetime_param): Helper function to fetch HIR::Lifetime node from Polonius::Origin. * checks/errors/borrowck/rust-borrow-checker-diagnostics.h: Definition of helper function. gcc/testsuite/ChangeLog: * rust/borrowck/subset.rs: Better subset errors. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-16Map locations to placeholder regionsKushal Pal2-0/+24
Mapped placeholder regions to their respective HIR nodes so we can fetch locations during error reporting. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder.h: Map regions to their respective HIR nodes. * checks/errors/borrowck/rust-bir.h (struct Function): Add unordered_map to maintain the mapping. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-14Fixed testcaseKushal Pal1-2/+2
gcc/testsuite/ChangeLog: * rust/borrowck/test_move.rs: Assigning `a` to `c` is the correct way to test the behaviour. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-06[#2324] Add error message for E0532Liam Naddell3-0/+63
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc: Emit E0532 when trying to reference a Tuple or Struct variant using a non Tuple or Struct pattern. gcc/testsuite/ChangeLog: * rust/compile/issue-2324-1.rs: add test for E0532 with tuple enum variant * rust/compile/issue-2324-2.rs: add test for E0532 with struct enum variant Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
2024-08-06borrowck: Avoid overloading issues on 32bit architecturesArthur Cohen1-2/+2
On architectures where `size_t` is `unsigned int`, such as 32bit x86, we encounter an issue with `PlaceId` and `FreeRegion` being aliases to the same types. This poses an issue for overloading functions for these two types, such as `push_subset` in that case. This commit renames one of these `push_subset` functions to avoid the issue, but this should be fixed with a newtype pattern for these two types. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-fact-collector.h (points): Rename `push_subset(PlaceId, PlaceId)` to `push_subset_place(PlaceId, PlaceId)`
2024-08-06borrowck: Fix debug prints on 32-bits architecturesArthur Cohen2-3/+6
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder.h: Cast size_t values to unsigned long before printing. * checks/errors/borrowck/rust-bir-fact-collector.h: Likewise.
2024-08-06Eager expansion for include* #1805 #1865Liam Naddell15-40/+170
gcc/rust/ChangeLog: * expand/rust-expand-visitor.h: remove auto keyword * expand/rust-macro-builtins-helpers.cc: allow for changing macro invoc types on eager expansions to semicoloned macros * expand/rust-macro-builtins-helpers.h: add default semicoloned argument * expand/rust-macro-builtins-include.cc: allow for eager expansion for include and include_bytes allow for parsing include invocations as items instead of expressions, which allows invocations at global scope * expand/rust-macro-expand.cc: push Expr type for eager invocations gcc/testsuite/ChangeLog: * rust/compile/macros/builtin/include1.rs: add basic include test at global scope * rust/compile/macros/builtin/include2.rs: add basic include test at local scope with expression * rust/compile/macros/builtin/include3.rs: add eager expansion test at global scope * rust/compile/macros/builtin/include4.rs: add eager expansion test at local scope with expression * rust/compile/macros/builtin/include_bytes.rs: add eager expansion test at global scope * rust/compile/macros/builtin/include_rs: supporting test file with dummy function * rust/compile/macros/builtin/include_rs2: supporting test file with dummy string * rust/compile/macros/builtin/include_str.rs: add eager expansion test at global scope * rust/execute/torture/builtin_macro_include_bytes.rs: clean up old test logic, add permutations for eager expansion * rust/execute/torture/builtin_macro_include_str.rs: add eager expansion permutations
2024-08-02Simplify construction of BIR::StatementKushal Pal2-25/+51
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-internal.h: Use `make_*` functions to create BIR::Statements. * checks/errors/borrowck/rust-bir.h: Make a complete constructor and introduce `make_*` functions to create various BIR::Statements. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-02Loan errors with locationsKushal Pal8-32/+295
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_loan_errors): Add label to where the borrow occurs and where the invalid access occurs. (BorrowCheckerDiagnostics::get_statement): Fetch BIR::Statement from Polonius::Point (BorrowCheckerDiagnostics::get_loan): Fetch BIR::Loan from Polonius::Loan * checks/errors/borrowck/rust-borrow-checker-diagnostics.h: Function definition of helpers. gcc/testsuite/ChangeLog: * rust/borrowck/reference.rs: Test rich errors for borrow-checker. * rust/borrowck/return_ref_to_local.rs: Likewise. * rust/borrowck/tmp.rs: Likewise. * rust/borrowck/use_while_mut.rs: Likewise. * rust/borrowck/use_while_mut_fr.rs: Likewise. * rust/borrowck/well_formed_function_inputs.rs: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-02Add location to BIR::Statement of kind RETURNKushal Pal4-7/+15
This commit adds location_t to BIR::Statement where type is RETURN. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Add location parameter. * checks/errors/borrowck/rust-bir-builder.h: Likewise. * checks/errors/borrowck/rust-bir-builder-internal.h: Add helper function for pushing return statements. * checks/errors/borrowck/rust-bir.h: Remove `expr` parameter as it is only needed for ASSIGNMENT statements, for which we already have a constructor. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-02Implement resolve expr for inline asm astbadumbatish2-6/+63
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Implement resolve expr for inline asm ast (translate_operand): Likewise. * resolve/rust-ast-resolve-expr.h: Likewise.
2024-08-01Add location to BIR::LoanKushal Pal2-2/+4
This commit adds location_t to BIR::Loan, this location will point to location is source code where the borrow occured, this information will be useful for reporting borrow-checking errors. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-internal.h: Fill location for loan. * checks/errors/borrowck/rust-bir-place.h (struct Loan): Add location field. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-01Add location support to BIR::StatementKushal Pal6-121/+194
This commit adds location_t to BIR::Statement where type is ASSIGNMENT this information will be later used for reporting borrow-checking errors. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Added location parameter. * checks/errors/borrowck/rust-bir-builder-internal.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise. * checks/errors/borrowck/rust-bir-builder.h: Likewise. * checks/errors/borrowck/rust-bir.h: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-08-01Turn to switch case, use new helper functionsbadumbatish1-70/+94
gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (translate_operand_in): Turn to switch case, use new helper functions (translate_operand_out): Likewise. (translate_operand_inout): Likewise. (translate_operand_split_in_out): Likewise. (translate_operand_const): Likewise. (translate_operand_sym): Likewise. (translate_operand_label): Likewise. (from_operand): Likewise. (ASTLoweringExpr::visit): Likewise.
2024-08-01Set up the hir lowering for operandbadumbatish2-14/+343
gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (from_operand): Set up the lowering for operand (ASTLoweringExpr::visit): Likewise * hir/tree/rust-hir-expr.h (struct InlineAsmRegOrRegClass): Not necessary, kept from ast (struct AnonConst): Set up lowering for operand (class InlineAsmOperand): Likewise, add getters
2024-07-31Improve compressed point bit manipulationKushal Pal2-3/+35
gcc/rust/ChangeLog: * checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint): Added comments and made extraction of statement more verbose for better understanding. * checks/errors/borrowck/ffi-polonius/src/lib.rs: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-07-31Use new constructors and control flow for operandbadumbatish2-84/+53
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
2024-07-31Fix the parser's operand and flags storagebadumbatish5-28/+60
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
2024-07-31Fixed bitwise operation in `extract_stmt`Kushal Pal1-1/+1
gcc/rust/ChangeLog: * checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint): This is the correct way of extracting the required bits. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-07-30Move mbe macro tests to their own directoryPierre-Emmanuel Patry80-0/+35
gcc/testsuite/ChangeLog: * rust/compile/macro-delim.rs: Move to... * rust/compile/macros/mbe/macro-delim.rs: ...here. * rust/compile/macro-issue1053-2.rs: Move to... * rust/compile/macros/mbe/macro-issue1053-2.rs: ...here. * rust/compile/macro-issue1053.rs: Move to... * rust/compile/macros/mbe/macro-issue1053.rs: ...here. * rust/compile/macro-issue1224.rs: Move to... * rust/compile/macros/mbe/macro-issue1224.rs: ...here. * rust/compile/macro-issue1233.rs: Move to... * rust/compile/macros/mbe/macro-issue1233.rs: ...here. * rust/compile/macro-issue1395-2.rs: Move to... * rust/compile/macros/mbe/macro-issue1395-2.rs: ...here. * rust/compile/macro-issue1395.rs: Move to... * rust/compile/macros/mbe/macro-issue1395.rs: ...here. * rust/compile/macro-issue1400-2.rs: Move to... * rust/compile/macros/mbe/macro-issue1400-2.rs: ...here. * rust/compile/macro-issue1400.rs: Move to... * rust/compile/macros/mbe/macro-issue1400.rs: ...here. * rust/compile/macro-issue2092.rs: Move to... * rust/compile/macros/mbe/macro-issue2092.rs: ...here. * rust/compile/macro-issue2192.rs: Move to... * rust/compile/macros/mbe/macro-issue2192.rs: ...here. * rust/compile/macro-issue2194.rs: Move to... * rust/compile/macros/mbe/macro-issue2194.rs: ...here. * rust/compile/macro-issue2229.rs: Move to... * rust/compile/macros/mbe/macro-issue2229.rs: ...here. * rust/compile/macro-issue2264.rs: Move to... * rust/compile/macros/mbe/macro-issue2264.rs: ...here. * rust/compile/macro-issue2268.rs: Move to... * rust/compile/macros/mbe/macro-issue2268.rs: ...here. * rust/compile/macro-issue2273.rs: Move to... * rust/compile/macros/mbe/macro-issue2273.rs: ...here. * rust/compile/macro-issue2653.rs: Move to... * rust/compile/macros/mbe/macro-issue2653.rs: ...here. * rust/compile/macro-issue2983_2984.rs: Move to... * rust/compile/macros/mbe/macro-issue2983_2984.rs: ...here. * rust/compile/macro1.rs: Move to... * rust/compile/macros/mbe/macro1.rs: ...here. * rust/compile/macro10.rs: Move to... * rust/compile/macros/mbe/macro10.rs: ...here. * rust/compile/macro11.rs: Move to... * rust/compile/macros/mbe/macro11.rs: ...here. * rust/compile/macro12.rs: Move to... * rust/compile/macros/mbe/macro12.rs: ...here. * rust/compile/macro13.rs: Move to... * rust/compile/macros/mbe/macro13.rs: ...here. * rust/compile/macro14.rs: Move to... * rust/compile/macros/mbe/macro14.rs: ...here. * rust/compile/macro15.rs: Move to... * rust/compile/macros/mbe/macro15.rs: ...here. * rust/compile/macro16.rs: Move to... * rust/compile/macros/mbe/macro16.rs: ...here. * rust/compile/macro17.rs: Move to... * rust/compile/macros/mbe/macro17.rs: ...here. * rust/compile/macro18.rs: Move to... * rust/compile/macros/mbe/macro18.rs: ...here. * rust/compile/macro19.rs: Move to... * rust/compile/macros/mbe/macro19.rs: ...here. * rust/compile/macro2.rs: Move to... * rust/compile/macros/mbe/macro2.rs: ...here. * rust/compile/macro20.rs: Move to... * rust/compile/macros/mbe/macro20.rs: ...here. * rust/compile/macro21.rs: Move to... * rust/compile/macros/mbe/macro21.rs: ...here. * rust/compile/macro22.rs: Move to... * rust/compile/macros/mbe/macro22.rs: ...here. * rust/compile/macro23.rs: Move to... * rust/compile/macros/mbe/macro23.rs: ...here. * rust/compile/macro25.rs: Move to... * rust/compile/macros/mbe/macro25.rs: ...here. * rust/compile/macro26.rs: Move to... * rust/compile/macros/mbe/macro26.rs: ...here. * rust/compile/macro27.rs: Move to... * rust/compile/macros/mbe/macro27.rs: ...here. * rust/compile/macro28.rs: Move to... * rust/compile/macros/mbe/macro28.rs: ...here. * rust/compile/macro29.rs: Move to... * rust/compile/macros/mbe/macro29.rs: ...here. * rust/compile/macro3.rs: Move to... * rust/compile/macros/mbe/macro3.rs: ...here. * rust/compile/macro30.rs: Move to... * rust/compile/macros/mbe/macro30.rs: ...here. * rust/compile/macro31.rs: Move to... * rust/compile/macros/mbe/macro31.rs: ...here. * rust/compile/macro32.rs: Move to... * rust/compile/macros/mbe/macro32.rs: ...here. * rust/compile/macro33.rs: Move to... * rust/compile/macros/mbe/macro33.rs: ...here. * rust/compile/macro34.rs: Move to... * rust/compile/macros/mbe/macro34.rs: ...here. * rust/compile/macro35.rs: Move to... * rust/compile/macros/mbe/macro35.rs: ...here. * rust/compile/macro36.rs: Move to... * rust/compile/macros/mbe/macro36.rs: ...here. * rust/compile/macro37.rs: Move to... * rust/compile/macros/mbe/macro37.rs: ...here. * rust/compile/macro38.rs: Move to... * rust/compile/macros/mbe/macro38.rs: ...here. * rust/compile/macro39.rs: Move to... * rust/compile/macros/mbe/macro39.rs: ...here. * rust/compile/macro4.rs: Move to... * rust/compile/macros/mbe/macro4.rs: ...here. * rust/compile/macro40.rs: Move to... * rust/compile/macros/mbe/macro40.rs: ...here. * rust/compile/macro41.rs: Move to... * rust/compile/macros/mbe/macro41.rs: ...here. * rust/compile/macro42.rs: Move to... * rust/compile/macros/mbe/macro42.rs: ...here. * rust/compile/macro43.rs: Move to... * rust/compile/macros/mbe/macro43.rs: ...here. * rust/compile/macro44.rs: Move to... * rust/compile/macros/mbe/macro44.rs: ...here. * rust/compile/macro45.rs: Move to... * rust/compile/macros/mbe/macro45.rs: ...here. * rust/compile/macro46.rs: Move to... * rust/compile/macros/mbe/macro46.rs: ...here. * rust/compile/macro47.rs: Move to... * rust/compile/macros/mbe/macro47.rs: ...here. * rust/compile/macro48.rs: Move to... * rust/compile/macros/mbe/macro48.rs: ...here. * rust/compile/macro49.rs: Move to... * rust/compile/macros/mbe/macro49.rs: ...here. * rust/compile/macro5.rs: Move to... * rust/compile/macros/mbe/macro5.rs: ...here. * rust/compile/macro50.rs: Move to... * rust/compile/macros/mbe/macro50.rs: ...here. * rust/compile/macro51.rs: Move to... * rust/compile/macros/mbe/macro51.rs: ...here. * rust/compile/macro52.rs: Move to... * rust/compile/macros/mbe/macro52.rs: ...here. * rust/compile/macro53.rs: Move to... * rust/compile/macros/mbe/macro53.rs: ...here. * rust/compile/macro54.rs: Move to... * rust/compile/macros/mbe/macro54.rs: ...here. * rust/compile/macro55.rs: Move to... * rust/compile/macros/mbe/macro55.rs: ...here. * rust/compile/macro56.rs: Move to... * rust/compile/macros/mbe/macro56.rs: ...here. * rust/compile/macro57.rs: Move to... * rust/compile/macros/mbe/macro57.rs: ...here. * rust/compile/macro6.rs: Move to... * rust/compile/macros/mbe/macro6.rs: ...here. * rust/compile/macro7.rs: Move to... * rust/compile/macros/mbe/macro7.rs: ...here. * rust/compile/macro8.rs: Move to... * rust/compile/macros/mbe/macro8.rs: ...here. * rust/compile/macro9.rs: Move to... * rust/compile/macros/mbe/macro9.rs: ...here. * rust/compile/macro_call_statement.rs: Move to... * rust/compile/macros/mbe/macro_call_statement.rs: ...here. * rust/compile/macro_export_1.rs: Move to... * rust/compile/macros/mbe/macro_export_1.rs: ...here. * rust/compile/macro_return.rs: Move to... * rust/compile/macros/mbe/macro_return.rs: ...here. * rust/compile/macro_rules_macro_rules.rs: Move to... * rust/compile/macros/mbe/macro_rules_macro_rules.rs: ...here. * rust/compile/macro_use1.rs: Move to... * rust/compile/macros/mbe/macro_use1.rs: ...here. * rust/compile/macros/mbe/mbe_macro.exp: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>