aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CellSPU
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CellSPU')
-rw-r--r--lib/Target/CellSPU/Makefile2
-rw-r--r--lib/Target/CellSPU/TargetInfo/CMakeLists.txt6
-rw-r--r--lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp48
-rw-r--r--lib/Target/CellSPU/TargetInfo/Makefile15
4 files changed, 70 insertions, 1 deletions
diff --git a/lib/Target/CellSPU/Makefile b/lib/Target/CellSPU/Makefile
index a460db3..8415168 100644
--- a/lib/Target/CellSPU/Makefile
+++ b/lib/Target/CellSPU/Makefile
@@ -17,6 +17,6 @@ BUILT_SOURCES = SPUGenInstrNames.inc SPUGenRegisterNames.inc \
SPUGenInstrInfo.inc SPUGenDAGISel.inc \
SPUGenSubtarget.inc SPUGenCallingConv.inc
-DIRS = AsmPrinter
+DIRS = AsmPrinter TargetInfo
include $(LEVEL)/Makefile.common
diff --git a/lib/Target/CellSPU/TargetInfo/CMakeLists.txt b/lib/Target/CellSPU/TargetInfo/CMakeLists.txt
new file mode 100644
index 0000000..b2cb2ff
--- /dev/null
+++ b/lib/Target/CellSPU/TargetInfo/CMakeLists.txt
@@ -0,0 +1,6 @@
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
+
+add_llvm_library(LLVMCellSPUInfo
+ CellSPUTargetInfo.cpp
+ )
+
diff --git a/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp b/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp
new file mode 100644
index 0000000..c5ad7b8
--- /dev/null
+++ b/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp
@@ -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);
+}
diff --git a/lib/Target/CellSPU/TargetInfo/Makefile b/lib/Target/CellSPU/TargetInfo/Makefile
new file mode 100644
index 0000000..9cb6827
--- /dev/null
+++ b/lib/Target/CellSPU/TargetInfo/Makefile
@@ -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