[lld] r182792 - [Passes] Parallelize the layout pass sort.
Michael J. Spencer
bigcheesegs at gmail.com
Tue May 28 12:03:29 PDT 2013
Author: mspencer
Date: Tue May 28 14:03:29 2013
New Revision: 182792
URL: http://llvm.org/viewvc/llvm-project?rev=182792&view=rev
Log:
[Passes] Parallelize the layout pass sort.
Modified:
lld/trunk/include/lld/Passes/LayoutPass.h
lld/trunk/lib/Passes/LayoutPass.cpp
Modified: lld/trunk/include/lld/Passes/LayoutPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Passes/LayoutPass.h?rev=182792&r1=182791&r2=182792&view=diff
==============================================================================
--- lld/trunk/include/lld/Passes/LayoutPass.h (original)
+++ lld/trunk/include/lld/Passes/LayoutPass.h Tue May 28 14:03:29 2013
@@ -37,7 +37,7 @@ public:
class CompareAtoms {
public:
explicit CompareAtoms(const LayoutPass &pass) : _layout(pass) {}
- bool operator()(const DefinedAtom *left, const DefinedAtom *right);
+ bool operator()(const DefinedAtom *left, const DefinedAtom *right) const;
private:
const LayoutPass &_layout;
};
Modified: lld/trunk/lib/Passes/LayoutPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/LayoutPass.cpp?rev=182792&r1=182791&r2=182792&view=diff
==============================================================================
--- lld/trunk/lib/Passes/LayoutPass.cpp (original)
+++ lld/trunk/lib/Passes/LayoutPass.cpp Tue May 28 14:03:29 2013
@@ -12,6 +12,7 @@
#include "lld/Passes/LayoutPass.h"
#include "lld/Core/Instrumentation.h"
+#include "lld/Core/Parallel.h"
#include "llvm/Support/Debug.h"
using namespace lld;
@@ -24,7 +25,7 @@ using namespace lld;
/// e) Sorts atoms on how they appear using File Ordinality
/// f) Sorts atoms on how they appear within the File
bool LayoutPass::CompareAtoms::operator()(const DefinedAtom *left,
- const DefinedAtom *right) {
+ const DefinedAtom *right) const {
DEBUG(llvm::dbgs() << "Sorting " << left->name() << " " << right->name() << "\n");
if (left == right)
return false;
@@ -425,7 +426,7 @@ void LayoutPass::perform(MutableFile &me
});
// sort the atoms
- std::sort(atomRange.begin(), atomRange.end(), _compareAtoms);
+ parallel_sort(atomRange.begin(), atomRange.end(), _compareAtoms);
DEBUG({
llvm::dbgs() << "sorted atoms:\n";
More information about the llvm-commits
mailing list