Page 2 of 2

Re: Languages

Posted: Thu Mar 17, 2011 11:02 pm
by jonathan
Hmm...

Re: Languages

Posted: Thu Mar 31, 2011 2:42 pm
by richard
Since there is interest in how XMOS are using LLVM I thought it would be worth updating people on the status of the XCore LLVM backend.

For anyone not familiar with it LLVM is a toolkit that can be used to build compilers (amongst other things). I suggest visiting llvm.org for an overview of this technology. Some time ago XMOS implemented an XCore backend for LLVM that produces XCore assembly. The C compiler shipped with the tools is based on the llvm-gcc compiler. This combines a GCC based C/C++ frontend with various LLVM optimisation passes and with the XCore LLVM backend. We have been shipping this since the 8.10 tools release so, at least for the subset of things you can do from C/C++, I would consider the XCore backend to be a production quality backend.

In the last 2 months we have extended this backend with intrinsics to support architectural features that aren't targeted from C. In particular we have added support for I/O operations, events and starting / synchronising threads. This support is sufficient to implement XC language features such as selects, par statements and inputs and outputs on ports / timers / channels. While there's still plenty of work to do (mainly on optimisations) if any one is interested in building a compiler targeting the XCore then I hope they would at least consider using this backend.

All the these changes are available from the LLVM SVN repository (see llvm.org for access details). As the maintainer of the XCore backend in LLVM I'm very happy to talk about any aspect of the backend.

Re: Languages

Posted: Thu Mar 31, 2011 3:01 pm
by daveg
richard wrote:The C compiler shipped with the tools is based on the llvm-gcc compiler. This combines a GCC based C/C++ frontend with various LLVM optimisation passes and with the XCore LLVM backend. We have been shipping this since the 8.10 tools release so, at least for the subset of things you can do from C/C++, I would consider the XCore backend to be a production quality backend.
The llvm-gcc frontend also supports Ada, but we haven't tested this at all. If the Ada support requires functionality which is not supported in our LLVM Xcore backend then it won't work, but it is possible that this already works.

Re: Languages

Posted: Thu Mar 31, 2011 5:28 pm
by Folknology
Hi Richard

Thanks for the update. Is there a reason for using GCC-LLVM rather than CLANG now? I understand that before that the C++ part was weak, but ins't that fixed now?

Will there be an XC LLVM front end? if not how will that part work?

regards
Al

Re: Languages

Posted: Thu Mar 31, 2011 6:26 pm
by richard
Folknology wrote:Hi Richard

Thanks for the update. Is there a reason for using GCC-LLVM rather than CLANG now? I understand that before that the C++ part was weak, but isn't that fixed now?
When we first needed a C compiler clang just wasn't a realistic option. It had only just been released and was still labelled as being experimental. Clang has improved to the point where we could feasibly switch to it, but this has to be prioritised against all the other work we want to do.

Re: Languages

Posted: Thu Apr 28, 2011 12:17 am
by Folknology
In the last 2 months we have extended this backend with intrinsics to support architectural features that aren't targeted from C. In particular we have added support for I/O operations, events and starting / synchronising threads. This support is sufficient to implement XC language features such as selects, par statements and inputs and outputs on ports / timers / channels. While there's still plenty of work to do (mainly on optimisations) if any one is interested in building a compiler targeting the XCore then I hope they would at least consider using this backend.

All the these changes are available from the LLVM SVN repository (see llvm.org for access details). As the maintainer of the XCore backend in LLVM I'm very happy to talk about any aspect of the backend.
Richard is there some documentation that I can use to access these architectural features from C (gcc-llvm) ? I would very much like to do so but have nothing to work from..

P.S. I already looked at the 11.2 LLVM sources and couldn't find the intrinsics you refer to, all I found were ; int_xcore_bitrev , int_xcore_getid , int_xcore_getps , int_xcore_setps

regards
Al

Re: Languages

Posted: Sat Apr 30, 2011 8:45 pm
by Folknology
Ok I have checked out the svn trunk for LLVM and I can see the intrinsics now.

When will these be included in an Xmos release?

Will they be included with the next tools update?

Is there any way to use them before the tools release via a patch or something?

regards
Al

Re: Languages

Posted: Thu Feb 02, 2012 6:05 pm
by Gravis
I know this thread is old but it's worth talking about.

i would really like to see a standard C++ implementation of all the benefits of the XC language. I have a friend who is releasing a product using an FPGA instead because "their syntax isn't horrible, it's just kinda.. very confusing at first few glances" but then "the example code there shows some of the things that made me run away in fear".

A lot of those scary syntax issues can be resolved with some fairly simple C++ code or maybe a set of C functions. It looks like XC barrows some traits of VHDL which is as far as I can tell, this is opposite of what XMOS wants to be.

As for me, I'm going to write my own (zero overhead) wrappers to remove as much of the new syntax as possible.