from contextlib import contextmanager
import enum
+import dataclasses
from abc import ABCMeta, abstractmethod
from enum import Enum, unique
from functools import lru_cache, total_ordering
from weakref import WeakValueDictionary as _WeakVDict
from cached_property import cached_property
-from dataclasses import dataclass
from nmutil import plain_data # type: ignore
from bigint_presentation_code.type_util import (Literal, Self, assert_never,
assert OpStage.Early < OpStage.Late, "early must be less than late"
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class ProgramPoint(Interned):
op_index: int
return f"<ops[{self.op_index}]:{self.stage._name_}>"
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class ProgramRange(Sequence[ProgramPoint], Interned):
start: ProgramPoint
return f"<range:{start}..{stop}>"
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class SSAValSubReg(Interned):
ssa_val: "SSAVal"
return "BaseTy." + self._name_
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class Ty(Interned):
base_ty: BaseTy
return "LocSubKind." + self._name_
-@dataclass(frozen=True, unsafe_hash=True)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True)
@final
class GenericTy(Interned):
base_ty: BaseTy
return ty.reg_len == 1
-@dataclass(frozen=True, unsafe_hash=True)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True)
@final
class Loc(Interned):
kind: LocKind
return only_loc
-@dataclass(frozen=True, unsafe_hash=True)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True)
@final
class GenericOperandDesc(Interned):
"""generic Op operand descriptor"""
spread_index=idx, write_stage=self.write_stage)
-@dataclass(frozen=True, unsafe_hash=True)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True)
@final
class OperandDesc(Interned):
"""Op operand descriptor"""
sub_kinds=[LocSubKind.VL_MAXVL])
-@dataclass(frozen=True, unsafe_hash=True)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True)
@final
class GenericOpProperties(Interned):
demo_asm: str
_GEN_ASMS[FuncArgR3] = lambda: OpKind.__funcargr3_gen_asm
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
class SSAValOrUse(Interned):
op: "Op"
operand_idx: int
return self.__class__(op=self.op, operand_idx=self.unspread_start_idx)
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class SSAVal(SSAValOrUse):
__slots__ = ()
return tuple(SSAValSubReg(self, i) for i in range(self.ty.reg_len))
-@dataclass(frozen=True, unsafe_hash=True, repr=False)
+@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False)
@final
class SSAUse(SSAValOrUse):
__slots__ = ()