1 //===- lld/Core/PassManager.h - Manage linker passes ----------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_CORE_PASS_MANAGER_H
11 #define LLD_CORE_PASS_MANAGER_H
13 #include "lld/Core/LLVM.h"
14 #include "lld/Core/Pass.h"
15 #include "llvm/Support/Error.h"
23 /// \brief Owns and runs a collection of passes.
25 /// This class is currently just a container for passes and a way to run them.
27 /// In the future this should handle timing pass runs, running parallel passes,
28 /// and validate/satisfy pass dependencies.
31 void add(std::unique_ptr<Pass> pass) {
32 _passes.push_back(std::move(pass));
35 llvm::Error runOnFile(SimpleFile &file) {
36 for (std::unique_ptr<Pass> &pass : _passes)
37 if (llvm::Error EC = pass->perform(file))
43 /// \brief Passes in the order they should run.
44 std::vector<std::unique_ptr<Pass>> _passes;
46 } // end namespace lld