[llvm] r192329 - Revert "llvm-c: Make target initializer functions external functions in lib."
Rui Ueyama
ruiu at google.com
Wed Oct 9 16:15:49 PDT 2013
Author: ruiu
Date: Wed Oct 9 18:15:49 2013
New Revision: 192329
URL: http://llvm.org/viewvc/llvm-project?rev=192329&view=rev
Log:
Revert "llvm-c: Make target initializer functions external functions in lib."
This reverts commit r192316. The original change introduced circular
dependencies between libTarget and backends. That would broke a build unless
link everything into one big binary.
Removed:
llvm/trunk/lib/Target/AllTargets.cpp
Modified:
llvm/trunk/include/llvm-c/Target.h
llvm/trunk/lib/Target/CMakeLists.txt
Modified: llvm/trunk/include/llvm-c/Target.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=192329&r1=192328&r2=192329&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Target.h (original)
+++ llvm/trunk/include/llvm-c/Target.h Wed Oct 9 18:15:49 2013
@@ -71,37 +71,62 @@ typedef struct LLVMStructLayout *LLVMStr
void LLVMInitialize##TargetName##Disassembler(void);
#include "llvm/Config/Disassemblers.def"
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
-
+
/** LLVMInitializeAllTargetInfos - The main program should call this function if
it wants access to all available targets that LLVM is configured to
support. */
-void LLVMInitializeAllTargetInfos(void);
+static inline void LLVMInitializeAllTargetInfos(void) {
+#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
+#include "llvm/Config/Targets.def"
+#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
+}
/** LLVMInitializeAllTargets - The main program should call this function if it
wants to link in all available targets that LLVM is configured to
support. */
-void LLVMInitializeAllTargets(void);
+static inline void LLVMInitializeAllTargets(void) {
+#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
+#include "llvm/Config/Targets.def"
+#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
+}
/** LLVMInitializeAllTargetMCs - The main program should call this function if
it wants access to all available target MC that LLVM is configured to
support. */
-void LLVMInitializeAllTargetMCs(void);
-
+static inline void LLVMInitializeAllTargetMCs(void) {
+#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
+#include "llvm/Config/Targets.def"
+#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
+}
+
/** LLVMInitializeAllAsmPrinters - The main program should call this function if
it wants all asm printers that LLVM is configured to support, to make them
available via the TargetRegistry. */
-void LLVMInitializeAllAsmPrinters(void);
-
+static inline void LLVMInitializeAllAsmPrinters(void) {
+#define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
+#include "llvm/Config/AsmPrinters.def"
+#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
+}
+
/** LLVMInitializeAllAsmParsers - The main program should call this function if
it wants all asm parsers that LLVM is configured to support, to make them
available via the TargetRegistry. */
-void LLVMInitializeAllAsmParsers(void);
-
+static inline void LLVMInitializeAllAsmParsers(void) {
+#define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
+#include "llvm/Config/AsmParsers.def"
+#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
+}
+
/** LLVMInitializeAllDisassemblers - The main program should call this function
if it wants all disassemblers that LLVM is configured to support, to make
them available via the TargetRegistry. */
-void LLVMInitializeAllDisassemblers(void);
-
+static inline void LLVMInitializeAllDisassemblers(void) {
+#define LLVM_DISASSEMBLER(TargetName) \
+ LLVMInitialize##TargetName##Disassembler();
+#include "llvm/Config/Disassemblers.def"
+#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
+}
+
/** LLVMInitializeNativeTarget - The main program should call this function to
initialize the native target corresponding to the host. This is useful
for JIT applications to ensure that the target gets linked in correctly. */
Removed: llvm/trunk/lib/Target/AllTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AllTargets.cpp?rev=192328&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AllTargets.cpp (original)
+++ llvm/trunk/lib/Target/AllTargets.cpp (removed)
@@ -1,43 +0,0 @@
-//===-- AllTargets.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 functions for initialization of different
-// aspects of all configured targets. When calling any of these
-// functions all configured targets must be linked in.
-//
-//===----------------------------------------------------------------------===//
-
-#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();
-}
Modified: llvm/trunk/lib/Target/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=192329&r1=192328&r2=192329&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/CMakeLists.txt Wed Oct 9 18:15:49 2013
@@ -1,5 +1,4 @@
add_llvm_library(LLVMTarget
- AllTargets.cpp
Mangler.cpp
Target.cpp
TargetIntrinsicInfo.cpp
More information about the llvm-commits
mailing list