diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 06:35:19 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 06:35:19 +0000 |
| commit | 56e2947a33c5fcb98e7775aa509e66c4ace9959a (patch) | |
| tree | 372fb14c28c5ff4a62ba73f460105e0a608a9c4d /llvm/lib/Target/XCore/TargetInfo | |
| parent | a5da8d25b7eb26a57816218339bb8a81ec1f7e12 (diff) | |
| download | bcm5719-llvm-56e2947a33c5fcb98e7775aa509e66c4ace9959a.tar.gz bcm5719-llvm-56e2947a33c5fcb98e7775aa509e66c4ace9959a.zip | |
Add TargetInfo libraries for all targets.
- Intended to match current TargetMachine implementations.
- No facilities for linking these in yet.
llvm-svn: 75751
Diffstat (limited to 'llvm/lib/Target/XCore/TargetInfo')
| -rw-r--r-- | llvm/lib/Target/XCore/TargetInfo/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | llvm/lib/Target/XCore/TargetInfo/Makefile | 15 | ||||
| -rw-r--r-- | llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp | 42 |
3 files changed, 63 insertions, 0 deletions
diff --git a/llvm/lib/Target/XCore/TargetInfo/CMakeLists.txt b/llvm/lib/Target/XCore/TargetInfo/CMakeLists.txt new file mode 100644 index 00000000000..2772a51f7bb --- /dev/null +++ b/llvm/lib/Target/XCore/TargetInfo/CMakeLists.txt @@ -0,0 +1,6 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMXCoreInfo + XCoreTargetInfo.cpp + ) + diff --git a/llvm/lib/Target/XCore/TargetInfo/Makefile b/llvm/lib/Target/XCore/TargetInfo/Makefile new file mode 100644 index 00000000000..07473d223f6 --- /dev/null +++ b/llvm/lib/Target/XCore/TargetInfo/Makefile @@ -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 diff --git a/llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp b/llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp new file mode 100644 index 00000000000..ce664e1b384 --- /dev/null +++ b/llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp @@ -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); +} |

