mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Minor speedup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
#include "Support/Debug.h"
|
#include "Support/Debug.h"
|
||||||
#include "Support/FileUtilities.h"
|
#include "Support/FileUtilities.h"
|
||||||
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@@ -183,7 +184,9 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M,
|
|||||||
I->setInitializer(0); // Delete the initializer to make it external
|
I->setInitializer(0); // Delete the initializer to make it external
|
||||||
|
|
||||||
// Remove the Test functions from the Safe module
|
// Remove the Test functions from the Safe module
|
||||||
|
std::set<std::pair<std::string, const PointerType*> > TestFunctions;
|
||||||
for (unsigned i = 0, e = F.size(); i != e; ++i) {
|
for (unsigned i = 0, e = F.size(); i != e; ++i) {
|
||||||
|
TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType()));
|
||||||
Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType());
|
Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType());
|
||||||
DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n");
|
DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n");
|
||||||
assert(TNOF && "Function doesn't exist in module!");
|
assert(TNOF && "Function doesn't exist in module!");
|
||||||
@@ -191,16 +194,8 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the Safe functions from the Test module
|
// Remove the Safe functions from the Test module
|
||||||
for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I) {
|
for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I)
|
||||||
bool funcFound = false;
|
if (!TestFunctions.count(std::make_pair(I->getName(), I->getType())))
|
||||||
for (std::vector<Function*>::const_iterator FI = F.begin(), Fe = F.end();
|
|
||||||
FI != Fe; ++FI)
|
|
||||||
if (I->getName() == (*FI)->getName() &&
|
|
||||||
I->getType() == (*FI)->getType())
|
|
||||||
funcFound = true;
|
|
||||||
|
|
||||||
if (!funcFound)
|
|
||||||
DeleteFunctionBody(I);
|
DeleteFunctionBody(I);
|
||||||
}
|
|
||||||
return New;
|
return New;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user