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