blob: 0bdf8823be8981a0931894f2b4fb59cf9cc5ce18 [file] [log] [blame]
Daniel Dunbar0eb66992009-07-15 06:35:19 +00001//===-- MSP430TargetInfo.cpp - MSP430 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 "llvm/Module.h"
11#include "llvm/Target/TargetRegistry.h"
12using namespace llvm;
13
14Target TheMSP430Target;
15
16static unsigned MSP430_JITMatchQuality() {
17 return 0;
18}
19
20static unsigned MSP430_TripleMatchQuality(const std::string &TT) {
21 // We strongly match msp430
22 if (TT.size() >= 6 && TT[0] == 'm' && TT[1] == 's' && TT[2] == 'p' &&
23 TT[3] == '4' && TT[4] == '3' && TT[5] == '0')
24 return 20;
25
26 return 0;
27}
28
29static unsigned MSP430_ModuleMatchQuality(const Module &M) {
30 // Check for a triple match.
31 if (unsigned Q = MSP430_TripleMatchQuality(M.getTargetTriple()))
32 return Q;
33
34 // Otherwise if the target triple is non-empty, we don't match.
35 if (!M.getTargetTriple().empty()) return 0;
36
37 return 0;
38}
39
40extern "C" void LLVMInitializeMSP430TargetInfo() {
41 TargetRegistry::RegisterTarget(TheMSP430Target, "msp430",
42 "MSP430 [experimental]",
43 &MSP430_TripleMatchQuality,
44 &MSP430_ModuleMatchQuality,
45 &MSP430_JITMatchQuality);
46}