Add TargetInfo libraries for all targets.

- Intended to match current TargetMachine implementations.

 - No facilities for linking these in yet.

llvm-svn: 75751
This commit is contained in:
Daniel Dunbar 2009-07-15 06:35:19 +00:00
parent a5da8d25b7
commit 56e2947a33
56 changed files with 1173 additions and 8 deletions

View File

@ -18,6 +18,6 @@ BUILT_SOURCES = ARMGenRegisterInfo.h.inc ARMGenRegisterNames.inc \
ARMGenDAGISel.inc ARMGenSubtarget.inc \ ARMGenDAGISel.inc ARMGenSubtarget.inc \
ARMGenCodeEmitter.inc ARMGenCallingConv.inc ARMGenCodeEmitter.inc ARMGenCallingConv.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,98 @@
//===-- ARMTargetInfo.cpp - ARM Target Implementation ---------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheARMTarget;
static unsigned ARM_JITMatchQuality() {
#if defined(__arm__)
return 10;
#endif
return 0;
}
static unsigned ARM_TripleMatchQuality(const std::string &TT) {
// Match arm-foo-bar, as well as things like armv5blah-*
if (TT.size() >= 4 &&
(TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv"))
return 20;
return 0;
}
static unsigned ARM_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = ARM_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::LittleEndian &&
M.getPointerSize() == Module::Pointer32)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return ARM_JITMatchQuality()/2;
}
Target TheThumbTarget;
static unsigned Thumb_JITMatchQuality() {
#if defined(__thumb__)
return 10;
#endif
return 0;
}
static unsigned Thumb_TripleMatchQuality(const std::string &TT) {
// Match thumb-foo-bar, as well as things like thumbv5blah-*
if (TT.size() >= 6 &&
(TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv"))
return 20;
return 0;
}
static unsigned Thumb_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = Thumb_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::LittleEndian &&
M.getPointerSize() == Module::Pointer32)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return Thumb_JITMatchQuality()/2;
}
extern "C" void LLVMInitializeARMTargetInfo() {
TargetRegistry::RegisterTarget(TheARMTarget, "arm",
"ARM",
&ARM_TripleMatchQuality,
&ARM_ModuleMatchQuality,
&ARM_JITMatchQuality);
TargetRegistry::RegisterTarget(TheThumbTarget, "thumb",
"Thumb",
&Thumb_TripleMatchQuality,
&Thumb_ModuleMatchQuality,
&Thumb_JITMatchQuality);
}

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMARMInfo
ARMTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/ARM/TargetInfo/Makefile ------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMARMInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -17,6 +17,6 @@ BUILT_SOURCES = AlphaGenRegisterInfo.h.inc AlphaGenRegisterNames.inc \
AlphaGenAsmWriter.inc AlphaGenDAGISel.inc \ AlphaGenAsmWriter.inc AlphaGenDAGISel.inc \
AlphaGenSubtarget.inc AlphaGenSubtarget.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,57 @@
//===-- AlphaTargetInfo.cpp - Alpha Target Implementation -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheAlphaTarget;
static unsigned Alpha_JITMatchQuality() {
#ifdef __alpha
return 10;
#else
return 0;
#endif
}
static unsigned Alpha_TripleMatchQuality(const std::string &TT) {
// We strongly match "alpha*".
if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' &&
TT[3] == 'h' && TT[4] == 'a')
return 20;
return 0;
}
static unsigned Alpha_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = Alpha_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::LittleEndian &&
M.getPointerSize() == Module::Pointer64)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return Alpha_JITMatchQuality()/2;
}
extern "C" void LLVMInitializeAlphaTargetInfo() {
TargetRegistry::RegisterTarget(TheAlphaTarget, "alpha",
"Alpha [experimental]",
&Alpha_TripleMatchQuality,
&Alpha_ModuleMatchQuality,
&Alpha_JITMatchQuality);
}

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMAlphaInfo
AlphaTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
#===- lib/Target/Alpha/TargetInfo/Makefile -----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMAlphaInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -9,6 +9,9 @@
LEVEL = ../../.. LEVEL = ../../..
LIBRARYNAME = LLVMCBackend LIBRARYNAME = LLVMCBackend
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common
CompileCommonOpts += -Wno-format CompileCommonOpts += -Wno-format

