On 28 August 2013 18:17, pavan p m pm.pavan@gmail.com wrote:
Thanks Renato, Yes, i wanted to cross-compile from x86_64 to ARM. More specifically, I needed to do it for the cortex m0 processor. My eventual goal would be to tweak a certain part of the instruction scheduler specific to the project I am working on. So I am thinking if it is possible using LLVM.
This is most definitely possible! ;)
I saw that there is support for cortex-a9 onwards, but am not sure, if
there is any support for cortex m series.
There is support for M0, you just have to specify "-target thumbv6m -mcpu=cortex-m0" and you should be good to go. Because LLVM is inherently a cross-compiler, you can only specify a CPU when using the right back-end, and you do so by specifying the "-target". I agree this is confusing and I intend to map all confusing things when cross-compiling, so if you do find weird behaviour, be sure to send my way.
In that case, I would have implement a backend which would support this
particular board. This seems to be a long shot, but would you provide your opinion if this is possible at all? If not, then what would be the proper approach?
You don't need to implement the back-end, only the pass you want. I'm not sure how easy it is to plugin a new scheduler, as the LLVM scheduler is a bit of a mess, but you could try by changing the current scheduler(s).
A few documents that you can find interesting, some of which you seem to have read already:
http://llvm.org/docs/WritingAnLLVMBackend.html
http://llvm.org/docs/CodeGenerator.html
http://llvm.org/docs/CodingStandards.html
http://llvm.org/docs/ProgrammersManual.html
cheers, --renato