logo资料库

LLVM.Essentials.pdf

第1页 / 共178页
第2页 / 共178页
第3页 / 共178页
第4页 / 共178页
第5页 / 共178页
第6页 / 共178页
第7页 / 共178页
第8页 / 共178页
资料共178页,剩余部分请下载后查看
Cover
Table Of Contents
Copyright
Credits
About the Authors
About the Reviewer
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Quetions
Chapter 1. Playing with LLVM
Modular design and collection of libraries
Getting familiar with LLVM IR
LLVM tools and using in the command line
Summary
Chapter 2. Building LLVM IR
2.1 Creating an LLVM module
2.2 Emitting a function in a module
2.3 Adding a block to a function
2.4 Emitting a global variable
2.5 Emitting a return statement
2.6 Emitting function arguments
2.7 Emitting a simple arithmetic statement in a basic block
2.8 Emitting if-else codition IR
2.9 Emitting LLVM IR for loop
2.10 Summary
Chapter 3. Advanced LLVM IR
3.1 Memory access operations
3.2 Getting the address of an element
3.3 Reading from the memory
3.4 Writting into a memory location
3.5 Inserting a scalar into a vector
3.6 Extracting a scalar from a vector
3.7 Summary
Chapter 4. Basic IR Transformations
4.1 Opt Tool
4.2 Pass and Pass Manager
4.3 Using other Pass into in current Pass
4.4 AnalysisUsage::addRequired<> method
4.5 AnalysisUsage::addRequiredTransitive<> method
4.6 AnalysisUsage::addPreserved<> method
4.7 Instruction simplification example
4.8 Instruction Combining
4.9 Summary
Chapter 5. Advanced IR Block Transformations
5.1 Loop processing
5.2 Scalar evolution
5.3 LLVM intrinsics
5.4 Vectorization
5.5 Summary
Chapter 6. IR to Selection DAG phase
6.1 Converting IR to selectionDAG
6.2 Legalizing SelectionDAG
6.3 Optimizing SelectionDAG
6.4 Instruction Selection
6.5 Scheduling and emitting machine instructions
6.6 Register allocation
6.7 Code Emission
6.8 Summary
Chapter 7. Generating Code for Target Architecture
7.1 Sample backend
7.2 Defining registers and register sets
7.3 Defining the calling convertion
7.4 Defining the instruction set
7.5 Implementing frame lowering
7.6 Lowering instructions
7.7 Printing an instruction
7.8 Summary
Index
A
B
C
E
F
G
I
L
M
N
O
P
R
S
T
V
1
LLVM Essentials 2
LLVM Essentials Credits About the Authors About the Reviewer www.PacktPub.com Support files, eBooks, discount offers, and more Why subscribe? Free access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. Playing with LLVM Modular design and collection of libraries Getting familiar with LLVM IR LLVM tools and using them in the command line Summary 2. Building LLVM IR Creating an LLVM module Emitting a function in a module Adding a block to a function Emitting a global variable 3
Emitting a return statement Emitting function arguments Emitting a simple arithmetic statement in a basic block Emitting if-else condition IR Emitting LLVM IR for loop Summary 3. Advanced LLVM IR Memory access operations Getting the address of an element Reading from the memory Writing into a memory location Inserting a scalar into a vector Extracting a scalar from a vector Summary 4. Basic IR Transformations Opt Tool Pass and Pass Manager Using other Pass info in current Pass AnalysisUsage::addRequired<> method AnalysisUsage:addRequiredTransitive<> method AnalysisUsage::addPreserved<> method Instruction simplification example Instruction Combining Summary 5. Advanced IR Block Transformations Loop processing Scalar evolution LLVM intrinsics Vectorization Summary 6. IR to Selection DAG phase 4
Converting IR to selectionDAG Legalizing SelectionDAG Optimizing SelectionDAG Instruction Selection Scheduling and emitting machine instructions Register allocation Code Emission Summary 7. Generating Code for Target Architecture Sample backend Defining registers and register sets Defining the calling convention Defining the instruction set Implementing frame lowering Lowering instructions Printing an instruction Summary Index 5
Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: December 2015 Production reference: 1021215 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78528-080-1 www.packtpub.com 6
Authors Suyog Sarda Mayur Pandey Reviewer Renato Golin Commissioning Editor Nadeem Bagban Acquisition Editor Harsha Bharwani Content Development Editor Priyanka Mehta Technical Editor Ryan Kochery Copy Editor Imon Biswas Project Coordinator Izzat Contractor Proofreader Safis Editing Indexer Tejal Daruwale Soni Production Coordinator Aparna Bhagat Cover Work Aparna Bhagat 7
About the Authors Suyog Sarda is a professional software engineer and an open source enthusiast. He focuses on compiler development and compiler tools. He is an active contributor to the LLVM open source community. Suyog was also involved in code performance improvements for the ARM and X86 architectures. He has been a part of the compiler team for the Tizen project. His interest in compiler development lies more in code optimization and vectorization. Previously, he has authored a book on LLVM, titled LLVM Cookbook by Packt Publishing. Apart from compilers, Suyog is also interested in Linux Kernel Development. He has published a technical paper titled Secure Co-resident Virtualization in Multicore Systems by VM Pinning and Page Coloring at the IEEE Proceedings of the 2012 International Conference on Cloud Computing, Technologies, Applications, and Management at the Birla Institute of Technology, Dubai. He has earned a bachelor’s degree in computer technology from the College of Engineering, Pune, India. I would like to thank my family and friends for encouraging me to write this book. I am thankful to my co-author and reviewers who did a tremendous job of refining the contents. I would also like to thank the LLVM open source community for always being helpful. It has been a great experience to interact with the community. It is amazing to see how fast LLVM has evolved. Mayur Pandey is a professional software engineer and open source enthusiast focused on compiler development and tools. He is an active contributor to the LLVM open source community. He has been a part of the compiler team for the Tizen project and has hands- on experience of other proprietary compilers. He has earned a bachelor’s degree in Information Technology from Motilal Nehru National Institute of Technology, Allahabad, India. Currently, he lives in Bengaluru, India. I would like to thank my family and friends who made it possible for me to complete the book by taking care of my other commitments, and who have always being encouraging. 8
分享到:
收藏