forked from OSchip/llvm-project
The various "getModuleMatchQuality" implementations should return
zero if they see a target triple they don't understand. llvm-svn: 38463
This commit is contained in:
parent
6fec9a91b7
commit
517290ae52
|
@ -48,6 +48,9 @@ unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "thumb-")
|
||||
return 20;
|
||||
|
||||
// If the target triple is something non-thumb, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::LittleEndian &&
|
||||
M.getPointerSize() == Module::Pointer32)
|
||||
return 10; // Weak match
|
||||
|
@ -94,6 +97,8 @@ unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
std::string TT = M.getTargetTriple();
|
||||
if (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "arm-")
|
||||
return 20;
|
||||
// If the target triple is something non-arm, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::LittleEndian &&
|
||||
M.getPointerSize() == Module::Pointer32)
|
||||
|
|
|
@ -35,6 +35,8 @@ unsigned AlphaTargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' &&
|
||||
TT[3] == 'h' && TT[4] == 'a')
|
||||
return 20;
|
||||
// If the target triple is something non-alpha, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::LittleEndian &&
|
||||
M.getPointerSize() == Module::Pointer64)
|
||||
|
|
|
@ -50,6 +50,8 @@ unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
if (seenIA64)
|
||||
return 20; // strong match
|
||||
}
|
||||
// If the target triple is something non-ia64, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
#if defined(__ia64__) || defined(__IA64__)
|
||||
return 5;
|
||||
|
|
|
@ -40,13 +40,14 @@ MipsTargetMachine(const Module &M, const std::string &FS):
|
|||
|
||||
// return 0 and must specify -march to gen MIPS code.
|
||||
unsigned MipsTargetMachine::
|
||||
getModuleMatchQuality(const Module &M)
|
||||
{
|
||||
getModuleMatchQuality(const Module &M) {
|
||||
// We strongly match "mips-*".
|
||||
std::string TT = M.getTargetTriple();
|
||||
if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-")
|
||||
return 20;
|
||||
|
||||
// If the target triple is something non-mips, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ unsigned PPC32TargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-")
|
||||
return 20;
|
||||
|
||||
// If the target triple is something non-powerpc, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::BigEndian &&
|
||||
M.getPointerSize() == Module::Pointer32)
|
||||
return 10; // Weak match
|
||||
|
|
|
@ -39,6 +39,9 @@ unsigned SparcTargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
std::string TT = M.getTargetTriple();
|
||||
if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "sparc-")
|
||||
return 20;
|
||||
|
||||
// If the target triple is something non-sparc, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::BigEndian &&
|
||||
M.getPointerSize() == Module::Pointer32)
|
||||
|
|
|
@ -62,6 +62,8 @@ unsigned X86_32TargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
if (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' &&
|
||||
TT[4] == '-' && TT[1] - '3' < 6)
|
||||
return 20;
|
||||
// If the target triple is something non-X86, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::LittleEndian &&
|
||||
M.getPointerSize() == Module::Pointer32)
|
||||
|
@ -85,6 +87,9 @@ unsigned X86_64TargetMachine::getModuleMatchQuality(const Module &M) {
|
|||
TT[3] == '6' && TT[4] == '4' && TT[5] == '-')
|
||||
return 20;
|
||||
|
||||
// If the target triple is something non-X86-64, we don't match.
|
||||
if (!TT.empty()) return 0;
|
||||
|
||||
if (M.getEndianness() == Module::LittleEndian &&
|
||||
M.getPointerSize() == Module::Pointer64)
|
||||
return 10; // Weak match
|
||||
|
|
Loading…
Reference in New Issue