LLVS newbie adding a new target

Hi

I am interested in developing a new target for LLVM and wanted to check where my new code should reside. Should I just add a new sub-directory to lib/Targets and populate that with the necessary files? I am using ARM as a template, as I am most familiar with that architecture, so I assume copying files from that directory is a good starting point.

I have tried a trivial build of a new target based on ARM by copying all the ARM target files to a new directory and changing names of files in the code to create a "new" target. After adding the new target to the TARGETS_TO_BUILD list in "configure", I was able to "make" a new build that included the new target. Of course it is just a copy of the ARM target at this stage but it confirms I have grasped the basics of the LLVM tree and build process.

My concern is that, if there is a new release of LLVM, I will need to re-integrate my source into it. At this stage this looks fairly trivial to do but I do now want to get caught out in the future by ploughing on without checking there is not a more intelligent way to organise my code that I have overlooked.

Cheers,

- Dyson

Hi

I am interested in developing a new target for LLVM and wanted to check
where my new code should reside. Should I just add a new sub-directory
to lib/Targets and populate that with the necessary files?

Yup! That would be the place.

I am using
ARM as a template, as I am most familiar with that architecture, so I
assume copying files from that directory is a good starting point.

Your assumption is correct. :slight_smile:

I have tried a trivial build of a new target based on ARM by copying all
the ARM target files to a new directory and changing names of files in
the code to create a "new" target. After adding the new target to the
TARGETS_TO_BUILD list in "configure", I was able to "make" a new build
that included the new target. Of course it is just a copy of the ARM
target at this stage but it confirms I have grasped the basics of the
LLVM tree and build process.

My concern is that, if there is a new release of LLVM, I will need to
re-integrate my source into it. At this stage this looks fairly trivial
to do but I do now want to get caught out in the future by ploughing on
without checking there is not a more intelligent way to organise my code
that I have overlooked.

No, what you're doing is the best approach. If you want, you can live
off of the SVN top-of-tree. Then you won't have to worry about merging
with a new release problems. You also get the benefit of being on top
of changes that could affect the interface to your new back-end. Of
course, there could be breakage having nothing to do with your
back-end that you'll have to deal with. So there are trade-offs.

-bw