llvm.org GIT mirror llvm / c984df8
Add TargetInfo libraries for all targets. - Intended to match current TargetMachine implementations. - No facilities for linking these in yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75751 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 11 years ago
56 changed file(s) with 1173 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1717 ARMGenDAGISel.inc ARMGenSubtarget.inc \
1818 ARMGenCodeEmitter.inc ARMGenCallingConv.inc
1919
20 DIRS = AsmPrinter
20 DIRS = AsmPrinter TargetInfo
2121
2222 include $(LEVEL)/Makefile.common
0 //===-- ARMTargetInfo.cpp - ARM Target Implementation ---------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheARMTarget;
14
15 static unsigned ARM_JITMatchQuality() {
16 #if defined(__arm__)
17 return 10;
18 #endif
19 return 0;
20 }
21
22 static unsigned ARM_TripleMatchQuality(const std::string &TT) {
23 // Match arm-foo-bar, as well as things like armv5blah-*
24 if (TT.size() >= 4 &&
25 (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv"))
26 return 20;
27
28 return 0;
29 }
30
31 static unsigned ARM_ModuleMatchQuality(const Module &M) {
32 // Check for a triple match.
33 if (unsigned Q = ARM_TripleMatchQuality(M.getTargetTriple()))
34 return Q;
35
36 // Otherwise if the target triple is non-empty, we don't match.
37 if (!M.getTargetTriple().empty()) return 0;
38
39 if (M.getEndianness() == Module::LittleEndian &&
40 M.getPointerSize() == Module::Pointer32)
41 return 10; // Weak match
42 else if (M.getEndianness() != Module::AnyEndianness ||
43 M.getPointerSize() != Module::AnyPointerSize)
44 return 0; // Match for some other target
45
46 return ARM_JITMatchQuality()/2;
47 }
48
49 Target TheThumbTarget;
50
51 static unsigned Thumb_JITMatchQuality() {
52 #if defined(__thumb__)
53 return 10;
54 #endif
55 return 0;
56 }
57
58 static unsigned Thumb_TripleMatchQuality(const std::string &TT) {
59 // Match thumb-foo-bar, as well as things like thumbv5blah-*
60 if (TT.size() >= 6 &&
61 (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv"))
62 return 20;
63
64 return 0;
65 }
66
67 static unsigned Thumb_ModuleMatchQuality(const Module &M) {
68 // Check for a triple match.
69 if (unsigned Q = Thumb_TripleMatchQuality(M.getTargetTriple()))
70 return Q;
71
72 // Otherwise if the target triple is non-empty, we don't match.
73 if (!M.getTargetTriple().empty()) return 0;
74
75 if (M.getEndianness() == Module::LittleEndian &&
76 M.getPointerSize() == Module::Pointer32)
77 return 10; // Weak match
78 else if (M.getEndianness() != Module::AnyEndianness ||
79 M.getPointerSize() != Module::AnyPointerSize)
80 return 0; // Match for some other target
81
82 return Thumb_JITMatchQuality()/2;
83 }
84
85 extern "C" void LLVMInitializeARMTargetInfo() {
86 TargetRegistry::RegisterTarget(TheARMTarget, "arm",
87 "ARM",
88 &ARM_TripleMatchQuality,
89 &ARM_ModuleMatchQuality,
90 &ARM_JITMatchQuality);
91
92 TargetRegistry::RegisterTarget(TheThumbTarget, "thumb",
93 "Thumb",
94 &Thumb_TripleMatchQuality,
95 &Thumb_ModuleMatchQuality,
96 &Thumb_JITMatchQuality);
97 }
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMARMInfo
3 ARMTargetInfo.cpp
4 )
5
0 ##===- lib/Target/ARM/TargetInfo/Makefile ------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMARMInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
1616 AlphaGenAsmWriter.inc AlphaGenDAGISel.inc \
1717 AlphaGenSubtarget.inc
1818
19 DIRS = AsmPrinter
19 DIRS = AsmPrinter TargetInfo
2020
2121 include $(LEVEL)/Makefile.common
0 //===-- AlphaTargetInfo.cpp - Alpha Target Implementation -----------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheAlphaTarget;
14
15 static unsigned Alpha_JITMatchQuality() {
16 #ifdef __alpha
17 return 10;
18 #else
19 return 0;
20 #endif
21 }
22
23 static unsigned Alpha_TripleMatchQuality(const std::string &TT) {
24 // We strongly match "alpha*".
25 if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' &&
26 TT[3] == 'h' && TT[4] == 'a')
27 return 20;
28
29 return 0;
30 }
31
32 static unsigned Alpha_ModuleMatchQuality(const Module &M) {
33 // Check for a triple match.
34 if (unsigned Q = Alpha_TripleMatchQuality(M.getTargetTriple()))
35 return Q;
36
37 // Otherwise if the target triple is non-empty, we don't match.
38 if (!M.getTargetTriple().empty()) return 0;
39
40 if (M.getEndianness() == Module::LittleEndian &&
41 M.getPointerSize() == Module::Pointer64)
42 return 10; // Weak match
43 else if (M.getEndianness() != Module::AnyEndianness ||
44 M.getPointerSize() != Module::AnyPointerSize)
45 return 0; // Match for some other target
46
47 return Alpha_JITMatchQuality()/2;
48 }
49
50 extern "C" void LLVMInitializeAlphaTargetInfo() {
51 TargetRegistry::RegisterTarget(TheAlphaTarget, "alpha",
52 "Alpha [experimental]",
53 &Alpha_TripleMatchQuality,
54 &Alpha_ModuleMatchQuality,
55 &Alpha_JITMatchQuality);
56 }
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMAlphaInfo
3 AlphaTargetInfo.cpp
4 )
5
0 #===- lib/Target/Alpha/TargetInfo/Makefile -----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMAlphaInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
88
99 LEVEL = ../../..
1010 LIBRARYNAME = LLVMCBackend
11
12 DIRS = TargetInfo
13
1114 include $(LEVEL)/Makefile.common
1215
1316 CompileCommonOpts += -Wno-format
0 //===-- CBackendTargetInfo.cpp - CBackend Target Implementation -----------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheCBackendTarget;
14
15 static unsigned CBackend_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned CBackend_TripleMatchQuality(const std::string &TT) {
20 // This class always works, but must be requested explicitly on
21 // llc command line.
22 return 0;
23 }
24
25 static unsigned CBackend_ModuleMatchQuality(const Module &M) {
26 // This class always works, but must be requested explicitly on
27 // llc command line.
28 return 0;
29 }
30
31 extern "C" void LLVMInitializeCBackendTargetInfo() {
32 TargetRegistry::RegisterTarget(TheCBackendTarget, "c",
33 "C backend",
34 &CBackend_TripleMatchQuality,
35 &CBackend_ModuleMatchQuality,
36 &CBackend_JITMatchQuality);
37 }
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMCBackendInfo
3 CBackendTargetInfo.cpp
4 )
5
0 ##===- lib/Target/CBackend/TargetInfo/Makefile -------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMCBackendInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
1616 SPUGenInstrInfo.inc SPUGenDAGISel.inc \
1717 SPUGenSubtarget.inc SPUGenCallingConv.inc
1818
19 DIRS = AsmPrinter
19 DIRS = AsmPrinter TargetInfo
2020
2121 include $(LEVEL)/Makefile.common
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMCellSPUInfo
3 CellSPUTargetInfo.cpp
4 )
5
0 //===-- CellSPUTargetInfo.cpp - CellSPU Target Implementation -------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheCellSPUTarget;
14
15 static unsigned CellSPU_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned CellSPU_TripleMatchQuality(const std::string &TT) {
20 // We strongly match "spu-*" or "cellspu-*".
21 if ((TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "spu") ||
22 (TT.size() == 7 && std::string(TT.begin(), TT.begin()+7) == "cellspu") ||
23 (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "spu-") ||
24 (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "cellspu-"))
25 return 20;
26
27 return 0;
28 }
29
30 static unsigned CellSPU_ModuleMatchQuality(const Module &M) {
31 // Check for a triple match.
32 if (unsigned Q = CellSPU_TripleMatchQuality(M.getTargetTriple()))
33 return Q;
34
35 // Otherwise if the target triple is non-empty, we don't match.
36 if (!M.getTargetTriple().empty()) return 0;
37
38 return 0;
39 }
40
41 extern "C" void LLVMInitializeCellSPUTargetInfo() {
42 TargetRegistry::RegisterTarget(TheCellSPUTarget, "cellspu",
43 "STI CBEA Cell SPU [experimental]",
44 &CellSPU_TripleMatchQuality,
45 &CellSPU_ModuleMatchQuality,
46 &CellSPU_JITMatchQuality);
47 }
0 ##===- lib/Target/CellSPU/TargetInfo/Makefile --------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMCellSPUInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
88
99 LEVEL = ../../..
1010 LIBRARYNAME = LLVMCppBackend
11
12 DIRS = TargetInfo
13
1114 include $(LEVEL)/Makefile.common
1215
1316 CompileCommonOpts += -Wno-format
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMCppBackendInfo
3 CppBackendTargetInfo.cpp
4 )
5
0 //===-- CppBackendTargetInfo.cpp - CppBackend Target Implementation -------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheCppBackendTarget;
14
15 static unsigned CppBackend_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned CppBackend_TripleMatchQuality(const std::string &TT) {
20 // This class always works, but shouldn't be the default in most cases.
21 return 1;
22 }
23
24 static unsigned CppBackend_ModuleMatchQuality(const Module &M) {
25 // This class always works, but shouldn't be the default in most cases.
26 return 1;
27 }
28
29 extern "C" void LLVMInitializeCppBackendTargetInfo() {
30 TargetRegistry::RegisterTarget(TheCppBackendTarget, "cpp",
31 "C++ backend",
32 &CppBackend_TripleMatchQuality,
33 &CppBackend_ModuleMatchQuality,
34 &CppBackend_JITMatchQuality);
35 }
0 ##===- lib/Target/CppBackend/TargetInfo/Makefile -----------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMCppBackendInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
1313 IA64GenInstrInfo.inc IA64GenAsmWriter.inc \
1414 IA64GenDAGISel.inc
1515
16 DIRS = AsmPrinter
16 DIRS = AsmPrinter TargetInfo
1717
1818 include $(LEVEL)/Makefile.common
1919
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMIA64Info
3 IA64TargetInfo.cpp
4 )
5
0 //===-- IA64TargetInfo.cpp - IA64 Target Implementation -------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheIA64Target;
14
15 static unsigned IA64_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned IA64_TripleMatchQuality(const std::string &TT) {
20 // we match [iI][aA]*64
21 if (TT.size() >= 4) {
22 if ((TT[0]=='i' || TT[0]=='I') &&
23 (TT[1]=='a' || TT[1]=='A')) {
24 for(unsigned int i=2; i<(TT.size()-1); i++)
25 if(TT[i]=='6' && TT[i+1]=='4')
26 return 20; // strong match
27 }
28 }
29
30 return 0;
31 }
32
33 static unsigned IA64_ModuleMatchQuality(const Module &M) {
34 // Check for a triple match.
35 if (unsigned Q = IA64_TripleMatchQuality(M.getTargetTriple()))
36 return Q;
37
38 // Otherwise if the target triple is non-empty, we don't match.
39 if (!M.getTargetTriple().empty()) return 0;
40
41 // FIXME: This is bad, the target matching algorithm shouldn't depend on the
42 // host.
43 #if defined(__ia64__) || defined(__IA64__)
44 return 5;
45 #else
46 return 0;
47 #endif
48 }
49
50 extern "C" void LLVMInitializeIA64TargetInfo() {
51 TargetRegistry::RegisterTarget(TheIA64Target, "ia64",
52 "IA-64 (Itanium) [experimental]",
53 &IA64_TripleMatchQuality,
54 &IA64_ModuleMatchQuality,
55 &IA64_JITMatchQuality);
56 }
0 ##===- lib/Target/IA64/TargetInfo/Makefile -----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMIA64Info
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
88
99 LEVEL = ../../..
1010 LIBRARYNAME = LLVMMSIL
11
12 DIRS = TargetInfo
13
1114 include $(LEVEL)/Makefile.common
1215
1316 CompileCommonOpts := $(CompileCommonOpts) -Wno-format
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMMSILInfo
3 MSILTargetInfo.cpp
4 )
5
0 //===-- MSILTargetInfo.cpp - MSIL Target Implementation -------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheMSILTarget;
14
15 static unsigned MSIL_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned MSIL_TripleMatchQuality(const std::string &TT) {
20 // This class always works, but shouldn't be the default in most cases.
21 return 1;
22 }
23
24 static unsigned MSIL_ModuleMatchQuality(const Module &M) {
25 // This class always works, but shouldn't be the default in most cases.
26 return 1;
27 }
28
29 extern "C" void LLVMInitializeMSILTargetInfo() {
30 TargetRegistry::RegisterTarget(TheMSILTarget, "msil",
31 "MSIL backend",
32 &MSIL_TripleMatchQuality,
33 &MSIL_ModuleMatchQuality,
34 &MSIL_JITMatchQuality);
35 }
0 ##===- lib/Target/MSIL/TargetInfo/Makefile -----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMMSILInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
1616 MSP430GenDAGISel.inc MSP430GenCallingConv.inc \
1717 MSP430GenSubtarget.inc
1818
19 DIRS = TargetInfo
20
1921 include $(LEVEL)/Makefile.common
2022
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMMSP430Info
3 MSP430TargetInfo.cpp
4 )
5
0 //===-- MSP430TargetInfo.cpp - MSP430 Target Implementation ---------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheMSP430Target;
14
15 static unsigned MSP430_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned MSP430_TripleMatchQuality(const std::string &TT) {
20 // We strongly match msp430
21 if (TT.size() >= 6 && TT[0] == 'm' && TT[1] == 's' && TT[2] == 'p' &&
22 TT[3] == '4' && TT[4] == '3' && TT[5] == '0')
23 return 20;
24
25 return 0;
26 }
27
28 static unsigned MSP430_ModuleMatchQuality(const Module &M) {
29 // Check for a triple match.
30 if (unsigned Q = MSP430_TripleMatchQuality(M.getTargetTriple()))
31 return Q;
32
33 // Otherwise if the target triple is non-empty, we don't match.
34 if (!M.getTargetTriple().empty()) return 0;
35
36 return 0;
37 }
38
39 extern "C" void LLVMInitializeMSP430TargetInfo() {
40 TargetRegistry::RegisterTarget(TheMSP430Target, "msp430",
41 "MSP430 [experimental]",
42 &MSP430_TripleMatchQuality,
43 &MSP430_ModuleMatchQuality,
44 &MSP430_JITMatchQuality);
45 }
0 ##===- lib/Target/MSP430/TargetInfo/Makefile ---------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMMSP430Info
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
1616 MipsGenDAGISel.inc MipsGenCallingConv.inc \
1717 MipsGenSubtarget.inc
1818
19 DIRS = AsmPrinter
19 DIRS = AsmPrinter TargetInfo
2020
2121 include $(LEVEL)/Makefile.common
2222
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMMipsInfo
3 MipsTargetInfo.cpp
4 )
5
0 ##===- lib/Target/Mips/TargetInfo/Makefile -----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMMipsInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- MipsTargetInfo.cpp - Mips Target Implementation -------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheMipsTarget;
14
15 static unsigned Mips_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned Mips_TripleMatchQuality(const std::string &TT) {
20 // We strongly match "mips*-*".
21 if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-")
22 return 20;
23
24 if (TT.size() >= 13 && std::string(TT.begin(),
25 TT.begin()+13) == "mipsallegrex-")
26 return 20;
27
28 return 0;
29 }
30
31 static unsigned Mips_ModuleMatchQuality(const Module &M) {
32 // Check for a triple match.
33 if (unsigned Q = Mips_TripleMatchQuality(M.getTargetTriple()))
34 return Q;
35
36 // Otherwise if the target triple is non-empty, we don't match.
37 if (!M.getTargetTriple().empty()) return 0;
38
39 return 0;
40 }
41
42 Target TheMipselTarget;
43
44 static unsigned Mipsel_JITMatchQuality() {
45 return 0;
46 }
47
48 static unsigned Mipsel_TripleMatchQuality(const std::string &TT) {
49 // We strongly match "mips*el-*".
50 if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-")
51 return 20;
52
53 if (TT.size() >= 15 && std::string(TT.begin(),
54 TT.begin()+15) == "mipsallegrexel-")
55 return 20;
56
57 if (TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "psp")
58 return 20;
59
60 return 0;
61 }
62
63 static unsigned Mipsel_ModuleMatchQuality(const Module &M) {
64 // Check for a triple match.
65 if (unsigned Q = Mipsel_TripleMatchQuality(M.getTargetTriple()))
66 return Q;
67
68 // Otherwise if the target triple is non-empty, we don't match.
69 if (!M.getTargetTriple().empty()) return 0;
70
71 return 0;
72 }
73
74 extern "C" void LLVMInitializeMipsTargetInfo() {
75 TargetRegistry::RegisterTarget(TheMipsTarget, "mips",
76 "Mips",
77 &Mips_TripleMatchQuality,
78 &Mips_ModuleMatchQuality,
79 &Mips_JITMatchQuality);
80
81 TargetRegistry::RegisterTarget(TheMipselTarget, "mipsel",
82 "Mipsel",
83 &Mipsel_TripleMatchQuality,
84 &Mipsel_ModuleMatchQuality,
85 &Mipsel_JITMatchQuality);
86 }
1616 PIC16GenDAGISel.inc PIC16GenCallingConv.inc \
1717 PIC16GenSubtarget.inc
1818
19 DIRS = TargetInfo
20
1921 include $(LEVEL)/Makefile.common
2022
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMPIC16Info
3 PIC16TargetInfo.cpp
4 )
5
0 ##===- lib/Target/PIC16/TargetInfo/Makefile ----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMPIC16Info
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- PIC16TargetInfo.cpp - PIC16 Target Implementation -----------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target ThePIC16Target;
14
15 static unsigned PIC16_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned PIC16_TripleMatchQuality(const std::string &TT) {
20 return 0;
21 }
22
23 static unsigned PIC16_ModuleMatchQuality(const Module &M) {
24 return 0;
25 }
26
27 Target TheCooperTarget;
28
29 static unsigned Cooper_JITMatchQuality() {
30 return 0;
31 }
32
33 static unsigned Cooper_TripleMatchQuality(const std::string &TT) {
34 return 0;
35 }
36
37 static unsigned Cooper_ModuleMatchQuality(const Module &M) {
38 return 0;
39 }
40
41 extern "C" void LLVMInitializePIC16TargetInfo() {
42 TargetRegistry::RegisterTarget(ThePIC16Target, "pic16",
43 "PIC16 14-bit [experimental]",
44 &PIC16_TripleMatchQuality,
45 &PIC16_ModuleMatchQuality,
46 &PIC16_JITMatchQuality);
47
48 TargetRegistry::RegisterTarget(TheCooperTarget, "cooper",
49 "PIC16 Cooper [experimental]",
50 &Cooper_TripleMatchQuality,
51 &Cooper_ModuleMatchQuality,
52 &Cooper_JITMatchQuality);
53 }
1616 PPCGenInstrInfo.inc PPCGenDAGISel.inc \
1717 PPCGenSubtarget.inc PPCGenCallingConv.inc
1818
19 DIRS = AsmPrinter
19 DIRS = AsmPrinter TargetInfo
2020
2121 include $(LEVEL)/Makefile.common
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMPowerPCInfo
3 PowerPCTargetInfo.cpp
4 )
5
0 ##===- lib/Target/PowerPC/TargetInfo/Makefile ------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMPowerPCInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- PowerPCTargetInfo.cpp - PowerPC Target Implementation -------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target ThePPC32Target;
14
15 static unsigned PPC32_JITMatchQuality() {
16 #if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
17 if (sizeof(void*) == 4)
18 return 10;
19 #endif
20 return 0;
21 }
22
23 static unsigned PPC32_TripleMatchQuality(const std::string &TT) {
24 // We strongly match "powerpc-*".
25 if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-")
26 return 20;
27
28 return 0;
29 }
30
31 static unsigned PPC32_ModuleMatchQuality(const Module &M) {
32 // Check for a triple match.
33 if (unsigned Q = PPC32_TripleMatchQuality(M.getTargetTriple()))
34 return Q;
35
36 // Otherwise if the target triple is non-empty, we don't match.
37 if (!M.getTargetTriple().empty()) return 0;
38
39 if (M.getEndianness() == Module::BigEndian &&
40 M.getPointerSize() == Module::Pointer64)
41 return 10; // Weak match
42 else if (M.getEndianness() != Module::AnyEndianness ||
43 M.getPointerSize() != Module::AnyPointerSize)
44 return 0; // Match for some other target
45
46 return PPC32_JITMatchQuality()/2;
47 }
48
49 Target ThePPC64Target;
50
51 static unsigned PPC64_JITMatchQuality() {
52 #if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
53 if (sizeof(void*) == 8)
54 return 10;
55 #endif
56 return 0;
57 }
58
59 static unsigned PPC64_TripleMatchQuality(const std::string &TT) {
60 // We strongly match "powerpc64-*".
61 if (TT.size() >= 10 && std::string(TT.begin(), TT.begin()+10) == "powerpc64-")
62 return 20;
63
64 return 0;
65 }
66
67 static unsigned PPC64_ModuleMatchQuality(const Module &M) {
68 // Check for a triple match.
69 if (unsigned Q = PPC64_TripleMatchQuality(M.getTargetTriple()))
70 return Q;
71
72 // Otherwise if the target triple is non-empty, we don't match.
73 if (!M.getTargetTriple().empty()) return 0;
74
75 if (M.getEndianness() == Module::BigEndian &&
76 M.getPointerSize() == Module::Pointer64)
77 return 10; // Weak match
78 else if (M.getEndianness() != Module::AnyEndianness ||
79 M.getPointerSize() != Module::AnyPointerSize)
80 return 0; // Match for some other target
81
82 return PPC64_JITMatchQuality()/2;
83 }
84
85 extern "C" void LLVMInitializePowerPCTargetInfo() {
86 TargetRegistry::RegisterTarget(ThePPC32Target, "ppc32",
87 "PowerPC 32",
88 &PPC32_TripleMatchQuality,
89 &PPC32_ModuleMatchQuality,
90 &PPC32_JITMatchQuality);
91
92 TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64",
93 "PowerPC 64",
94 &PPC64_TripleMatchQuality,
95 &PPC64_ModuleMatchQuality,
96 &PPC64_JITMatchQuality);
97 }
1515 SparcGenInstrInfo.inc SparcGenAsmWriter.inc \
1616 SparcGenDAGISel.inc SparcGenSubtarget.inc SparcGenCallingConv.inc
1717
18 DIRS = AsmPrinter
18 DIRS = AsmPrinter TargetInfo
1919
2020 include $(LEVEL)/Makefile.common
2121
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMSparcInfo
3 SparcTargetInfo.cpp
4 )
5
0 ##===- lib/Target/Sparc/TargetInfo/Makefile ----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMSparcInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- SparcTargetInfo.cpp - Sparc Target Implementation -----------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheSparcTarget;
14
15 static unsigned Sparc_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned Sparc_TripleMatchQuality(const std::string &TT) {
20 if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "sparc-")
21 return 20;
22
23 return 0;
24 }
25
26 static unsigned Sparc_ModuleMatchQuality(const Module &M) {
27 // Check for a triple match.
28 if (unsigned Q = Sparc_TripleMatchQuality(M.getTargetTriple()))
29 return Q;
30
31 // Otherwise if the target triple is non-empty, we don't match.
32 if (!M.getTargetTriple().empty()) return 0;
33
34 // FIXME: This is bad, the target matching algorithm shouldn't depend on the
35 // host.
36 if (M.getEndianness() == Module::BigEndian &&
37 M.getPointerSize() == Module::Pointer32)
38 #ifdef __sparc__
39 return 20; // BE/32 ==> Prefer sparc on sparc
40 #else
41 return 5; // BE/32 ==> Prefer ppc elsewhere
42 #endif
43 else if (M.getEndianness() != Module::AnyEndianness ||
44 M.getPointerSize() != Module::AnyPointerSize)
45 return 0; // Match for some other target
46
47 #if defined(__sparc__)
48 return 10;
49 #else
50 return 0;
51 #endif
52 }
53
54 extern "C" void LLVMInitializeSparcTargetInfo() {
55 TargetRegistry::RegisterTarget(TheSparcTarget, "sparc",
56 "Sparc",
57 &Sparc_TripleMatchQuality,
58 &Sparc_ModuleMatchQuality,
59 &Sparc_JITMatchQuality);
60 }
1717 X86GenFastISel.inc \
1818 X86GenCallingConv.inc X86GenSubtarget.inc
1919
20 DIRS = AsmPrinter
20 DIRS = AsmPrinter TargetInfo
2121
2222 include $(LEVEL)/Makefile.common
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMX86Info
3 X86TargetInfo.cpp
4 )
5
0 ##===- lib/Target/X86/TargetInfo/Makefile ------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMX86Info
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- X86TargetInfo.cpp - X86 Target Implementation ---------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheX86_32Target;
14
15 static unsigned X86_32_JITMatchQuality() {
16 #if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
17 return 10;
18 #endif
19 return 0;
20 }
21
22 static unsigned X86_32_TripleMatchQuality(const std::string &TT) {
23 // We strongly match "i[3-9]86-*".
24 if (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' &&
25 TT[4] == '-' && TT[1] - '3' < 6)
26 return 20;
27
28 return 0;
29 }
30
31 static unsigned X86_32_ModuleMatchQuality(const Module &M) {
32 // Check for a triple match.
33 if (unsigned Q = X86_32_TripleMatchQuality(M.getTargetTriple()))
34 return Q;
35
36 // If the target triple is something non-X86, we don't match.
37 if (!M.getTargetTriple().empty()) return 0;
38
39 if (M.getEndianness() == Module::LittleEndian &&
40 M.getPointerSize() == Module::Pointer32)
41 return 10; // Weak match
42 else if (M.getEndianness() != Module::AnyEndianness ||
43 M.getPointerSize() != Module::AnyPointerSize)
44 return 0; // Match for some other target
45
46 return X86_32_JITMatchQuality()/2;
47 }
48
49 Target TheX86_64Target;
50
51 static unsigned X86_64_JITMatchQuality() {
52 #if defined(__x86_64__) || defined(_M_AMD64)
53 return 10;
54 #endif
55 return 0;
56 }
57
58 static unsigned X86_64_TripleMatchQuality(const std::string &TT) {
59 // We strongly match "x86_64-*".
60 if (TT.size() >= 7 && TT[0] == 'x' && TT[1] == '8' && TT[2] == '6' &&
61 TT[3] == '_' && TT[4] == '6' && TT[5] == '4' && TT[6] == '-')
62 return 20;
63
64 return 0;
65 }
66
67 static unsigned X86_64_ModuleMatchQuality(const Module &M) {
68 // Check for a triple match.
69 if (unsigned Q = X86_64_TripleMatchQuality(M.getTargetTriple()))
70 return Q;
71
72 // If the target triple is something non-X86-64, we don't match.
73 if (!M.getTargetTriple().empty()) return 0;
74
75 if (M.getEndianness() == Module::LittleEndian &&
76 M.getPointerSize() == Module::Pointer64)
77 return 10; // Weak match
78 else if (M.getEndianness() != Module::AnyEndianness ||
79 M.getPointerSize() != Module::AnyPointerSize)
80 return 0; // Match for some other target
81
82 return X86_64_JITMatchQuality()/2;
83 }
84
85 extern "C" void LLVMInitializeX86TargetInfo() {
86 TargetRegistry::RegisterTarget(TheX86_32Target, "x86",
87 "32-bit X86: Pentium-Pro and above",
88 &X86_32_TripleMatchQuality,
89 &X86_32_ModuleMatchQuality,
90 &X86_32_JITMatchQuality);
91
92 TargetRegistry::RegisterTarget(TheX86_64Target, "x86-64",
93 "64-bit X86: EM64T and AMD64",
94 &X86_64_TripleMatchQuality,
95 &X86_64_ModuleMatchQuality,
96 &X86_64_JITMatchQuality);
97 }
1616 XCoreGenDAGISel.inc XCoreGenCallingConv.inc \
1717 XCoreGenSubtarget.inc
1818
19 DIRS = TargetInfo
20
1921 include $(LEVEL)/Makefile.common
2022
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMXCoreInfo
3 XCoreTargetInfo.cpp
4 )
5
0 ##===- lib/Target/XCore/TargetInfo/Makefile ----------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8 LEVEL = ../../../..
9 LIBRARYNAME = LLVMXCoreInfo
10
11 # Hack: we need to include 'main' target directory to grab private headers
12 CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
13
14 include $(LEVEL)/Makefile.common
0 //===-- XCoreTargetInfo.cpp - XCore Target Implementation -----------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Module.h"
10 #include "llvm/Target/TargetRegistry.h"
11 using namespace llvm;
12
13 Target TheXCoreTarget;
14
15 static unsigned XCore_JITMatchQuality() {
16 return 0;
17 }
18
19 static unsigned XCore_TripleMatchQuality(const std::string &TT) {
20 if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "xcore-")
21 return 20;
22
23 return 0;
24 }
25
26 static unsigned XCore_ModuleMatchQuality(const Module &M) {
27 // Check for a triple match.
28 if (unsigned Q = XCore_TripleMatchQuality(M.getTargetTriple()))
29 return Q;
30
31 // Otherwise we don't match.
32 return 0;
33 }
34
35 extern "C" void LLVMInitializeXCoreTargetInfo() {
36 TargetRegistry::RegisterTarget(TheXCoreTarget, "xcore",
37 "XCore",
38 &XCore_TripleMatchQuality,
39 &XCore_ModuleMatchQuality,
40 &XCore_JITMatchQuality);
41 }