Skip to content
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

LLVM #713

Open
TeamPuzel opened this issue Jan 5, 2025 · 5 comments
Open

LLVM #713

TeamPuzel opened this issue Jan 5, 2025 · 5 comments

Comments

@TeamPuzel
Copy link

Hello,

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.

@rickgaiser
Copy link
Member

rickgaiser commented 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:

  • TOSHIBA C790 superscalar microprocessor
  • EE R5900

To get more information.

@10522
Copy link

10522 commented Jan 8, 2025

@rickgaiser @TeamPuzel check out this.

@TeamPuzel
Copy link
Author

@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.

@uyjulian
Copy link
Member

uyjulian commented 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
Copy link

10522 commented Jan 8, 2025

@TeamPuzel you can also use AthenaEnv (JavaScript), Enceladus (Lua) or Prussia (Rust).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants