- def __init__(self, src):
- # type: (SSAVal[_RegT_co]) -> None
- self.dest = SSAVal(self, "dest", src.ty)
+ def __init__(self, src, dest_ty=None):
+ # type: (SSAVal[_RegT_co], _RegT_co | None) -> None
+ if dest_ty is None:
+ dest_ty = src.ty
+ if isinstance(src.ty, GPRRangeType) \
+ and isinstance(dest_ty, GPRRangeType):
+ if src.ty.length != dest_ty.length:
+ raise ValueError(f"incompatible source and destination "
+ f"types: {src.ty} and {dest_ty}")
+ elif src.ty != dest_ty:
+ raise ValueError(f"incompatible source and destination "
+ f"types: {src.ty} and {dest_ty}")
+
+ self.dest = SSAVal(self, "dest", dest_ty)