ENGLISH

LLVM Techniques, Tips, and Best Practices: Clang and Middle-End Libraries

Book information

Publisher
Packt Publishing
Year
2021
ISBN
9781838824952
Language
english
Format
PDF
Filesize
18 MB (19337923 bytes)
Pages
\370
Time added
2021-04-26 09:13:06

Description

Cover Title page Copyright and Credits Dedication Contributors Table of Contents Preface Section 1: Build System and LLVM-Specific Tooling Chapter 1: Saving Resources When Building LLVM Technical requirements Cutting down building resources with better tooling Replacing GNU Make with Ninja Avoiding the use of the BFD linker Tweaking CMake arguments Choosing the right build type Avoiding building all targets Building as shared libraries Splitting the debug info Building an optimized version of llvm-tblgen Using the new PassManager and Clang Using GN for a faster turnaround time Summary Further reading Chapter 2: Exploring LLVM's Build System Features Technical requirements Exploring a glossary of LLVM's important CMake directives Using the CMake function to add new libraries Using the CMake function to add executables and tools Using the CMake function to add Pass plugins Understanding CMake integration for out-of-tree projects Summary Chapter 3: Testing with LLVM LIT Technical requirements Using LIT in out-of-tree projects Preparing for our example project Writing LIT configurations LIT internals Learning useful FileCheck tricks Preparing for our example project Writing FileCheck directives Exploring the TestSuite framework Preparing for our example project Importing code into llvm-test-suite Summary Further reading Chapter 4: TableGen Development Technical requirements Introduction to TableGen syntax Layout and records Bang operators Multiclass The DAG data type Writing a donut recipe in TableGen Printing a recipe via the TableGen backend TableGen's high-level workflow Writing the TableGen backend Integrating the RecipePrinter TableGen backend Summary Further reading Section 2: Frontend Development Chapter 5: Exploring Clang's Architecture Technical requirements Learning Clang's subsystems and their roles Driver LLVM, assemblers, and linkers Exploring Clang's tooling features and extension options The FrontendAction class Clang plugins LibTooling and Clang Tools Summary Further reading Chapter 6: Extending the Preprocessor Technical requirements Working with SourceLocation and SourceManager Introducing SourceLocation Introducing SourceManager Learning preprocessor and lexer essentials Understanding the role of the preprocessor and lexer in Clang Understanding Token Handling macros Developing custom preprocessor plugins and callbacks The project goal and preparation Implementing a custom pragma handler Implementing custom preprocessor callbacks Summary Exercises Chapter 7: Handling AST Technical requirements Learning about AST in Clang In-memory structure of Clang AST Types in Clang AST ASTMatcher Writing AST plugins Project overview Printing diagnostic messages Creating the AST plugin Summary Chapter 8: Working with Compiler Flags and Toolchains Technical requirements Understanding drivers and toolchains in Clang Adding custom driver flags Project overview Declaring custom driver flags Translating custom driver flags Passing flags to the frontend Adding a custom toolchain Project overview Creating the toolchain and adding a custom include path Creating a custom assembling stage Creating a custom linking stage Verifying the custom toolchain Summary Exercises Section 3: "Middle-End" Development Chapter 9: Working with PassManager and AnalysisManager Technical requirements Writing an LLVM Pass for the new PassManager Project overview Writing the StrictOpt Pass Working with the new AnalysisManager Overview of the project Writing the HaltAnalyzer Pass Learning instrumentations in the new PassManager Printing Pass pipeline details Printing changes to the IR after each Pass Bisecting the Pass pipeline Summary Questions Chapter 10: Processing LLVM IR Technical requirements Learning LLVM IR basics Iterating different IR units Iterating instructions Iterating basic blocks Iterating the call graph Learning about GraphTraits Working with values and instructions Understanding SSA Working with values Working with instructions Working with loops Learning about loop representation in LLVM Learning about loop infrastructure in LLVM Summary Chapter 11: Gearing Up with Support Utilities Technical requirements Printing diagnostic messages Collecting statistics Using the Statistic class Using an optimization remark Adding time measurements Using the Timer class Collecting the time trace Error-handling utilities in LLVM Introducing the Error class Learning about the Expected and ErrorOr classes The Expected class The ErrorOr class Summary Chapter 12: Learning LLVM IR Instrumentation Technical requirements Developing a sanitizer An example of using an address sanitizer Creating a loop counter sanitizer Working with PGO Introduction to instrumentation-based PGO Introduction to sampling-based PGO Using profiling data analyses Summary Assessments About Packt Other Books You May Enjoy Index

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF