From f4e7b6cca49cc13ff9070fe1a61fa24d49a4eb5b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 18 Aug 2009 03:03:27 +0000 Subject: Add LLVMInitializeAllTargetInfos for C api, and update LLVMInitializeNativeTarget to initialize target info. - Patch by Jose Fonseca. llvm-svn: 79307 --- llvm/include/llvm-c/Target.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'llvm/include/llvm-c') diff --git a/llvm/include/llvm-c/Target.h b/llvm/include/llvm-c/Target.h index bb423bbaadf..43388512e87 100644 --- a/llvm/include/llvm-c/Target.h +++ b/llvm/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; -- cgit v1.2.3