Assert all InstructionGroups are closed in TargetIsa.__init__(); Close x86 group

This commit is contained in:
Dimo
2017-07-24 13:41:04 -07:00
committed by Jakob Stoklund Olesen
parent 7caaf7fea1
commit b448574a49
2 changed files with 7 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ from .predicates import And
from .registers import RegClass, Register, Stack from .registers import RegClass, Register, Stack
from .ast import Apply from .ast import Apply
from .types import ValueType from .types import ValueType
from .instructions import InstructionGroup
# The typing module is only required by mypy, and we don't use these imports # The typing module is only required by mypy, and we don't use these imports
# outside type comments. # outside type comments.
@@ -47,6 +48,10 @@ class TargetISA(object):
self.regclasses = list() # type: List[RegClass] self.regclasses = list() # type: List[RegClass]
self.legalize_codes = OrderedDict() # type: OrderedDict[XFormGroup, int] # noqa self.legalize_codes = OrderedDict() # type: OrderedDict[XFormGroup, int] # noqa
assert InstructionGroup._current is None,\
"InstructionGroup {} is still open!"\
.format(InstructionGroup._current.name)
def __str__(self): def __str__(self):
# type: () -> str # type: () -> str
return self.name return self.name

View File

@@ -43,3 +43,5 @@ sdivmodx = Instruction(
Return both quotient and remainder. Return both quotient and remainder.
""", """,
ins=(nlo, nhi, d), outs=(q, r), can_trap=True) ins=(nlo, nhi, d), outs=(q, r), can_trap=True)
GROUP.close()