View File

@ -0,0 +1,38 @@
//===-- CBackendTargetInfo.cpp - CBackend Target Implementation -----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheCBackendTarget;
static unsigned CBackend_JITMatchQuality() {
return 0;
}
static unsigned CBackend_TripleMatchQuality(const std::string &TT) {
// This class always works, but must be requested explicitly on
// llc command line.
return 0;
}
static unsigned CBackend_ModuleMatchQuality(const Module &M) {
// This class always works, but must be requested explicitly on
// llc command line.
return 0;
}
extern "C" void LLVMInitializeCBackendTargetInfo() {
TargetRegistry::RegisterTarget(TheCBackendTarget, "c",
"C backend",
&CBackend_TripleMatchQuality,
&CBackend_ModuleMatchQuality,
&CBackend_JITMatchQuality);
}

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMCBackendInfo
CBackendTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/CBackend/TargetInfo/Makefile -------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMCBackendInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -17,6 +17,6 @@ BUILT_SOURCES = SPUGenInstrNames.inc SPUGenRegisterNames.inc \
SPUGenInstrInfo.inc SPUGenDAGISel.inc \ SPUGenInstrInfo.inc SPUGenDAGISel.inc \
SPUGenSubtarget.inc SPUGenCallingConv.inc SPUGenSubtarget.inc SPUGenCallingConv.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMCellSPUInfo
CellSPUTargetInfo.cpp
)

View File

@ -0,0 +1,48 @@
//===-- CellSPUTargetInfo.cpp - CellSPU Target Implementation -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheCellSPUTarget;
static unsigned CellSPU_JITMatchQuality() {
return 0;
}
static unsigned CellSPU_TripleMatchQuality(const std::string &TT) {
// We strongly match "spu-*" or "cellspu-*".
if ((TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "spu") ||
(TT.size() == 7 && std::string(TT.begin(), TT.begin()+7) == "cellspu") ||
(TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "spu-") ||
(TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "cellspu-"))
return 20;
return 0;
}
static unsigned CellSPU_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = CellSPU_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
return 0;
}
extern "C" void LLVMInitializeCellSPUTargetInfo() {
TargetRegistry::RegisterTarget(TheCellSPUTarget, "cellspu",
"STI CBEA Cell SPU [experimental]",
&CellSPU_TripleMatchQuality,
&CellSPU_ModuleMatchQuality,
&CellSPU_JITMatchQuality);
}

View File

@ -0,0 +1,15 @@
##===- lib/Target/CellSPU/TargetInfo/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMCellSPUInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -9,6 +9,9 @@
LEVEL = ../../.. LEVEL = ../../..
LIBRARYNAME = LLVMCppBackend LIBRARYNAME = LLVMCppBackend
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common
CompileCommonOpts += -Wno-format CompileCommonOpts += -Wno-format

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMCppBackendInfo
CppBackendTargetInfo.cpp
)

View File

@ -0,0 +1,36 @@
//===-- CppBackendTargetInfo.cpp - CppBackend Target Implementation -------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheCppBackendTarget;
static unsigned CppBackend_JITMatchQuality() {
return 0;
}
static unsigned CppBackend_TripleMatchQuality(const std::string &TT) {
// This class always works, but shouldn't be the default in most cases.
return 1;
}
static unsigned CppBackend_ModuleMatchQuality(const Module &M) {
// This class always works, but shouldn't be the default in most cases.
return 1;
}
extern "C" void LLVMInitializeCppBackendTargetInfo() {
TargetRegistry::RegisterTarget(TheCppBackendTarget, "cpp",
"C++ backend",
&CppBackend_TripleMatchQuality,
&CppBackend_ModuleMatchQuality,
&CppBackend_JITMatchQuality);
}

View File

