summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
blob: 7fc73c139a12575bd09707a8e8d5678e2dbd7d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//===-- PowerPCTargetInfo.cpp - PowerPC Target Implementation -------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "PPC.h"
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;

Target llvm::ThePPC32Target;

static unsigned PPC32_TripleMatchQuality(const std::string &TT) {
  // We strongly match "powerpc-*".
  if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-")
    return 20;

  return 0;
}

Target llvm::ThePPC64Target;

static unsigned PPC64_TripleMatchQuality(const std::string &TT) {
  // We strongly match "powerpc64-*".
  if (TT.size() >= 10 && std::string(TT.begin(), TT.begin()+10) == "powerpc64-")
    return 20;

  return 0;
}

extern "C" void LLVMInitializePowerPCTargetInfo() { 
  TargetRegistry::RegisterTarget(ThePPC32Target, "ppc32",
                                  "PowerPC 32",
                                  &PPC32_TripleMatchQuality,
                                 /*HasJIT=*/true);

  TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64",
                                  "PowerPC 64",
                                  &PPC64_TripleMatchQuality,
                                 /*HasJIT=*/true);
}