[LLVMdev] How to add a new target/toolchain to Clang ?

Tom Stellard tom at stellard.net
Fri Jul 10 10:27:57 PDT 2015


On Fri, Jul 10, 2015 at 06:15:08PM +0200, Frédéric Heitzmann wrote:
> 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 ...
> 

You can force it to use MCInst with the option -fintegrated-as.  You can
also set this as the default in your ToolChain.  The AMDGPU ToolChain
patch has an example of using the integrated assembler by default:
see AMDGPUToolChain::IsIntegratedAssemblerDefault().

-Tom

> --
> Fred




More information about the llvm-dev mailing list