Provide a fast "get me the target triple from the module" API. This can

drastically reduce the linking time during LTO.

Patch by Shantonu Sen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling committed 2010-10-06 01:22:42 +00:00
1 parent 417b54354b
commit 34711747a1
4 files changed
+142 -10

No files matched your search

+4 -9
View File
@@ -64,15 +64,10 @@ bool LTOModule::isBitcodeFileForTarget(const char *path,
// Takes ownership of buffer.
bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
OwningPtr<Module> m(getLazyBitcodeModule(buffer, getGlobalContext()));
// On success, m owns buffer and both are deleted at end of this method.
if (!m) {
delete buffer;
return false;
}
std::string actualTarget = m->getTargetTriple();
return (strncmp(actualTarget.c_str(), triplePrefix,
strlen(triplePrefix)) == 0);
std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
delete buffer;
return (strncmp(Triple.c_str(), triplePrefix,
strlen(triplePrefix)) == 0);
}