You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am interested in using the ps2sdk libraries with LLVM, enabling use of many modern languages, mostly Zig and Swift 🙂
This project appears to be using a custom GCC target. What are the reasons for it, what does it do, and where can I find such documentation? This seems to require a new LLVM target to match, but I'm not sure where to start. I don't seem to be able to link the libraries with LLVM object files otherwise.
LLVM does have support for the normal MIPS CPU's. However the generated MIPS code is not as good as what gcc generates (more instructions to do the same thing).
LLVM does not support MIPS R5900.
GCC has basic MIPS R5900 support (but not complete)
You can try compiling with LLVM to MIPS III (ABI n32) as that should be compatible. But you'll probably be the first to do so, so expect a lot of issues.
@10522 I know about it, but it's not actually using LLVM. It's using Zig's ability to compile directly to C code, and then compiling that C code using this sdk.
What I want is to do is get LLVM itself working for this target and LLVM doesn't support compiling to C, It's a feature specific to Zig.
Unfortunately my choice of languages seems to be limited:
Can't use modern C++ because I doubt there is a libc++ port for this platform, cross compiling to a modern platform like Windows was already a nightmare.
Can't use Zig because its own target triples don't expose all of LLVM's, that seems to include n32 unless it's hidden somewhere.
I could use C but at that point LLVM seems like a disadvantage, I can just use this sdk entirely. Especially since I am now told LLVM doesn't generate especially good MIPS.
I am left with Rust, which I don't like, and Swift which should only require building the standard library for this triple.
That's a lot of issues even before getting to proper LLVM support, which I can't do anything about — it looks like an insanely complicated codebase. I can see why no one would bother with trying this.
Still, it does seem like it's possible to hack something together.
Activity
rickgaiser commentedon Jan 5, 2025
LLVM does have support for the normal MIPS CPU's. However the generated MIPS code is not as good as what gcc generates (more instructions to do the same thing).
LLVM does not support MIPS R5900.
GCC has basic MIPS R5900 support (but not complete)
You can try compiling with LLVM to MIPS III (ABI n32) as that should be compatible. But you'll probably be the first to do so, so expect a lot of issues.
Search for:
To get more information.
10522 commentedon Jan 8, 2025
@rickgaiser @TeamPuzel check out this.
TeamPuzel commentedon Jan 8, 2025
@10522 I know about it, but it's not actually using LLVM. It's using Zig's ability to compile directly to C code, and then compiling that C code using this sdk.
What I want is to do is get LLVM itself working for this target and LLVM doesn't support compiling to C, It's a feature specific to Zig.
Unfortunately my choice of languages seems to be limited:
I am left with Rust, which I don't like, and Swift which should only require building the standard library for this triple.
That's a lot of issues even before getting to proper LLVM support, which I can't do anything about — it looks like an insanely complicated codebase. I can see why no one would bother with trying this.
Still, it does seem like it's possible to hack something together.
uyjulian commentedon Jan 8, 2025
C++ is already supported for EE.
For other LLVM based languages you can compile to WebAssembly then use wasm2c to convert to C which then can be used as input to gcc.
10522 commentedon Jan 8, 2025
@TeamPuzel you can also use AthenaEnv (JavaScript), Enceladus (Lua) or Prussia (Rust).
10522 commentedon Jan 21, 2026
@TeamPuzel check out this.
rickgaiser commentedon Jan 21, 2026
Full support EE LLVM compiler (r5900, MMI, VU0 and more) here:
https://github.com/rickgaiser/llvm-project/tree/EmotionEngine
Build instructions:
Usage:
GCC and LLVM object files are interchangable. So you can compile your project using LLVM/clang and link libraries from ps2sdk compiled with GCC.
Attempt to merge the most basic changes upstream here:
llvm/llvm-project#176666
rickgaiser commentedon Jan 22, 2026
@TeamPuzel I got Zig working on ps2 with the new LLVM compiler. Code here:
https://github.com/rickgaiser/test_llvm_zig