summaryrefslogtreecommitdiff
path: root/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp
blob: ce664e1b38433a1caf9ae4c2b8bc6c3223780a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===-- XCoreTargetInfo.cpp - XCore Target Implementation -----------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;

Target TheXCoreTarget;

static unsigned XCore_JITMatchQuality() {
  return 0;
}

static unsigned XCore_TripleMatchQuality(const std::string &TT) {
  if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "xcore-")
    return 20;

  return 0;
}

static unsigned XCore_ModuleMatchQuality(const Module &M) {
  // Check for a triple match.
  if (unsigned Q = XCore_TripleMatchQuality(M.getTargetTriple()))
    return Q;

  // Otherwise we don't match.
  return 0;
}

extern "C" void LLVMInitializeXCoreTargetInfo() { 
  TargetRegistry::RegisterTarget(TheXCoreTarget, "xcore",
                                  "XCore",
                                  &XCore_TripleMatchQuality,
                                  &XCore_ModuleMatchQuality,
                                  &XCore_JITMatchQuality);
}