Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
LLVM Essentials

You're reading from   LLVM Essentials Become familiar with the LLVM infrastructure and start using LLVM libraries to design a compiler

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785280801
Length 166 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Suyog Sarda Suyog Sarda
Author Profile Icon Suyog Sarda
Suyog Sarda
Mayur Pandey Mayur Pandey
Author Profile Icon Mayur Pandey
Mayur Pandey
David Farago David Farago
Author Profile Icon David Farago
David Farago
John Criswell John Criswell
Author Profile Icon John Criswell
John Criswell
Arrow right icon
View More author details
Toc

Sample backend


To understand target code generation, we define a simple RISC-type architecture TOY machine with minimal registers, say r0-r3, a stack pointer SP, a link register, LR (for storing the return address); and a CPSR – current state program register. The calling convention of this toy backend is similar to the ARM thumb-like architecture—arguments passed to the function will be stored in register sets r0-r1, and the return value will be stored in r0.

Defining registers and register sets

Register sets are defined using the tablegen tool. Tablegen helps to maintain large number of records of domain specific information. It factors out the common features of these records. This helps in reducing duplication in the description and forms a structural way of representing domain information. Please visit http://llvm.org/docs/TableGen/ to understand tablegen in detail. TableGen files are interpreted by the TableGen binary: llvm-tblgen.

We have described our sample backend in the preceding...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime