1 //===------ Core/Pass.h - Base class for linker passes ----------*- C++ -*-===//
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_H
11 #define LLD_CORE_PASS_H
13 #include "llvm/Support/Error.h"
19 /// Once the core linking is done (which resolves references, coalesces atoms
20 /// and produces a complete Atom graph), the linker runs a series of passes
21 /// on the Atom graph. The graph is modeled as a File, which means the pass
22 /// has access to all the atoms and to File level attributes. Each pass does
23 /// a particular transformation to the Atom graph or to the File attributes.
25 /// This is the abstract base class for all passes. A Pass does its
26 /// actual work in it perform() method. It can iterator over Atoms in the
27 /// graph using the *begin()/*end() atom iterator of the File. It can add
28 /// new Atoms to the graph using the File's addAtom() method.
31 virtual ~Pass() = default;
33 /// Do the actual work of the Pass.
34 virtual llvm::Error perform(SimpleFile &mergedFile) = 0;
37 // Only subclassess can be instantiated.
41 } // end namespace lld
43 #endif // LLD_CORE_PASS_H