New LLVM backend Target: compile procedure

Hi all,

I’m trying to get familiar with the LLVM build procedure when adding a new Target.

In the main source tree, i copied the lib/Target/MSP430 as lib/Target/newUC and renamed all the files. Further i edited the different files like Triple.h, Triple.cpp, LLVMBuild.txt, CMakeLists.txt, CallingConv.h to take in this new Target.

Then i deleted the files under the current build/ and started the LLVM build process anew.

Is all of this the right way to go about this ?

I expect i’ll make have many issues/fixes to iterate over when modifying the files for my newTarget. Given, the build takes a long time, is there a way to do this faster ? Already been waiting 20mins for it to finish.

Thanks,
AX

     Is all of this the right way to go about this ?

It all sounds reasonable. Since you're just starting you should be
using the CMake build system (we're trying to get rid of the
llvm/configure script). Make sure it reports finding out about your
directory to avoid wasting time with useless builds.

     I expect i'll make have many issues/fixes to iterate over when
modifying the files for my newTarget. Given, the build takes a long time, is
there a way to do this faster ? Already been waiting 20mins for it to
finish.

When hacking around you usually get a huge saving from doing
incremental builds. Usually just a matter of seconds for modifying
files within your lib/Target/newUC. Modifying Triple.h is still very
bad though and causes an almost complete rebuild.

Just building the tool you're using to test speeds things up even more
"make llc" rather than "make all".

Cheers.

Tim.

      Is all of this the right way to go about this ?

It all sounds reasonable. Since you're just starting you should be
using the CMake build system (we're trying to get rid of the
llvm/configure script). Make sure it reports finding out about your
directory to avoid wasting time with useless builds.

      I expect i'll make have many issues/fixes to iterate over when
modifying the files for my newTarget. Given, the build takes a long time, is
there a way to do this faster ? Already been waiting 20mins for it to
finish.

When hacking around you usually get a huge saving from doing
incremental builds. Usually just a matter of seconds for modifying
files within your lib/Target/newUC. Modifying Triple.h is still very
bad though and causes an almost complete rebuild.

Just building the tool you're using to test speeds things up even more
"make llc" rather than "make all".

Disabling some of the target architectures that you don't need also helped a lot in link-time for me.

Cheers,
  Roel

I expect i’ll make have many issues/fixes to iterate over when

modifying the files for my newTarget. Given, the build takes a long time, is

there a way to do this faster ? Already been waiting 20mins for it to

finish.

There was a lightning talk at EuroLLVM about speeding up the build process. The slides and recording can be found at http://llvm.org/devmtg/2015-04/, look for ‘Building Clang/LLVM efficiently’.

The talk goes into more detail but one of the bigger things you can do in the cmake build is set BUILD_SHARED_LIBS to ON.