From d2c9afb7bc8278bdf946599f58da18c76d3d1d2f Mon Sep 17 00:00:00 2001 From: badumbatish Date: Tue, 23 Jul 2024 22:17:12 -0700 Subject: gccrs: Fix the parser's operand and flags storage 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 --- gcc/testsuite/rust/compile/inline_asm_illegal_operands.rs | 6 +++--- gcc/testsuite/rust/compile/inline_asm_parse_operand.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite/rust') diff --git a/gcc/testsuite/rust/compile/inline_asm_illegal_operands.rs b/gcc/testsuite/rust/compile/inline_asm_illegal_operands.rs index 5a13fb9..f29b4b6 100644 --- a/gcc/testsuite/rust/compile/inline_asm_illegal_operands.rs +++ b/gcc/testsuite/rust/compile/inline_asm_illegal_operands.rs @@ -11,14 +11,14 @@ fn main() { asm!( "add {x}, {1}", x = in(reg) _x, - x = in(reg) _x, // { dg-error {duplicate argument named 'x'} "" { xfail *-*-* } .-1 } + x = in(reg) _x, // { dg-error {duplicate argument named 'x'} } ); asm!( "mov {x}, {x}", - x = inout("eax") _x, // { dg-error {explicit register arguments cannot have names} "" { xfail *-*-* } .-1 } + x = inout("eax") _x, // { dg-error {explicit register arguments cannot have names} } x = inout(reg) _x, // It then proceeds to parse this line, resulting in only 1 error instead of duplication error as well. ); } _x = 1; -} \ No newline at end of file +} diff --git a/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs b/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs index 2770263..dfce295 100644 --- a/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs +++ b/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs @@ -31,7 +31,7 @@ fn main() { asm!( "add {0}, {0}", in(reg) _num1, - out(reg) _, + //out(reg) _, ); } -} \ No newline at end of file +} -- cgit v1.1