diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-26 05:03:33 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-26 05:03:33 +0000 |
commit | 8977d087c693fd581db82bcff134d12da0f48bd3 (patch) | |
tree | 658de5d523595bb7928de54e705d38109d63e53b /lib/Target/Mips/TargetInfo | |
parent | 8c2f1d7e44d214bc2242a8c6faa4b624b3876540 (diff) | |
download | external_llvm-8977d087c693fd581db82bcff134d12da0f48bd3.zip external_llvm-8977d087c693fd581db82bcff134d12da0f48bd3.tar.gz external_llvm-8977d087c693fd581db82bcff134d12da0f48bd3.tar.bz2 |
Factor commonality in triple match routines into helper template for registering
classes, and migrate existing targets over.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/TargetInfo')
-rw-r--r-- | lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp b/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp index 4f07545..cc3d61e 100644 --- a/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp +++ b/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp @@ -12,43 +12,10 @@ #include "llvm/Target/TargetRegistry.h" using namespace llvm; -Target llvm::TheMipsTarget; - -static unsigned Mips_TripleMatchQuality(const std::string &TT) { - // We strongly match "mips*-*". - if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-") - return 20; - - if (TT.size() >= 13 && std::string(TT.begin(), - TT.begin()+13) == "mipsallegrex-") - return 20; - - return 0; -} - -Target llvm::TheMipselTarget; - -static unsigned Mipsel_TripleMatchQuality(const std::string &TT) { - // We strongly match "mips*el-*". - if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-") - return 20; - - if (TT.size() >= 15 && std::string(TT.begin(), - TT.begin()+15) == "mipsallegrexel-") - return 20; - - if (TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "psp") - return 20; - - return 0; -} +Target llvm::TheMipsTarget, llvm::TheMipselTarget; extern "C" void LLVMInitializeMipsTargetInfo() { - TargetRegistry::RegisterTarget(TheMipsTarget, "mips", - "Mips", - &Mips_TripleMatchQuality); + RegisterTarget<Triple::mips> X(TheMipsTarget, "mips", "Mips"); - TargetRegistry::RegisterTarget(TheMipselTarget, "mipsel", - "Mipsel", - &Mipsel_TripleMatchQuality); + RegisterTarget<Triple::mipsel> Y(TheMipselTarget, "mipsel", "Mipsel"); } |