Introducing the LLVM Pass manager
The LLVM core libraries optimize the IR your compiler creates and turn it into object code. This giant task is broken down into separate steps, called Passes. These Passes need to be executed in the right order, which is the objective of the Pass manager.
But why not hardcode the order of the Passes? Well, the user of your compiler usually expects that your compiler provides a different level of optimization. Developers prefer a faster compilation speed over-optimization during development time. The final application should run as fast as possible, and your compiler should be able to perform sophisticated optimizations, with longer compilation times accepted. A different level of optimization means a different number of optimization Passes that need to be executed. And, as a compiler writer, you might want to provide your own Passes to take advantage of your knowledge of the source language. For example, you might want to replace well-known library...