diff options
| author | Eckhart Köppen <eck@40hz.org> | 2023-03-01 16:49:12 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-03-03 15:20:31 +0200 |
| commit | 6be5946ed8026f2a7ae990aced9572f229acecf4 (patch) | |
| tree | 01692e153e9d4cd79358a54f7a2c9c16b4cc8080 /src/Sema.zig | |
| parent | fdee558e45e4587aa5345b0de531a9b56a8682fd (diff) | |
| download | zig-6be5946ed8026f2a7ae990aced9572f229acecf4.tar.gz zig-6be5946ed8026f2a7ae990aced9572f229acecf4.zip | |
sema: Place functions on AVR in flash addrspace
- Use .flash as the default address space for functions on AVR
- Return .flash as the address space for function pointers on AVR
without explicit address space
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 46b47cd23d..f9a6f39867 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -17328,11 +17328,11 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air break :blk abi_align; } else 0; - const address_space = if (inst_data.flags.has_addrspace) blk: { + const address_space: std.builtin.AddressSpace = if (inst_data.flags.has_addrspace) blk: { const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); extra_i += 1; break :blk try sema.analyzeAddressSpace(block, addrspace_src, ref, .pointer); - } else .generic; + } else if (elem_ty.zigTypeTag() == .Fn and target.cpu.arch == .avr) .flash else .generic; const bit_offset = if (inst_data.flags.has_bit_range) blk: { const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
