Registering a target
For running the llc tool in the TOY target architecture, it has to be registered with the llc tool. This recipe demonstrates which configuration files need to be modified to register a target. The build files are modified in this recipe.
How to do it…
To register a target with a static compiler, follow these steps:
- First, add the entry of the TOY backend to
llvm_root_dir/CMakeLists.txt
:set(LLVM_ALL_TARGETS AArch64 ARM … … TOY )
- Then add the toy entry to
llvm_root_dir/include/llvm/ADT/Triple.h
:class Triple { public: enum ArchType { UnknownArch, arm, // ARM (little endian): arm, armv.*, xscale armeb, // ARM (big endian): armeb aarch64, // AArch64 (little endian): aarch64 … … toy // TOY: toy };
- Add the toy entry to
llvm_root_dir/include/llvm/ ...
Get LLVM Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.