blob: c464039aaca7efc2b0af28331265dc9279fed431 [file] [log] [blame]
Anton Korobeynikov147a9a72009-07-16 14:36:52 +00001//===-- SystemZTargetInfo.cpp - SystemZ 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 TheSystemZTarget;
15
16static unsigned SystemZ_JITMatchQuality() {
17 return 0;
18}
19
20static unsigned SystemZ_TripleMatchQuality(const std::string &TT) {
21 // We strongly match s390x
22 if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
23 TT[3] == '0' && TT[4] == 'x')
24 return 20;
25
26 return 0;
27}
28
29static unsigned SystemZ_ModuleMatchQuality(const Module &M) {
30 // Check for a triple match.
31 if (unsigned Q = SystemZ_TripleMatchQuality(M.getTargetTriple()))
32 return Q;
33
34 // Otherwise we don't match.
35 return 0;
36}
37
38extern "C" void LLVMInitializeSystemZTargetInfo() {
39 TargetRegistry::RegisterTarget(TheSystemZTarget, "systemz",
40 "SystemZ",
41 &SystemZ_TripleMatchQuality,
42 &SystemZ_ModuleMatchQuality,
43 &SystemZ_JITMatchQuality);
44}