| author | |
| committer | |
| log | 2b9478ce12a5556a9ef596d98a14347be8daee4a |
| tree | f52142db643c655746ca3950f746e6f5555f5171 |
| parent | fd0fb26aba57ba14676dafc4c294bb5d9e75a649 |
Co-authored-by: Veikka Tuominen <git@vexu.eu>6 files changed, 29 insertions(+), 3 deletions(-)
lib/std/builtin.zig+8| ... | @@ -174,6 +174,14 @@ pub const AddressSpace = enum { | ... | @@ -174,6 +174,14 @@ pub const AddressSpace = enum { |
| 174 | param, | 174 | param, |
| 175 | shared, | 175 | shared, |
| 176 | local, | 176 | local, |
| 177 | |||
| 178 | // AVR address spaces. | ||
| 179 | flash, | ||
| 180 | flash1, | ||
| 181 | flash2, | ||
| 182 | flash3, | ||
| 183 | flash4, | ||
| 184 | flash5, | ||
| 177 | }; | 185 | }; |
| 178 | 186 | ||
| 179 | /// This data structure is used by the Zig language code generation and | 187 | /// This data structure is used by the Zig language code generation and |
lib/std/target.zig+2| ... | @@ -1186,6 +1186,8 @@ pub const Target = struct { | ... | @@ -1186,6 +1186,8 @@ pub const Target = struct { |
| 1186 | .fs, .gs, .ss => arch == .x86_64 or arch == .x86, | 1186 | .fs, .gs, .ss => arch == .x86_64 or arch == .x86, |
| 1187 | .global, .constant, .local, .shared => is_gpu, | 1187 | .global, .constant, .local, .shared => is_gpu, |
| 1188 | .param => is_nvptx, | 1188 | .param => is_nvptx, |
| 1189 | // TODO this should also check how many flash banks the cpu has | ||
| 1190 | .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => arch == .avr, | ||
| 1189 | }; | 1191 | }; |
| 1190 | } | 1192 | } |
| 1191 | 1193 |
src/Sema.zig+2| ... | @@ -31938,6 +31938,8 @@ pub fn analyzeAddressSpace( | ... | @@ -31938,6 +31938,8 @@ pub fn analyzeAddressSpace( |
| 31938 | .param => is_nv, | 31938 | .param => is_nv, |
| 31939 | .global, .shared, .local => is_gpu, | 31939 | .global, .shared, .local => is_gpu, |
| 31940 | .constant => is_gpu and (ctx == .constant), | 31940 | .constant => is_gpu and (ctx == .constant), |
| 31941 | // TODO this should also check how many flash banks the cpu has | ||
| 31942 | .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => arch == .avr, | ||
| 31941 | }; | 31943 | }; |
| 31942 | 31944 | ||
| 31943 | if (!supported) { | 31945 | if (!supported) { |
src/codegen/llvm.zig+10| ... | @@ -10241,6 +10241,16 @@ fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Targe | ... | @@ -10241,6 +10241,16 @@ fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Targe |
| 10241 | .local => llvm.address_space.amdgpu.private, | 10241 | .local => llvm.address_space.amdgpu.private, |
| 10242 | else => unreachable, | 10242 | else => unreachable, |
| 10243 | }, | 10243 | }, |
| 10244 | .avr => switch (address_space) { | ||
| 10245 | .generic => llvm.address_space.default, | ||
| 10246 | .flash => llvm.address_space.avr.flash, | ||
| 10247 | .flash1 => llvm.address_space.avr.flash1, | ||
| 10248 | .flash2 => llvm.address_space.avr.flash2, | ||
| 10249 | .flash3 => llvm.address_space.avr.flash3, | ||
| 10250 | .flash4 => llvm.address_space.avr.flash4, | ||
| 10251 | .flash5 => llvm.address_space.avr.flash5, | ||
| 10252 | else => unreachable, | ||
| 10253 | }, | ||
| 10244 | else => switch (address_space) { | 10254 | else => switch (address_space) { |
| 10245 | .generic => llvm.address_space.default, | 10255 | .generic => llvm.address_space.default, |
| 10246 | else => unreachable, | 10256 | else => unreachable, |
src/codegen/llvm/bindings.zig+6-2| ... | @@ -1530,8 +1530,12 @@ pub const address_space = struct { | ... | @@ -1530,8 +1530,12 @@ pub const address_space = struct { |
| 1530 | 1530 | ||
| 1531 | // See llvm/lib/Target/AVR/AVR.h | 1531 | // See llvm/lib/Target/AVR/AVR.h |
| 1532 | pub const avr = struct { | 1532 | pub const avr = struct { |
| 1533 | pub const data_memory: c_uint = 0; | 1533 | pub const flash: c_uint = 1; |
| 1534 | pub const program_memory: c_uint = 1; | 1534 | pub const flash1: c_uint = 2; |
| 1535 | pub const flash2: c_uint = 3; | ||
| 1536 | pub const flash3: c_uint = 4; | ||
| 1537 | pub const flash4: c_uint = 5; | ||
| 1538 | pub const flash5: c_uint = 6; | ||
| 1535 | }; | 1539 | }; |
| 1536 | 1540 | ||
| 1537 | // See llvm/lib/Target/NVPTX/NVPTX.h | 1541 | // See llvm/lib/Target/NVPTX/NVPTX.h |
src/codegen/spirv.zig+1-1| ... | @@ -548,7 +548,7 @@ pub const DeclGen = struct { | ... | @@ -548,7 +548,7 @@ pub const DeclGen = struct { |
| 548 | .gs, .fs, .ss => unreachable, | 548 | .gs, .fs, .ss => unreachable, |
| 549 | .shared => .Workgroup, | 549 | .shared => .Workgroup, |
| 550 | .local => .Private, | 550 | .local => .Private, |
| 551 | .global, .param, .constant => unreachable, | 551 | .global, .param, .constant, .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => unreachable, |
| 552 | }; | 552 | }; |
| 553 | } | 553 | } |
| 554 | 554 |