result = truncate src from src_type to dst_type Truncate a value from type with more bits to type with less bits. dst_type and src_type can be native integer types, bools or tagged integers. Tagged integers should have the tag bit unset.
| 1314 | |
| 1315 | @final |
| 1316 | class Truncate(RegisterOp): |
| 1317 | """result = truncate src from src_type to dst_type |
| 1318 | |
| 1319 | Truncate a value from type with more bits to type with less bits. |
| 1320 | |
| 1321 | dst_type and src_type can be native integer types, bools or tagged |
| 1322 | integers. Tagged integers should have the tag bit unset. |
| 1323 | """ |
| 1324 | |
| 1325 | error_kind = ERR_NEVER |
| 1326 | |
| 1327 | def __init__(self, src: Value, dst_type: RType, line: int = -1) -> None: |
| 1328 | super().__init__(line) |
| 1329 | self.src = src |
| 1330 | self.type = dst_type |
| 1331 | self.src_type = src.type |
| 1332 | |
| 1333 | def sources(self) -> list[Value]: |
| 1334 | return [self.src] |
| 1335 | |
| 1336 | def set_sources(self, new: list[Value]) -> None: |
| 1337 | (self.src,) = new |
| 1338 | |
| 1339 | def stolen(self) -> list[Value]: |
| 1340 | return [] |
| 1341 | |
| 1342 | def accept(self, visitor: OpVisitor[T]) -> T: |
| 1343 | return visitor.visit_truncate(self) |
| 1344 | |
| 1345 | |
| 1346 | @final |
no outgoing calls
no test coverage detected
searching dependent graphs…