Skip to content

Commit

Permalink
Revert "backend: (x86) Fix register sets test coverage (#3866)" (#3890)
Browse files Browse the repository at this point in the history
This reverts commit 8863a69.
  • Loading branch information
math-fehr authored Feb 12, 2025
1 parent f417b08 commit 6ca01f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 34 deletions.
18 changes: 0 additions & 18 deletions tests/dialects/test_x86.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
from xdsl.dialects import x86


def test_unallocated_register():
unallocated = x86.register.GeneralRegisterType("")
assert not unallocated.is_allocated
assert unallocated == x86.register.GeneralRegisterType.unallocated()

unallocated = x86.register.RFLAGSRegisterType("")
assert not unallocated.is_allocated
assert unallocated == x86.register.RFLAGSRegisterType.unallocated()

unallocated = x86.register.AVXRegisterType("")
assert not unallocated.is_allocated
assert unallocated == x86.register.AVXRegisterType.unallocated()


@pytest.mark.parametrize(
"register, name",
[
Expand All @@ -42,8 +28,6 @@ def test_register(register: x86.register.GeneralRegisterType, name: str):
assert register.is_allocated
assert register.register_name == name

assert register.instruction_set_name() == "x86"


def test_rflags_register():
rflags = x86.register.RFLAGS
Expand Down Expand Up @@ -143,5 +127,3 @@ def test_avx2_register(register: x86.register.AVX2RegisterType, name: str):
def test_sse_register(register: x86.register.SSERegisterType, name: str):
assert register.is_allocated
assert register.register_name == name

assert register.instruction_set_name() == "x86AVX"
9 changes: 0 additions & 9 deletions tests/filecheck/dialects/x86/x86_registers_invalid.mlir

This file was deleted.

4 changes: 3 additions & 1 deletion xdsl/dialects/x86/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ def parse_parameters(cls, parser: AttrParser) -> Sequence[Attribute]:
if parser.parse_optional_punctuation("<") is not None:
name = parser.parse_identifier()
parser.parse_punctuation(">")
if not name.startswith("e") and not name.startswith("r"):
assert name in cls.abi_index_by_name(), f"{name}"
else:
name = ""
return cls._parameters_from_spelling(name)

def verify(self) -> None:
name = self.spelling.data
if not self.is_allocated:
if not self.is_allocated or name.startswith("e") or name.startswith("r"):
return
if name not in type(self).abi_index_by_name():
raise VerifyException(f"{name} not in {self.instruction_set_name()}")
Expand Down
7 changes: 1 addition & 6 deletions xdsl/tools/command_line_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from xdsl.dialects import get_all_dialects
from xdsl.dialects.builtin import ModuleOp
from xdsl.parser import Parser
from xdsl.utils.exceptions import DiagnosticException, ParseError
from xdsl.utils.exceptions import ParseError
from xdsl.utils.lexer import Span


Expand Down Expand Up @@ -117,10 +117,5 @@ def parse_chunk(
print(e)
else:
raise
except DiagnosticException as e:
if self.args.verify_diagnostics:
print(e)
else:
raise
finally:
chunk.close()

0 comments on commit 6ca01f1

Please sign in to comment.