@ -0,0 +1,15 @@
##===- lib/Target/CppBackend/TargetInfo/Makefile -----------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMCppBackendInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -14,7 +14,7 @@ BUILT_SOURCES = IA64GenRegisterInfo.h.inc IA64GenRegisterNames.inc \
IA64GenInstrInfo.inc IA64GenAsmWriter.inc \ IA64GenInstrInfo.inc IA64GenAsmWriter.inc \
IA64GenDAGISel.inc IA64GenDAGISel.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMIA64Info
IA64TargetInfo.cpp
)

View File

@ -0,0 +1,57 @@
//===-- IA64TargetInfo.cpp - IA64 Target Implementation -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheIA64Target;
static unsigned IA64_JITMatchQuality() {
return 0;
}
static unsigned IA64_TripleMatchQuality(const std::string &TT) {
// we match [iI][aA]*64
if (TT.size() >= 4) {
if ((TT[0]=='i' || TT[0]=='I') &&
(TT[1]=='a' || TT[1]=='A')) {
for(unsigned int i=2; i<(TT.size()-1); i++)
if(TT[i]=='6' && TT[i+1]=='4')
return 20; // strong match
}
}
return 0;
}
static unsigned IA64_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = IA64_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
// FIXME: This is bad, the target matching algorithm shouldn't depend on the
// host.
#if defined(__ia64__) || defined(__IA64__)
return 5;
#else
return 0;
#endif
}
extern "C" void LLVMInitializeIA64TargetInfo() {
TargetRegistry::RegisterTarget(TheIA64Target, "ia64",
"IA-64 (Itanium) [experimental]",
&IA64_TripleMatchQuality,
&IA64_ModuleMatchQuality,
&IA64_JITMatchQuality);
}

View File

@ -0,0 +1,15 @@
##===- lib/Target/IA64/TargetInfo/Makefile -----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMIA64Info
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -9,6 +9,9 @@
LEVEL = ../../.. LEVEL = ../../..
LIBRARYNAME = LLVMMSIL LIBRARYNAME = LLVMMSIL
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common
CompileCommonOpts := $(CompileCommonOpts) -Wno-format CompileCommonOpts := $(CompileCommonOpts) -Wno-format

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMMSILInfo
MSILTargetInfo.cpp
)

View File

@ -0,0 +1,36 @@
//===-- MSILTargetInfo.cpp - MSIL Target Implementation -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheMSILTarget;
static unsigned MSIL_JITMatchQuality() {
return 0;
}
static unsigned MSIL_TripleMatchQuality(const std::string &TT) {
// This class always works, but shouldn't be the default in most cases.
return 1;
}
static unsigned MSIL_ModuleMatchQuality(const Module &M) {
// This class always works, but shouldn't be the default in most cases.
return 1;
}
extern "C" void LLVMInitializeMSILTargetInfo() {
TargetRegistry::RegisterTarget(TheMSILTarget, "msil",
"MSIL backend",
&MSIL_TripleMatchQuality,
&MSIL_ModuleMatchQuality,
&MSIL_JITMatchQuality);
}

View File

@ -0,0 +1,15 @@
##===- lib/Target/MSIL/TargetInfo/Makefile -----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMMSILInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -17,5 +17,7 @@ BUILT_SOURCES = MSP430GenRegisterInfo.h.inc MSP430GenRegisterNames.inc \
MSP430GenDAGISel.inc MSP430GenCallingConv.inc \ MSP430GenDAGISel.inc MSP430GenCallingConv.inc \
MSP430GenSubtarget.inc MSP430GenSubtarget.inc
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMMSP430Info
MSP430TargetInfo.cpp
)

View File

@ -0,0 +1,46 @@
//===-- MSP430TargetInfo.cpp - MSP430 Target Implementation ---------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheMSP430Target;
static unsigned MSP430_JITMatchQuality() {
return 0;
}
static unsigned MSP430_TripleMatchQuality(const std::string &TT) {
// We strongly match msp430
if (TT.size() >= 6 && TT[0] == 'm' && TT[1] == 's' && TT[2] == 'p' &&
TT[3] == '4' && TT[4] == '3' && TT[5] == '0')
return 20;
return 0;
}
static unsigned MSP430_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = MSP430_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
return 0;
}
extern "C" void LLVMInitializeMSP430TargetInfo() {
TargetRegistry::RegisterTarget(TheMSP430Target, "msp430",
"MSP430 [experimental]",
&MSP430_TripleMatchQuality,
&MSP430_ModuleMatchQuality,
&MSP430_JITMatchQuality);
}

