summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorAnders Waldenborg <anders@0x63.nu>2013-10-15 12:08:59 +0000
committerAnders Waldenborg <anders@0x63.nu>2013-10-15 12:08:59 +0000
commit1d9cb434b3ff6942ab9d1e1992f65481346e16ab (patch)
treef2ba11edbaceddf1ce15a052ea997c2dc0863ae0 /llvm/lib/Target
parent14b9924c7bfa23a3cbe3b5fc33b7f28bba3f4822 (diff)
downloadbcm5719-llvm-1d9cb434b3ff6942ab9d1e1992f65481346e16ab.tar.gz
bcm5719-llvm-1d9cb434b3ff6942ab9d1e1992f65481346e16ab.zip
Add AllTargetsBindings sublibrary instead of having static inlines in the llvm-c headers.
This new library will be linked in when using the "all-targets" component and contains the LLVMInitializeAll* functions. This means that those functions will exist as real symbols in the shared library, and can therefore can be called from bindings that are using ffi the shared library. llvm-svn: 192690
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AllTargetsBindings/AllTargetsBindings.cpp42
-rw-r--r--llvm/lib/Target/AllTargetsBindings/CMakeLists.txt3
-rw-r--r--llvm/lib/Target/AllTargetsBindings/LLVMBuild.txt32
-rw-r--r--llvm/lib/Target/AllTargetsBindings/Makefile14
-rw-r--r--llvm/lib/Target/CMakeLists.txt2
-rw-r--r--llvm/lib/Target/LLVMBuild.txt9
-rw-r--r--llvm/lib/Target/Makefile2
7 files changed, 95 insertions, 9 deletions
diff --git a/llvm/lib/Target/AllTargetsBindings/AllTargetsBindings.cpp b/llvm/lib/Target/AllTargetsBindings/AllTargetsBindings.cpp
new file mode 100644
index 00000000000..5f1a9c921d0
--- /dev/null
+++ b/llvm/lib/Target/AllTargetsBindings/AllTargetsBindings.cpp
@@ -0,0 +1,42 @@
+//===-- AllTargetsBindings.cpp --------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the llvm-c functions for initialization of
+// different aspects of all configured targets.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-c/Target.h"
+#include "llvm/Support/TargetSelect.h"
+
+using namespace llvm;
+
+void LLVMInitializeAllTargetInfos(void) {
+ InitializeAllTargetInfos();
+}
+
+void LLVMInitializeAllTargets(void) {
+ InitializeAllTargets();
+}
+
+void LLVMInitializeAllTargetMCs(void) {
+ InitializeAllTargetMCs();
+}
+
+void LLVMInitializeAllAsmPrinters(void) {
+ InitializeAllAsmPrinters();
+}
+
+void LLVMInitializeAllAsmParsers(void) {
+ InitializeAllAsmParsers();
+}
+
+void LLVMInitializeAllDisassemblers(void) {
+ InitializeAllDisassemblers();
+}
diff --git a/llvm/lib/Target/AllTargetsBindings/CMakeLists.txt b/llvm/lib/Target/AllTargetsBindings/CMakeLists.txt
new file mode 100644
index 00000000000..4b4dc77b5cd
--- /dev/null
+++ b/llvm/lib/Target/AllTargetsBindings/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_llvm_library(LLVMAllTargetsBindings
+ AllTargetsBindings.cpp
+ )
diff --git a/llvm/lib/Target/AllTargetsBindings/LLVMBuild.txt b/llvm/lib/Target/AllTargetsBindings/LLVMBuild.txt
new file mode 100644
index 00000000000..ecf8acaa827
--- /dev/null
+++ b/llvm/lib/Target/AllTargetsBindings/LLVMBuild.txt
@@ -0,0 +1,32 @@
+;===- ./lib/Target/LLVMBuild.txt -------------------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+; This is a special group whose required libraries are extended (by llvm-build)
+; with every built target, which makes it easy for tools to include every
+; target.
+[component_0]
+type = LibraryGroup
+name = all-targets
+parent = Libraries
+
+; This is the actual library built in this directory.
+; It just contains the llvm-c bindings LLVMInitializeAllTarget* functions
+[component_1]
+type = Library
+name = AllTargetsBindings
+parent = Libraries
+add_to_library_groups = all-targets
diff --git a/llvm/lib/Target/AllTargetsBindings/Makefile b/llvm/lib/Target/AllTargetsBindings/Makefile
new file mode 100644
index 00000000000..47a68830bb3
--- /dev/null
+++ b/llvm/lib/Target/AllTargetsBindings/Makefile
@@ -0,0 +1,14 @@
+#===- lib/Target/AllTargetsBindings/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 = LLVMAllTargetsBindings
+BUILD_ARCHIVE = 1
+
+include $(LEVEL)/Makefile.common
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 02ac493b421..861c999c6bb 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -14,3 +14,5 @@ foreach(t ${LLVM_TARGETS_TO_BUILD})
message(STATUS "Targeting ${t}")
add_subdirectory(${t})
endforeach()
+
+add_subdirectory("AllTargetsBindings")
diff --git a/llvm/lib/Target/LLVMBuild.txt b/llvm/lib/Target/LLVMBuild.txt
index 98d26bcac8a..10dc3dc6858 100644
--- a/llvm/lib/Target/LLVMBuild.txt
+++ b/llvm/lib/Target/LLVMBuild.txt
@@ -16,7 +16,7 @@
;===------------------------------------------------------------------------===;
[common]
-subdirectories = AArch64 ARM CppBackend Hexagon MSP430 NVPTX Mips PowerPC R600 Sparc SystemZ X86 XCore
+subdirectories = AArch64 ARM CppBackend Hexagon MSP430 NVPTX Mips PowerPC R600 Sparc SystemZ X86 XCore AllTargetsBindings
; This is a special group whose required libraries are extended (by llvm-build)
; with the best execution engine (the native JIT, if available, or the
@@ -47,10 +47,3 @@ name = Target
parent = Libraries
required_libraries = Core MC Support
-; This is a special group whose required libraries are extended (by llvm-build)
-; with every built target, which makes it easy for tools to include every
-; target.
-[component_4]
-type = LibraryGroup
-name = all-targets
-parent = Libraries
diff --git a/llvm/lib/Target/Makefile b/llvm/lib/Target/Makefile
index 50a360f1f86..cfa2edb4afe 100644
--- a/llvm/lib/Target/Makefile
+++ b/llvm/lib/Target/Makefile
@@ -15,6 +15,6 @@ BUILD_ARCHIVE = 1
# value for PARALLEL_DIRS which must be set before Makefile.rules is included
include $(LEVEL)/Makefile.config
-PARALLEL_DIRS := $(TARGETS_TO_BUILD)
+PARALLEL_DIRS := $(TARGETS_TO_BUILD) AllTargetsBindings
include $(LLVM_SRC_ROOT)/Makefile.rules
OpenPOWER on IntegriCloud