Commit Graph

1809 Commits

Author SHA1 Message Date
David Rubin
c00a5ff792 riscv: implement @floatFromInt 2024-07-26 04:19:16 -07:00
David Rubin
1a7d89a84d riscv: clean up and unify encoding logic 2024-07-26 04:19:13 -07:00
David Rubin
574028ed5e riscv: boilerplate for creating lazy functions 2024-07-26 04:05:44 -07:00
David Rubin
64c6473443 riscv: implement add_sat and ptr_slice_len_ptr
this is enough to use the basic functions of an ArrayList!
2024-07-26 04:05:43 -07:00
David Rubin
6ac1b2d82a riscv: add 32-bit support to integer @abs 2024-07-26 04:05:42 -07:00
David Rubin
1820f44104 riscv: implement sub-byte addition 2024-07-26 04:05:42 -07:00
David Rubin
81ca3a1d59 riscv: fix logic bug in ptr_elem_ptr
I was doing duplicate work with `elemOffset` multiplying by the abi size and then the `ptr_add` `genBinOp` also multiplying.

This led to having writes happening in the wrong place.
2024-07-26 04:05:41 -07:00
David Rubin
cde6956b21 riscv: remove redundant assert in genBinOp 2024-07-26 04:05:41 -07:00
David Rubin
d3f75522d7 lower: fix logic bug in cmp_gt 2024-07-26 04:05:40 -07:00
David Rubin
c78ebeb44c riscv: implement ptr_slice_ptr_ptr
just one step closer to allocation
2024-07-26 04:05:40 -07:00
David Rubin
93e9c7a963 riscv: implement @clz 2024-07-26 04:05:39 -07:00
David Rubin
8d30fc45c4 riscv: implement more operators
we can run `std.debug.print` now, with both run-time strings and integers!
2024-07-26 04:05:39 -07:00
David Rubin
9766b68c47 riscv: un-cache the avl and vtype when returning from a function call
the csrs `avl` and `vtype` are considered caller-saved so it could have changed while inside of the function.
the easiest way to handle this is to just set the cached `vtype` and `avl` to null, so that the next time something
needs to set it, it'll emit an instruction instead of relying on a potentially invalid setting.
2024-07-26 04:05:38 -07:00
Andrew Kelley
fa95c89a71 Merge pull request #20758 from pavelverigo/stage2-wasm-compiler-rt-test-pass
stage2-wasm: pass compiler_rt test suite
2024-07-23 20:42:25 -07:00
Pavel Verigo
ba8522e6c7 stage2-wasm: fix bigint div and trunc 2024-07-23 21:17:04 +02:00
Pavel Verigo
d71312d104 stage2-wasm: mul_sat 32 bits <=, i64, i128 2024-07-23 17:06:18 +02:00
Jakub Konka
2b84592858 macho: run more things in parallel 2024-07-22 12:06:02 +02:00
Andrew Kelley
93c546c8c9 Merge pull request #20692 from pavelverigo/stage2-wasm-overflow-ops
stage2-wasm: overflow ops improvement
2024-07-20 23:57:14 -07:00
sobolevn
4c71d3f29e Fix typos in code comments in src/ 2024-07-20 20:23:18 +03:00
Pavel Verigo
f5dd6fb71a stage2-wasm: @mulWithOverflow fixes + 128 bit signed 2024-07-20 13:21:46 +02:00
Pavel Verigo
56d535dd24 stage2-wasm: improve @shlWithOverflow for <= 128 bits
Additionally fixed a bug for shr on signed big ints
2024-07-18 18:01:06 +02:00
Pavel Verigo
dc3176d628 stage2-wasm: enhance add/subWithOverflow
Added behavior tests to verify implementation
2024-07-18 17:54:44 +02:00
Pavel Verigo
d1bd9518f9 stage2-wasm: fix big int comparison
Unexpected to be found only now
2024-07-18 17:18:17 +02:00
Jakub Konka
174de37cef macho: fix compile errors 2024-07-18 09:13:08 +02:00
Jakub Konka
5b4c0cc1f9 macho: update ZigObject to use new ownership model 2024-07-18 09:13:08 +02:00
Andrew Kelley
a57479afc2 Merge pull request #20652 from pavelverigo/stage2-wasm-finishAir
stage2-wasm: finishAir enhancement
2024-07-17 22:33:29 -07:00
Pavel Verigo
31706dc31a stage2-wasm: finishAir handle .stack result
By allowing finishAir to handle .stack results, we simplify a lot of code in
air*** functions, which try to handle this case. Also this changes will result in optimization, if one of operands is dead after instruction its place could be reused by result.

