| 299 | self.emit_line(f"{dest}.f{i} = {self.reg(item)};") |
| 300 | |
| 301 | def visit_assign(self, op: Assign) -> None: |
| 302 | dest = self.reg(op.dest) |
| 303 | src = self.reg(op.src) |
| 304 | # clang whines about self assignment (which we might generate |
| 305 | # for some casts), so don't emit it. |
| 306 | if dest != src: |
| 307 | src_type = op.src.type |
| 308 | dest_type = op.dest.type |
| 309 | if src_type.is_unboxed and not dest_type.is_unboxed: |
| 310 | # We sometimes assign from an integer prepresentation of a pointer |
| 311 | # to a real pointer, and C compilers insist on a cast. |
| 312 | src = f"(void *){src}" |
| 313 | elif not src_type.is_unboxed and dest_type.is_unboxed: |
| 314 | # We sometimes assign a pointer to an integer type (e.g. to create |
| 315 | # tagged pointers), and here we need an explicit cast. |
| 316 | src = f"({self.emitter.ctype(dest_type)}){src}" |
| 317 | self.emit_line(f"{dest} = {src};") |
| 318 | |
| 319 | def visit_assign_multi(self, op: AssignMulti) -> None: |
| 320 | typ = op.dest.type |