View File

@ -0,0 +1,15 @@
##===- lib/Target/MSP430/TargetInfo/Makefile ---------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMMSP430Info
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -17,7 +17,7 @@ BUILT_SOURCES = MipsGenRegisterInfo.h.inc MipsGenRegisterNames.inc \
MipsGenDAGISel.inc MipsGenCallingConv.inc \ MipsGenDAGISel.inc MipsGenCallingConv.inc \
MipsGenSubtarget.inc MipsGenSubtarget.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMMipsInfo
MipsTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/Mips/TargetInfo/Makefile -----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMMipsInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,87 @@
//===-- MipsTargetInfo.cpp - Mips Target Implementation -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheMipsTarget;
static unsigned Mips_JITMatchQuality() {
return 0;
}
static unsigned Mips_TripleMatchQuality(const std::string &TT) {
// We strongly match "mips*-*".
if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-")
return 20;
if (TT.size() >= 13 && std::string(TT.begin(),
TT.begin()+13) == "mipsallegrex-")
return 20;
return 0;
}
static unsigned Mips_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = Mips_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
return 0;
}
Target TheMipselTarget;
static unsigned Mipsel_JITMatchQuality() {
return 0;
}
static unsigned Mipsel_TripleMatchQuality(const std::string &TT) {
// We strongly match "mips*el-*".
if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-")
return 20;
if (TT.size() >= 15 && std::string(TT.begin(),
TT.begin()+15) == "mipsallegrexel-")
return 20;
if (TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "psp")
return 20;
return 0;
}
static unsigned Mipsel_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = Mipsel_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
return 0;
}
extern "C" void LLVMInitializeMipsTargetInfo() {
TargetRegistry::RegisterTarget(TheMipsTarget, "mips",
"Mips",
&Mips_TripleMatchQuality,
&Mips_ModuleMatchQuality,
&Mips_JITMatchQuality);
TargetRegistry::RegisterTarget(TheMipselTarget, "mipsel",
"Mipsel",
&Mipsel_TripleMatchQuality,
&Mipsel_ModuleMatchQuality,
&Mipsel_JITMatchQuality);
}

View File

@ -17,5 +17,7 @@ BUILT_SOURCES = PIC16GenRegisterInfo.h.inc PIC16GenRegisterNames.inc \
PIC16GenDAGISel.inc PIC16GenCallingConv.inc \ PIC16GenDAGISel.inc PIC16GenCallingConv.inc \
PIC16GenSubtarget.inc PIC16GenSubtarget.inc
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMPIC16Info
PIC16TargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/PIC16/TargetInfo/Makefile ----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMPIC16Info
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,54 @@
//===-- PIC16TargetInfo.cpp - PIC16 Target Implementation -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target ThePIC16Target;
static unsigned PIC16_JITMatchQuality() {
return 0;
}
static unsigned PIC16_TripleMatchQuality(const std::string &TT) {
return 0;
}
static unsigned PIC16_ModuleMatchQuality(const Module &M) {
return 0;
}
Target TheCooperTarget;
static unsigned Cooper_JITMatchQuality() {
return 0;
}
static unsigned Cooper_TripleMatchQuality(const std::string &TT) {
return 0;
}
static unsigned Cooper_ModuleMatchQuality(const Module &M) {
return 0;
}
extern "C" void LLVMInitializePIC16TargetInfo() {
TargetRegistry::RegisterTarget(ThePIC16Target, "pic16",
"PIC16 14-bit [experimental]",
&PIC16_TripleMatchQuality,
&PIC16_ModuleMatchQuality,
&PIC16_JITMatchQuality);
TargetRegistry::RegisterTarget(TheCooperTarget, "cooper",
"PIC16 Cooper [experimental]",
&Cooper_TripleMatchQuality,
&Cooper_ModuleMatchQuality,
&Cooper_JITMatchQuality);
}

