summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-18 03:03:27 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-18 03:03:27 +0000
commitbaf3eddc7804c7b7e023a2407e5c93735fb08aff (patch)
tree590535399a7899cb1adacf8e91a451fe2fdd13b4 /include
parent8942f9bb9f8bfb0d113db6d4a1ae7203dcf4510a (diff)
downloadllvm-baf3eddc7804c7b7e023a2407e5c93735fb08aff.tar.gz
llvm-baf3eddc7804c7b7e023a2407e5c93735fb08aff.tar.bz2
llvm-baf3eddc7804c7b7e023a2407e5c93735fb08aff.tar.xz
Add LLVMInitializeAllTargetInfos for C api, and update
LLVMInitializeNativeTarget to initialize target info. - Patch by Jose Fonseca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Target.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/llvm-c/Target.h b/include/llvm-c/Target.h
index bb423bbaad..43388512e8 100644
--- a/include/llvm-c/Target.h
+++ b/include/llvm-c/Target.h
@@ -33,9 +33,20 @@ typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
typedef struct LLVMStructLayout *LLVMStructLayoutRef;
/* Declare all of the target-initialization functions that are available. */
+#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetInfo();
+#include "llvm/Config/Targets.def"
+
#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target();
#include "llvm/Config/Targets.def"
+/** LLVMInitializeAllTargetInfos - The main program should call this function if
+ it wants access to all available targets that LLVM is configured to
+ support. */
+static inline void LLVMInitializeAllTargetInfos() {
+#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
+#include "llvm/Config/Targets.def"
+}
+
/** LLVMInitializeAllTargets - The main program should call this function if it
wants to link in all available targets that LLVM is configured to
support. */
@@ -50,7 +61,9 @@ static inline void LLVMInitializeAllTargets() {
static inline int LLVMInitializeNativeTarget() {
/* If we have a native target, initialize it to ensure it is linked in. */
#ifdef LLVM_NATIVE_ARCH
-#define DoInit2(TARG) LLVMInitialize ## TARG ()
+#define DoInit2(TARG) \
+ LLVMInitialize ## TARG ## Info (); \
+ LLVMInitialize ## TARG ()
#define DoInit(T) DoInit2(T)
DoInit(LLVM_NATIVE_ARCH);
return 0;