Frédéric Heitzmann
2015-Jul-10 14:16 UTC
[LLVMdev] How to add a new target/toolchain to Clang ?
Thanks Tom for your help, it as indeed very easy to make the link with the linker (not sick joke). Unfortunately, clang generates object files for target x86_64, even though I try --target --triple, --arch, ... What is the trick to tell him which target to use ? -- Fred ps: not looked yet at inline assembly 2015-07-09 18:40 GMT+02:00 Tom Stellard <tom at stellard.net>:> On Thu, Jul 09, 2015 at 03:57:53PM +0200, Frédéric Heitzmann wrote: > > Hi all, > > > > I have been developping a out-of-tree backend. > > I would like to integrate it with clang. > > Note that my backend is rather simple, generates elf32, and I do not need > > about linux, libary paths, ... > > > > Can someone give me a pointer to a readme, an article, or maybe a good > > (i.e. simple) example ? > > > > Note :on a second step, I would like to support inline assembly in C > code.. > > > > Here is a simple example for adding a new toolchain: > http://reviews.llvm.org/D10700 > > See R600TargetInfo in lib/Basic/Targets.cpp for an example of a > simple Target that supports inline assembly. > > -Tom > > > -- > > Frederic Heitzmann > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150710/f74e526e/attachment.html>
On Fri, Jul 10, 2015 at 04:16:33PM +0200, Frédéric Heitzmann wrote:> Thanks Tom for your help, it as indeed very easy to make the link with the > linker (not sick joke). > Unfortunately, clang generates object files for target x86_64, even though > I try --target --triple, --arch, ... > What is the trick to tell him which target to use ? >The option to use is -target: clang -target yourcpu-- in.c You also need to teach clang to map the triple to your TargetInfo implementation. See AllocateTarget() in lib/Basic/Targets.cpp -Tom> -- > Fred > ps: not looked yet at inline assembly > > > 2015-07-09 18:40 GMT+02:00 Tom Stellard <tom at stellard.net>: > > > On Thu, Jul 09, 2015 at 03:57:53PM +0200, Frédéric Heitzmann wrote: > > > Hi all, > > > > > > I have been developping a out-of-tree backend. > > > I would like to integrate it with clang. > > > Note that my backend is rather simple, generates elf32, and I do not need > > > about linux, libary paths, ... > > > > > > Can someone give me a pointer to a readme, an article, or maybe a good > > > (i.e. simple) example ? > > > > > > Note :on a second step, I would like to support inline assembly in C > > code.. > > > > > > > Here is a simple example for adding a new toolchain: > > http://reviews.llvm.org/D10700 > > > > See R600TargetInfo in lib/Basic/Targets.cpp for an example of a > > simple Target that supports inline assembly. > > > > -Tom > > > > > -- > > > Frederic Heitzmann > > > > > _______________________________________________ > > > LLVM Developers mailing list > > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > >
Frédéric Heitzmann
2015-Jul-10 16:15 UTC
[LLVMdev] How to add a new target/toolchain to Clang ?
2015-07-10 16:37 GMT+02:00 Tom Stellard <tom at stellard.net>:> > You also need to teach clang to map the triple to your > TargetInfo implementation. See AllocateTarget() in lib/Basic/Targets.cpp >Good catch. clang is now generating asm files for my target. Although llc works, llvm-mc is not finished yet, so it breaks. Is there a reason clang generates asm then object files, instead of going internaly to MCInst then object file ? And can I force it to do so ? I did not find the appropriate option or hook in class ToolChain ... -- Fred -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150710/8838c345/attachment.html>