mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-14 15:25:25 +00:00
speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab. This speeds up gccld -native on an almost empty .o file from 1.63s to 0.18s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23406 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -504,13 +504,9 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool Archive::isBytecodeArchive() {
|
||||||
Archive::isBytecodeArchive()
|
// Make sure the symTab has been loaded. In most cases this should have been
|
||||||
{
|
// done when the archive was constructed, but still, this is just in case.
|
||||||
//Make sure the symTab has been loaded...
|
|
||||||
//in most cases this should have been done
|
|
||||||
//when the archive was constructed, but still,
|
|
||||||
//this is just in case.
|
|
||||||
if (!symTab.size())
|
if (!symTab.size())
|
||||||
loadSymbolTable();
|
loadSymbolTable();
|
||||||
|
|
||||||
@@ -524,11 +520,21 @@ Archive::isBytecodeArchive()
|
|||||||
std::vector<Module *> Modules;
|
std::vector<Module *> Modules;
|
||||||
std::string ErrorMessage;
|
std::string ErrorMessage;
|
||||||
|
|
||||||
//If getAllModules gives an error then this isn't a proper
|
// Scan the archive, trying to load a bytecode member. We only load one to
|
||||||
//bytecode archive
|
// see if this works.
|
||||||
if ( getAllModules( Modules, &ErrorMessage ) ) return false;
|
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||||
|
if (!I->isBytecode() && !I->isCompressedBytecode())
|
||||||
|
continue;
|
||||||
|
|
||||||
//Finally, if we find any bytecode modules then this is a proper
|
std::string FullMemberName =
|
||||||
//bytecode archive
|
archPath.toString() + "(" + I->getPath().toString() + ")";
|
||||||
return Modules.size();
|
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
|
||||||
|
I->getSize(), FullMemberName);
|
||||||
|
if (!M)
|
||||||
|
return false; // Couldn't parse bytecode, not a bytecode archive.
|
||||||
|
delete M;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -504,13 +504,9 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool Archive::isBytecodeArchive() {
|
||||||
Archive::isBytecodeArchive()
|
// Make sure the symTab has been loaded. In most cases this should have been
|
||||||
{
|
// done when the archive was constructed, but still, this is just in case.
|
||||||
//Make sure the symTab has been loaded...
|
|
||||||
//in most cases this should have been done
|
|
||||||
//when the archive was constructed, but still,
|
|
||||||
//this is just in case.
|
|
||||||
if (!symTab.size())
|
if (!symTab.size())
|
||||||
loadSymbolTable();
|
loadSymbolTable();
|
||||||
|
|
||||||
@@ -524,11 +520,21 @@ Archive::isBytecodeArchive()
|
|||||||
std::vector<Module *> Modules;
|
std::vector<Module *> Modules;
|
||||||
std::string ErrorMessage;
|
std::string ErrorMessage;
|
||||||
|
|
||||||
//If getAllModules gives an error then this isn't a proper
|
// Scan the archive, trying to load a bytecode member. We only load one to
|
||||||
//bytecode archive
|
// see if this works.
|
||||||
if ( getAllModules( Modules, &ErrorMessage ) ) return false;
|
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||||
|
if (!I->isBytecode() && !I->isCompressedBytecode())
|
||||||
|
continue;
|
||||||
|
|
||||||
//Finally, if we find any bytecode modules then this is a proper
|
std::string FullMemberName =
|
||||||
//bytecode archive
|
archPath.toString() + "(" + I->getPath().toString() + ")";
|
||||||
return Modules.size();
|
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
|
||||||
|
I->getSize(), FullMemberName);
|
||||||
|
if (!M)
|
||||||
|
return false; // Couldn't parse bytecode, not a bytecode archive.
|
||||||
|
delete M;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user