1 //===-- 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" 12 using namespace llvm; 13 14 Target TheSystemZTarget; 15 16 static unsigned SystemZ_JITMatchQuality() { 17 return 0; 18 } 19 20 static 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 29 static 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 38 extern "C" void LLVMInitializeSystemZTargetInfo() { 39 TargetRegistry::RegisterTarget(TheSystemZTarget, "systemz", 40 "SystemZ", 41 &SystemZ_TripleMatchQuality, 42 &SystemZ_ModuleMatchQuality, 43 &SystemZ_JITMatchQuality); 44 } 45