-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Hexagon-specific compiler-rt routines to Zig #21579
Comments
Does Is it useful to link against the clangrt library from the C/C++ toolchain or do most/all architectures for Zig have these built by/for zig itself? |
Not at the moment. But we could just make our LLVM backend set that flag for Hexagon specifically. I'm unsure if that's sufficient to make LLVM stop emitting these libcalls though.
As a rule, the Zig toolchain has to be completely self-contained except in cases where that's outright impossible (think |
Yeah that makes sense. We did contribute a similar item for rust not long ago. Though we kinda cheated there and just used a thin wrapper around the assembly. If we need to create zig implementations of these builtins with inline asm that might take a bit more doing. |
It wouldn't actually be terribly hard since Zig does support naked functions. So you basically just preprocess the assembly files and then paste the resulting assembly into an |
Yeah - I think my initial contribution for Rust looked more like that version, actually. For a couple of these algorithms, you lose a little bit of maintainability by taking the preprocessor output. But it's doable. I don't yet have permission to contribute to zig but I'll make the request and see how it goes. |
Here's the script I used to automate the "boring grunt work" for rust. Under review, this approach was rejected for rust's
|
@alexrp does this look about right?
|
I haven't reviewed the actual assembly in depth, but I'm happy to trust you on that. 🙂 |
ok - excellent. I've made these changes locally and should be able to share them Real Soon Now. |
Opened #22029 |
To complete our Hexagon support, we will need to port the Hexagon-specific compiler-rt routines to naked functions in Zig: https://github.com/llvm/llvm-project/tree/6c25604df2f669a0403a17dbdbe5c081db1e80a1/compiler-rt/lib/builtins/hexagon
For some of these, as a stopgap, we may be able to get away with using the generic routines we already have and just exporting them with the Hexagon-specific names. That may even be preferable unless we have strong evidence that the hand-written routines are significantly better.
Here is the actual usage in LLVM:
As far as I can see,
all but thethey all use the regular C calling convention.memcpy
helperThe text was updated successfully, but these errors were encountered: