In this recipe, you will learn how to eliminate dead code from the program. By dead code elimination, we mean removing the code that has no effect whatsoever on the results that the source program outputs on executing. The main reasons to do so are reduction of the program size, which makes the code quality good and makes it easier to debug the code later on; and improving the run time of the program, as the unnecessary code is prevented from being executed. In this recipe, we will show you a variant of dead code elimination, called aggressive dead code elimination, that assumes every piece of code to be dead until proven otherwise. We will see how to implement this pass ourselves, and what modifications we need to make so that the pass can run just like other passes in the lib/Transforms/Scalar
folder of the LLVM trunk.
LLVM Cookbook
LLVM Cookbook
Overview of this book
Table of Contents (16 chapters)
LLVM Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
LLVM Design and Use
Steps in Writing a Frontend
Extending the Frontend and Adding JIT Support
Preparing Optimizations
Implementing Optimizations
Target-independent Code Generator
Optimizing the Machine Code
Writing an LLVM Backend
Using LLVM for Various Useful Projects
Index
Customer Reviews