OSDN Git Service

Kill Target specific ModuleMatchQuality stuff.
[android-x86/external-llvm.git] / lib / Target / Mips / TargetInfo / MipsTargetInfo.cpp
1 //===-- MipsTargetInfo.cpp - Mips Target Implementation -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "Mips.h"
11 #include "llvm/Module.h"
12 #include "llvm/Target/TargetRegistry.h"
13 using namespace llvm;
14
15 Target llvm::TheMipsTarget;
16
17 static unsigned Mips_TripleMatchQuality(const std::string &TT) {
18   // We strongly match "mips*-*".
19   if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-")
20     return 20;
21   
22   if (TT.size() >= 13 && std::string(TT.begin(), 
23       TT.begin()+13) == "mipsallegrex-")
24     return 20;
25
26   return 0;
27 }
28
29 Target llvm::TheMipselTarget;
30
31 static unsigned Mipsel_TripleMatchQuality(const std::string &TT) {
32   // We strongly match "mips*el-*".
33   if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-")
34     return 20;
35
36   if (TT.size() >= 15 && std::string(TT.begin(), 
37       TT.begin()+15) == "mipsallegrexel-")
38     return 20;
39
40   if (TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "psp")
41     return 20;
42
43   return 0;
44 }
45
46 extern "C" void LLVMInitializeMipsTargetInfo() { 
47   TargetRegistry::RegisterTarget(TheMipsTarget, "mips",
48                                   "Mips",
49                                   &Mips_TripleMatchQuality);
50
51   TargetRegistry::RegisterTarget(TheMipselTarget, "mipsel",
52                                   "Mipsel",
53                                   &Mipsel_TripleMatchQuality);
54 }