Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 1 | //===-- 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 Dunbar | 0b0441e | 2009-07-18 23:03:22 +0000 | [diff] [blame] | 10 | #include "PPC.h" |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 11 | #include "llvm/Module.h" |
| 12 | #include "llvm/Target/TargetRegistry.h" |
| 13 | using namespace llvm; |
| 14 | |
Daniel Dunbar | 0b0441e | 2009-07-18 23:03:22 +0000 | [diff] [blame] | 15 | Target llvm::ThePPC32Target; |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 16 | |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 17 | static 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 Dunbar | 0b0441e | 2009-07-18 23:03:22 +0000 | [diff] [blame] | 25 | Target llvm::ThePPC64Target; |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 26 | |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 27 | static 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 Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 35 | extern "C" void LLVMInitializePowerPCTargetInfo() { |
| 36 | TargetRegistry::RegisterTarget(ThePPC32Target, "ppc32", |
| 37 | "PowerPC 32", |
| 38 | &PPC32_TripleMatchQuality, |
Daniel Dunbar | 123157a | 2009-07-25 10:09:50 +0000 | [diff] [blame] | 39 | /*HasJIT=*/true); |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 40 | |
| 41 | TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64", |
| 42 | "PowerPC 64", |
| 43 | &PPC64_TripleMatchQuality, |
Daniel Dunbar | 123157a | 2009-07-25 10:09:50 +0000 | [diff] [blame] | 44 | /*HasJIT=*/true); |
Daniel Dunbar | 0eb6699 | 2009-07-15 06:35:19 +0000 | [diff] [blame] | 45 | } |