mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Clear the stub map in getSortedStubs.
This makes sure they are only output once (and frees a bit of memory). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -91,7 +91,10 @@ public:
|
|||||||
virtual ~MachineModuleInfoImpl();
|
virtual ~MachineModuleInfoImpl();
|
||||||
typedef std::vector<std::pair<MCSymbol*, StubValueTy> > SymbolListTy;
|
typedef std::vector<std::pair<MCSymbol*, StubValueTy> > SymbolListTy;
|
||||||
protected:
|
protected:
|
||||||
static SymbolListTy GetSortedStubs(const DenseMap<MCSymbol*, StubValueTy>&);
|
|
||||||
|
/// Return the entries from a DenseMap in a deterministic sorted orer.
|
||||||
|
/// Clears the map.
|
||||||
|
static SymbolListTy getSortedStubs(DenseMap<MCSymbol*, StubValueTy>&);
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@@ -58,14 +58,14 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Accessor methods to return the set of stubs in sorted order.
|
/// Accessor methods to return the set of stubs in sorted order.
|
||||||
SymbolListTy GetFnStubList() const {
|
SymbolListTy GetFnStubList() {
|
||||||
return GetSortedStubs(FnStubs);
|
return getSortedStubs(FnStubs);
|
||||||
}
|
}
|
||||||
SymbolListTy GetGVStubList() const {
|
SymbolListTy GetGVStubList() {
|
||||||
return GetSortedStubs(GVStubs);
|
return getSortedStubs(GVStubs);
|
||||||
}
|
}
|
||||||
SymbolListTy GetHiddenGVStubList() const {
|
SymbolListTy GetHiddenGVStubList() {
|
||||||
return GetSortedStubs(HiddenGVStubs);
|
return getSortedStubs(HiddenGVStubs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,8 +87,8 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Accessor methods to return the set of stubs in sorted order.
|
/// Accessor methods to return the set of stubs in sorted order.
|
||||||
|
|
||||||
SymbolListTy GetGVStubList() const {
|
SymbolListTy GetGVStubList() {
|
||||||
return GetSortedStubs(GVStubs);
|
return getSortedStubs(GVStubs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,15 +31,14 @@ static int SortSymbolPair(const void *LHS, const void *RHS) {
|
|||||||
return LHSS->getName().compare(RHSS->getName());
|
return LHSS->getName().compare(RHSS->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GetSortedStubs - Return the entries from a DenseMap in a deterministic
|
MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
|
||||||
/// sorted orer.
|
DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
|
||||||
MachineModuleInfoImpl::SymbolListTy
|
|
||||||
MachineModuleInfoImpl::GetSortedStubs(const DenseMap<MCSymbol*,
|
|
||||||
MachineModuleInfoImpl::StubValueTy>&Map) {
|
|
||||||
MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
|
MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
|
||||||
|
|
||||||
if (!List.empty())
|
if (!List.empty())
|
||||||
qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
|
qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
|
||||||
|
|
||||||
|
Map.clear();
|
||||||
return List;
|
return List;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user