[Passes] Parallelize the layout pass sort.

llvm-svn: 182792
This commit is contained in:
Michael J. Spencer 2013-05-28 19:03:29 +00:00
parent b5b5453e61
commit 0d9d3110c7
2 changed files with 4 additions and 3 deletions

View File

@ -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;
};

View File

@ -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 &mergedFile) {
});
// sort the atoms
std::sort(atomRange.begin(), atomRange.end(), _compareAtoms);
parallel_sort(atomRange.begin(), atomRange.end(), _compareAtoms);
DEBUG({
llvm::dbgs() << "sorted atoms:\n";