View File

@ -17,6 +17,6 @@ BUILT_SOURCES = PPCGenInstrNames.inc PPCGenRegisterNames.inc \
PPCGenInstrInfo.inc PPCGenDAGISel.inc \ PPCGenInstrInfo.inc PPCGenDAGISel.inc \
PPCGenSubtarget.inc PPCGenCallingConv.inc PPCGenSubtarget.inc PPCGenCallingConv.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMPowerPCInfo
PowerPCTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/PowerPC/TargetInfo/Makefile ------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMPowerPCInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,98 @@
//===-- 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 "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target ThePPC32Target;
static unsigned PPC32_JITMatchQuality() {
#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
if (sizeof(void*) == 4)
return 10;
#endif
return 0;
}
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;
}
static unsigned PPC32_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = PPC32_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::BigEndian &&
M.getPointerSize() == Module::Pointer64)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return PPC32_JITMatchQuality()/2;
}
Target ThePPC64Target;
static unsigned PPC64_JITMatchQuality() {
#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
if (sizeof(void*) == 8)
return 10;
#endif
return 0;
}
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;
}
static unsigned PPC64_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = PPC64_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::BigEndian &&
M.getPointerSize() == Module::Pointer64)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return PPC64_JITMatchQuality()/2;
}
extern "C" void LLVMInitializePowerPCTargetInfo() {
TargetRegistry::RegisterTarget(ThePPC32Target, "ppc32",
"PowerPC 32",
&PPC32_TripleMatchQuality,
&PPC32_ModuleMatchQuality,
&PPC32_JITMatchQuality);
TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64",
"PowerPC 64",
&PPC64_TripleMatchQuality,
&PPC64_ModuleMatchQuality,
&PPC64_JITMatchQuality);
}

View File

@ -16,7 +16,7 @@ BUILT_SOURCES = SparcGenRegisterInfo.h.inc SparcGenRegisterNames.inc \
SparcGenInstrInfo.inc SparcGenAsmWriter.inc \ SparcGenInstrInfo.inc SparcGenAsmWriter.inc \
SparcGenDAGISel.inc SparcGenSubtarget.inc SparcGenCallingConv.inc SparcGenDAGISel.inc SparcGenSubtarget.inc SparcGenCallingConv.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMSparcInfo
SparcTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/Sparc/TargetInfo/Makefile ----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMSparcInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,61 @@
//===-- SparcTargetInfo.cpp - Sparc Target Implementation -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheSparcTarget;
static unsigned Sparc_JITMatchQuality() {
return 0;
}
static unsigned Sparc_TripleMatchQuality(const std::string &TT) {
if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "sparc-")
return 20;
return 0;
}
static unsigned Sparc_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = Sparc_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise if the target triple is non-empty, we don't match.
if (!M.getTargetTriple().empty()) return 0;
// FIXME: This is bad, the target matching algorithm shouldn't depend on the
// host.
if (M.getEndianness() == Module::BigEndian &&
M.getPointerSize() == Module::Pointer32)
#ifdef __sparc__
return 20; // BE/32 ==> Prefer sparc on sparc
#else
return 5; // BE/32 ==> Prefer ppc elsewhere
#endif
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
#if defined(__sparc__)
return 10;
#else
return 0;
#endif
}
extern "C" void LLVMInitializeSparcTargetInfo() {
TargetRegistry::RegisterTarget(TheSparcTarget, "sparc",
"Sparc",
&Sparc_TripleMatchQuality,
&Sparc_ModuleMatchQuality,
&Sparc_JITMatchQuality);
}

View File

