[lld][LayoutPass] initialize the number of entries for the densehash (no functionality change)

llvm-svn: 180690
This commit is contained in:
Shankar Easwaran 2013-04-29 03:27:57 +00:00
parent 83e2a44a13
commit 45a5f93517
1 changed files with 23 additions and 18 deletions

View File

@ -135,10 +135,16 @@ bool LayoutPass::CompareAtoms::operator()(const DefinedAtom *left,
/// targetAtoms and its tree to the current chain
void LayoutPass::buildFollowOnTable(MutableFile::DefinedAtomRange &range) {
ScopedTask task(getDefaultDomain(), "LayoutPass::buildFollowOnTable");
// Set the initial size of the followon and
// the followonNext hash to the number of atoms
// that we have
_followOnRoots.resize(range.size());
_followOnNexts.resize(range.size());
for (auto ai : range) {
for (const Reference *r : *ai) {
if (r->kind() == lld::Reference::kindLayoutAfter) {
const DefinedAtom *targetAtom = llvm::dyn_cast<DefinedAtom>(r->target());
const DefinedAtom *targetAtom =
llvm::dyn_cast<DefinedAtom>(r->target());
_followOnNexts[ai] = targetAtom;
// If we find a followon for the first time, lets make that
// atom as the root atom
@ -468,5 +474,4 @@ void LayoutPass::perform(MutableFile &mergedFile) {
}
});
}