forked from OSchip/llvm-project
[Passes] Parallelize the layout pass sort.
llvm-svn: 182792
This commit is contained in:
parent
b5b5453e61
commit
0d9d3110c7
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue