Targetting Tricore in LLVM toolchain

Hi all. I’ve noticed some accumulated confusion about available TriCore GCC and LLVM, so let me share what I know about public TriCore code.

In the commit history of the TriDis LLVM repository, you can see " Added files from the git repo kumailxp/tricore_llvm". If you check user kumailxp, you will see they wrote an experimental backend for a master’s thesis. sidneyp has only made a couple commits since then, and their repo is based on LLVM 3.7.

obviously they added Tricore support in the LLVM

This “they” in question is my current employer, HighTec, so, what I can tell you guys is: our LLVM backend is probably never getting upstreamed. It’s stable and fast but closed-source, both clang and the upcoming rustc. The TriCore architecture manual (vol2, the one with instructions) is covered by NDAs, which is why you won’t find it online. Supplemental code like crt/startup code/simulator is also unlikely to become public. Maybe one day Infineon will open the ISA, but I’m wondering if at that point it will be relevant at all. There’s still unmaintained FOSS TriCore GCC now, if the use case is “having a TriCore compiler in 20 years for archival / retro computing reasons”.

You can find HighTec TriCore GCC 4.9 (or something like that) on github. This compiler is also a paid product, but the GPL requests gives every user the right to share and modify the code they use. What’s interesting is that the person who published the GCC sources also ported them to GCC 9. You can get the sources and release binaries.

Here’s where it gets interesting: if you build this TriCore GCC 9 from source, it doesn’t match the performance in benchmarks of the binary release… and if you change the order of two lines of code in CoreMark, some optimization doesn’t kick in and you’re back at the scores you’d get with the unmodified sources. Puzzling: somebody GPL requested code, and then violated the GPL to provide binaries with generally useless optimizations, just to get good benchmark scores! There’s also some extra inlining magic that happens at link time. They’re not cheating - technically.

All information in this post can be verified solely from public information and I’m expressing exclusively my personal opinion.