P2, LLVM, and many extra languages
in Propeller 2
While I understand the sentiment a lot of older users have around the P2 and preferring Spin2, FORTH, BASIC, Assembly, etc (I personally love writing assembly projects in my free time, and FORTH is fun.), I have to acknowledge that support for a larger language set that LLVM provides is important, as that opens the doors for C, C++, Rust, TinyGo, and many, many other languages that use LLVM as a backend. I've looked at the P2LLVM project a bit, and I think the biggest issue is just that it doesn't have much support.
I'm likely going to try working on P2LLVM myself, but I'm pretty much brand new to the P2, it having only arrived 2 days ago, also brand new to LLVM, and rusty with C++, as most of my projects these days are in Rust.
Not having official C support is a bit detrimental to the P2, at that, as people i've talked to have expressed that one of the reasons they didn't really use the Propeller was the lack of C, C++, or other much more common languages.
I'm hoping that, eventually, C will be an officially supported language for the processor. LLVM exists and can provide the backbone for such an effort, as it already has a grade A optimizer and established infrastructure.
I'm likely going to try working on P2LLVM myself, but I'm pretty much brand new to the P2, it having only arrived 2 days ago, also brand new to LLVM, and rusty with C++, as most of my projects these days are in Rust.
Not having official C support is a bit detrimental to the P2, at that, as people i've talked to have expressed that one of the reasons they didn't really use the Propeller was the lack of C, C++, or other much more common languages.
I'm hoping that, eventually, C will be an officially supported language for the processor. LLVM exists and can provide the backbone for such an effort, as it already has a grade A optimizer and established infrastructure.
Comments
For now, you'll have to use one of the existing community compilers. It sounds like you're planning to help out with p2llvm, and that's great! There are also some other C compilers you could look at:
Catalina C
FlexProp
p2gcc
riscvp2
These are all in various states of development and with varying degrees of support.
I approve this message! :-)
The P2's flag registers ended up needing specialized handling to use them efficiently, which is somewhat annoying but I'll work with it, could get some cool opts out of it.
LLVM's Tablegen DSL has been a bit of a blessing, specifying the P2's instructions would be much more tedious without it!
I'd love to help with this, although I don't have experience in LLVM (only ever used gcc). My current focus is on documentation improvements (see my other thread) but I have enough C/C++ experience that I could help write a new P2 backend.
@sjgallagher2 I'd appreciate the help. When I get home, I'll push my current progress to a fork on github so you can see what's been done so far.
My own progress has been a bit slow, as not only am I learning LLVM's codebase, I'm also relearning C/C++, as I haven't actively used either in a long time. I recommend configuring LLVM to only build the P2 backend to save on build times.
Forgive me if I'm pestering, but can you give us an update? The benefits of having LLVM working for P2 cannot be overstated. Thank you again for taking it on!
@RobertF I'm afraid I don't have much to say, life happened.
Alongside all that, at the moment Texas happens to be especially warm and comfortable (ha!)
I'll resume working on LLVM when I find the motivation to, but atm I don't have that, sorry.
No problem, completely understandable. That's a lot for one person to take on in his/her spare time.
@moony et al, I'd love it if you kept me in the loop on what you are working on with the LLVM backend, if you are extending what I wrote over the summer (https://github.com/ne75/p2llvm). I would hope you aren't starting from scratch, I wrote a lot so far. I haven't many updates recently as it does what I need it to do, and have't seen too many others actually use it and report problems. I do intend to continue to support this as I can.