A practical guide to building LLVM backend from scratch to unleash the power of next-generation processors and accelerator chips
Key FeaturesBeginner-friendly content to create an LLVM backend from scratchProject-driven approach with step-by-step instructionsTargeting OpenRISC – a famous real-world instruction set architectureBook DescriptionWith the advancement of chip manufacturing technology and the ever-growing demands of high-performance AI / ML engines, we have seen an explosive number of ASIC – Application Specific IC – chips showing up on the market to accelerate this technology breakthrough. These new hardwares often have their own Instruction Set Architecture (ISA) that requires completely new compilers to support the software running atop. LLVM, being one of the most popular compiler frameworks, provides tools that make a perfect fit for such needs. And this book serves as a guide to the most essential task of creating LLVM-based compilers for new chips – engineering the compiler backend, which is the foundation of turning any application code into machine-executable instructions.
Readers will learn how to create an LLVM backend for new hardware architectures from scratch. The book will show them how to create a compiler toolchain that turns high-level source code all the way into low-level binary machine code.
By the end of this book, readers are expected to be able to create an LLVM-based compiler toolchain for new hardware architectures.
What you will learnDevelop robust skills to build an LLVM backend from scratchCreate assemblers and disassemblers using LLVM’s infrastructureOptimize software for specific hardware in a compilerBuild a solid knowledge of common compiler backend workflowsUnderstand low-level system programming like ABI and calling conventionDevelop capabilities to interpret ISA datasheets and implement them in the compilerWho This Book Is ForDevelopers with decent C++ programming experiences should find no problem picking up this title. Basic compiler knowledge is something nice to have, but not required to read this book.
Table of ContentsCompilers and LLVM Backend EssentialsExploring Instruction Set Architecture & OpenRISCBootstrapping the ORB LLVM BackendGenerating Assembly Code for a Toy ProgramAdding Instruction DefinitionsLowering Complex Instructions and Function Call FrameAdding Sub-target Features and Custom PassesConnecting ORB with ClangAdding Assembly ParserCreating Assembler and DisassemblerWorking with Object Files