| ... | ... | @@ -302,7 +302,11 @@ pub const DeclGen = struct { |
| 302 | 302 | else => return dg.fail("TODO float types > 64 bits are not support in renderValue() as of now", .{}), |
| 303 | 303 | } |
| 304 | 304 | }, |
| 305 | | |
| 305 | .Pointer => switch (dg.module.getTarget().cpu.arch.ptrBitWidth()) { |
| 306 | 32 => return writer.writeAll("(void *)0xaaaaaaaa"), |
| 307 | 64 => return writer.writeAll("(void *)0xaaaaaaaaaaaaaaaa"), |
| 308 | else => unreachable, |
| 309 | }, |
| 306 | 310 | else => { |
| 307 | 311 | // This should lower to 0xaa bytes in safe modes, and for unsafe modes should |
| 308 | 312 | // lower to leaving variables uninitialized (that might need to be implemented |
| ... | ... | @@ -685,6 +689,7 @@ pub const DeclGen = struct { |
| 685 | 689 | var it = struct_obj.fields.iterator(); |
| 686 | 690 | while (it.next()) |entry| { |
| 687 | 691 | const field_ty = entry.value_ptr.ty; |
| 692 | if (!field_ty.hasCodeGenBits()) continue; |
| 688 | 693 | const name: CValue = .{ .bytes = entry.key_ptr.* }; |
| 689 | 694 | try buffer.append(' '); |
| 690 | 695 | try dg.renderTypeAndName(buffer.writer(), field_ty, name, .Mut); |
| ... | ... | @@ -1400,9 +1405,19 @@ fn airAlloc(f: *Function, inst: Air.Inst.Index) !CValue { |
| 1400 | 1405 | const writer = f.object.writer(); |
| 1401 | 1406 | const inst_ty = f.air.typeOfIndex(inst); |
| 1402 | 1407 | |
| 1403 | | // First line: the variable used as data storage. |
| 1404 | 1408 | const elem_type = inst_ty.elemType(); |
| 1405 | 1409 | const mutability: Mutability = if (inst_ty.isConstPtr()) .Const else .Mut; |
| 1410 | if (!elem_type.hasCodeGenBits()) { |
| 1411 | const target = f.object.dg.module.getTarget(); |
| 1412 | const literal = switch (target.cpu.arch.ptrBitWidth()) { |
| 1413 | 32 => "(void *)0xaaaaaaaa", |
| 1414 | 64 => "(void *)0xaaaaaaaaaaaaaaaa", |
| 1415 | else => unreachable, |
| 1416 | }; |
| 1417 | return CValue{ .bytes = literal }; |
| 1418 | } |
| 1419 | |
| 1420 | // First line: the variable used as data storage. |
| 1406 | 1421 | const local = try f.allocLocal(elem_type, mutability); |
| 1407 | 1422 | try writer.writeAll(";\n"); |
| 1408 | 1423 | |