The only downside to this change is that finishAir now can return error, though it handled by returning finishAir result, because it always needs to be final in air*** functions.

Additionally I migrated WValue{ to .{ inside CodeGen.zig.
2024-07-18 00:57:45 +02:00
Pavel Verigo
6eb76f930d stage2-wasm: typeToValtype focus on .auto callconv
This is required for toLocal() correctly handling isByRef values, previous behavior was a hack.
2024-07-18 00:57:18 +02:00
Jakub Konka
9d9b5a11e8 Merge pull request #20474 from Rexicon226/riscv
more RISC-V backend progress
2024-07-17 08:39:44 +02:00
mlugg
f84a4953d2 Value: eliminate static recursion loop from value printing 2024-07-16 11:38:21 +01:00
David Rubin
5ec926cdbf riscv: refactor bin_file and zcu usage 2024-07-14 23:04:05 -07:00
David Rubin
5a2c547fc1 riscv: vectors part 3 2024-07-14 23:02:35 -07:00
David Rubin
09e9812086 riscv: vectors part 2 2024-07-14 23:02:34 -07:00
David Rubin
571aa694fd riscv: vectors part 1 2024-07-14 23:02:34 -07:00
David Rubin
3e73f37d0a riscv: implement @fence 2024-07-14 23:02:33 -07:00
David Rubin
7a02878f4e riscv: truncate airStructFieldVal result 2024-07-14 23:02:33 -07:00
David Rubin
27ceb4ae37 riscv implement @sqrt for f32/f64 2024-07-14 23:02:32 -07:00
David Rubin
0460572899 riscv: @atomicRmw
Now we generate debug undefined constants when the user asks for them to dedup across the function decl. This takes 2 instructions instead of 7 in the RISC-V backend.

TODO, we need to dedupe across function decl boundaries.
2024-07-14 23:02:32 -07:00
David Rubin
ea084e9519 riscv: @atomicLoad and @atomicStore 2024-07-14 23:02:29 -07:00
Jacob Young
a1053e8e1d InternPool: add and use a mutate mutex for each list
This allows the mutate mutex to only be locked during actual grows,
which are rare. For the lists that didn't previously have a mutex, this
change has little effect since grows are rare and there is zero
contention on a mutex that is only ever locked by one thread.  This
change allows `extra` to be mutated without racing with a grow.
2024-07-13 04:47:38 -04:00
Jacob Young
c2316c5228 InternPool: make global_error_set thread-safe 2024-07-10 21:39:55 -04:00
mlugg
f93a10f664 Air: store param names directly instead of referencing Zir 2024-07-10 11:20:08 -04:00
Jacob Young
667b4f9054 Zcu: cache fully qualified name on Decl
This avoids needing to mutate the intern pool from backends.
2024-07-10 11:10:49 -04:00
Jacob Young
ca02266157 Zcu: pass PerThread to intern pool string functions 2024-07-07 22:59:52 -04:00
Jacob Young
525f341f33 Zcu: introduce PerThread and pass to all the functions 2024-07-07 22:59:52 -04:00
Andrew Kelley
30ec43a6c7 Zcu: extract permanent state from File
Primarily, this commit removes 2 fields from File, relying on the data
being stored in the `files` field, with the key as the path digest, and
the value as the struct decl corresponding to the File. This table is
serialized into the compiler state that survives between incremental
updates.

Meanwhile, the File struct remains ephemeral data that can be
reconstructed the first time it is needed by the compiler process, as
well as operated on by independent worker threads.

A key outcome of this commit is that there is now a stable index that
can be used to refer to a File. This will be needed when serializing
error messages to survive incremental compilation updates.
2024-07-04 17:51:35 -07:00
mlugg
2f0f1efa6f compiler: type.zig -> Type.zig 2024-07-04 21:01:42 +01:00
mlugg
ded5c759f8 Zcu: store LazySrcLoc in error messages
This change modifies `Zcu.ErrorMsg` to store a `Zcu.LazySrcLoc` rather
than a `Zcu.SrcLoc`. Everything else is dominoes.

The reason for this change is incremental compilation. If a failed
`AnalUnit` is up-to-date on an update, we want to re-use the old error
messages. However, the file containing the error location may have been
modified, and `SrcLoc` cannot survive such a modification. `LazySrcLoc`
is designed to be correct across incremental updates. Therefore, we
defer source location resolution until `Compilation` gathers the compile
errors into the `ErrorBundle`.
2024-07-04 21:01:41 +01:00
Pavel Verigo
1a951b49af stage2-wasm: not op for <= 128 bits ints 2024-07-02 15:02:59 +02:00
Pavel Verigo
5a9495002f stage2-wasm: Zcu renaming 2024-07-02 15:02:59 +02:00