May 2015
Intermediate to advanced
296 pages
5h 10m
English
This recipe shows you how to define registers and register sets in .td files. The tablegen function will convert this .td file into .inc files, which will be the #include declarative in our .cpp files and refer to registers.
We have defined our toy target machine to have four registers (r0-r3), a stack register (sp), and a link register (lr). These can be specified in the TOYRegisterInfo.td file. The tablegen function provides the Register class, which can be extended to specify the registers.
To define the backend architecture using target descriptor files, proceed with the following steps.
lib/Target named TOY:
$ mkdir llvm_root_directory/lib/Target/TOY
Read now
Unlock full access