@ -18,6 +18,6 @@ BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
X86GenFastISel.inc \ X86GenFastISel.inc \
X86GenCallingConv.inc X86GenSubtarget.inc X86GenCallingConv.inc X86GenSubtarget.inc
DIRS = AsmPrinter DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMX86Info
X86TargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/X86/TargetInfo/Makefile ------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMX86Info
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,98 @@
//===-- X86TargetInfo.cpp - X86 Target Implementation ---------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheX86_32Target;
static unsigned X86_32_JITMatchQuality() {
#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
return 10;
#endif
return 0;
}
static unsigned X86_32_TripleMatchQuality(const std::string &TT) {
// We strongly match "i[3-9]86-*".
if (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' &&
TT[4] == '-' && TT[1] - '3' < 6)
return 20;
return 0;
}
static unsigned X86_32_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = X86_32_TripleMatchQuality(M.getTargetTriple()))
return Q;
// If the target triple is something non-X86, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::LittleEndian &&
M.getPointerSize() == Module::Pointer32)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return X86_32_JITMatchQuality()/2;
}
Target TheX86_64Target;
static unsigned X86_64_JITMatchQuality() {
#if defined(__x86_64__) || defined(_M_AMD64)
return 10;
#endif
return 0;
}
static unsigned X86_64_TripleMatchQuality(const std::string &TT) {
// We strongly match "x86_64-*".
if (TT.size() >= 7 && TT[0] == 'x' && TT[1] == '8' && TT[2] == '6' &&
TT[3] == '_' && TT[4] == '6' && TT[5] == '4' && TT[6] == '-')
return 20;
return 0;
}
static unsigned X86_64_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = X86_64_TripleMatchQuality(M.getTargetTriple()))
return Q;
// If the target triple is something non-X86-64, we don't match.
if (!M.getTargetTriple().empty()) return 0;
if (M.getEndianness() == Module::LittleEndian &&
M.getPointerSize() == Module::Pointer64)
return 10; // Weak match
else if (M.getEndianness() != Module::AnyEndianness ||
M.getPointerSize() != Module::AnyPointerSize)
return 0; // Match for some other target
return X86_64_JITMatchQuality()/2;
}
extern "C" void LLVMInitializeX86TargetInfo() {
TargetRegistry::RegisterTarget(TheX86_32Target, "x86",
"32-bit X86: Pentium-Pro and above",
&X86_32_TripleMatchQuality,
&X86_32_ModuleMatchQuality,
&X86_32_JITMatchQuality);
TargetRegistry::RegisterTarget(TheX86_64Target, "x86-64",
"64-bit X86: EM64T and AMD64",
&X86_64_TripleMatchQuality,
&X86_64_ModuleMatchQuality,
&X86_64_JITMatchQuality);
}

View File

@ -17,5 +17,7 @@ BUILT_SOURCES = XCoreGenRegisterInfo.h.inc XCoreGenRegisterNames.inc \
XCoreGenDAGISel.inc XCoreGenCallingConv.inc \ XCoreGenDAGISel.inc XCoreGenCallingConv.inc \
XCoreGenSubtarget.inc XCoreGenSubtarget.inc
DIRS = TargetInfo
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMXCoreInfo
XCoreTargetInfo.cpp
)

View File

@ -0,0 +1,15 @@
##===- lib/Target/XCore/TargetInfo/Makefile ----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL = ../../../..
LIBRARYNAME = LLVMXCoreInfo
# Hack: we need to include 'main' target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common

View File

@ -0,0 +1,42 @@
//===-- XCoreTargetInfo.cpp - XCore Target Implementation -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Module.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
Target TheXCoreTarget;
static unsigned XCore_JITMatchQuality() {
return 0;
}
static unsigned XCore_TripleMatchQuality(const std::string &TT) {
if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "xcore-")
return 20;
return 0;
}
static unsigned XCore_ModuleMatchQuality(const Module &M) {
// Check for a triple match.
if (unsigned Q = XCore_TripleMatchQuality(M.getTargetTriple()))
return Q;
// Otherwise we don't match.
return 0;
}
extern "C" void LLVMInitializeXCoreTargetInfo() {
TargetRegistry::RegisterTarget(TheXCoreTarget, "xcore",
"XCore",
&XCore_TripleMatchQuality,
&XCore_ModuleMatchQuality,
&XCore_JITMatchQuality);
}