Difference between revisions of "NaplesPU Tools"

From NaplesPU Documentation
Jump to: navigation, search
Line 39: Line 39:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Finally, we remove the possibility of targeting a different architecture then NuPlus.
 
Finally, we remove the possibility of targeting a different architecture then NuPlus.
 +
 +
==== CMakeLists.txt ====

Revision as of 15:28, 12 September 2017

A new backend for llvm needs to be added and registered. After registration, llvm tools are able to lookup and use the new target at runtime. In the following, we will show which files are involved in the registration phase and which changes are required.

CMakeLists.txt

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
	set(CMAKE_INSTALL_PREFIX "/usr/local/llvm-nuplus/" CACHE PATH "NuPlusLLVM install prefix" FORCE)
endif()

This specifies the installation path that, in our case, is: "/usr/local/llvm-nuplus/".

set(LLVM_ALL_TARGETS
  AArch64
  AMDGPU
  ARM
  BPF
  Hexagon
  Mips
  MSP430
  NVPTX
  PowerPC
  Sparc
  SystemZ
  X86
  XCore
  NuPlus
  )

The target name should be added to the LLVM_ALL_TARGETS list.

set(LLVM_TARGETS_TO_BUILD "NuPlus" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")

In a standard version of llvm, the LLVM_TARGETS_TO_BUILD variable is set to "all" in order to compile llvm with all the provided target backends. In out custom compiler, we set this variable to "NuPlus". In this way the compiler is built just targeting the NuPlus architecture.

set(LLVM_DEFAULT_TARGET_TRIPLE "nuplus-none-none" CACHE STRING "Default target for which LLVM will generate code." )

Finally, we remove the possibility of targeting a different architecture then NuPlus.

CMakeLists.txt