blob: 7fc73c139a12575bd09707a8e8d5678e2dbd7d23 [file] [log] [blame]
Daniel Dunbar0eb66992009-07-15 06:35:19 +00001//===-- PowerPCTargetInfo.cpp - PowerPC 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
Daniel Dunbar0b0441e2009-07-18 23:03:22 +000010#include "PPC.h"
Daniel Dunbar0eb66992009-07-15 06:35:19 +000011#include "llvm/Module.h"
12#include "llvm/Target/TargetRegistry.h"
13using namespace llvm;
14
Daniel Dunbar0b0441e2009-07-18 23:03:22 +000015Target llvm::ThePPC32Target;
Daniel Dunbar0eb66992009-07-15 06:35:19 +000016
Daniel Dunbar0eb66992009-07-15 06:35:19 +000017static unsigned PPC32_TripleMatchQuality(const std::string &TT) {
18 // We strongly match "powerpc-*".
19 if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-")
20 return 20;
21
22 return 0;
23}
24
Daniel Dunbar0b0441e2009-07-18 23:03:22 +000025Target llvm::ThePPC64Target;
Daniel Dunbar0eb66992009-07-15 06:35:19 +000026
Daniel Dunbar0eb66992009-07-15 06:35:19 +000027static unsigned PPC64_TripleMatchQuality(const std::string &TT) {
28 // We strongly match "powerpc64-*".
29 if (TT.size() >= 10 && std::string(TT.begin(), TT.begin()+10) == "powerpc64-")
30 return 20;
31
32 return 0;
33}
34
Daniel Dunbar0eb66992009-07-15 06:35:19 +000035extern "C" void LLVMInitializePowerPCTargetInfo() {
36 TargetRegistry::RegisterTarget(ThePPC32Target, "ppc32",
37 "PowerPC 32",
38 &PPC32_TripleMatchQuality,
Daniel Dunbar123157a2009-07-25 10:09:50 +000039 /*HasJIT=*/true);
Daniel Dunbar0eb66992009-07-15 06:35:19 +000040
41 TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64",
42 "PowerPC 64",
43 &PPC64_TripleMatchQuality,
Daniel Dunbar123157a2009-07-25 10:09:50 +000044 /*HasJIT=*/true);
Daniel Dunbar0eb66992009-07-15 06:35:19 +000045}