1 //===-- XCoreTargetInfo.cpp - XCore 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 "XCore.h"
11 #include "llvm/Module.h"
12 #include "llvm/Target/TargetRegistry.h"
13 using namespace llvm;
14 
15 Target llvm::TheXCoreTarget;
16 
17 static unsigned XCore_JITMatchQuality() {
18   return 0;
19 }
20 
21 static unsigned XCore_TripleMatchQuality(const std::string &TT) {
22   if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "xcore-")
23     return 20;
24 
25   return 0;
26 }
27 
28 static unsigned XCore_ModuleMatchQuality(const Module &M) {
29   // Check for a triple match.
30   if (unsigned Q = XCore_TripleMatchQuality(M.getTargetTriple()))
31     return Q;
32 
33   // Otherwise we don't match.
34   return 0;
35 }
36 
37 extern "C" void LLVMInitializeXCoreTargetInfo() {
38   TargetRegistry::RegisterTarget(TheXCoreTarget, "xcore",
39                                   "XCore",
40                                   &XCore_TripleMatchQuality,
41                                   &XCore_ModuleMatchQuality,
42                                   &XCore_JITMatchQuality);
43 }
44