Initialize LLVM target and asmprinter for the native and extra targets.

Uses some CMake hackery to get the native LLVM target name, since it only
provides a conveniance function for initializing the native target and not the
native asmprinter.
This commit is contained in:
Christian Kamm
2009-06-26 21:02:23 +02:00
parent e0331c7b53
commit 88f6e9e83a
2 changed files with 38 additions and 9 deletions
+15 -2
View File
@@ -4,6 +4,7 @@
// which uses the llvm license
#include "gen/llvm.h"
#include "gen/llvm-version.h"
#include "llvm/LinkAllVMCore.h"
#include "llvm/Linker.h"
#include "llvm/System/Signals.h"
@@ -11,6 +12,9 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetMachineRegistry.h"
#if LLVM_REV >= 73610
#include "llvm/Target/TargetSelect.h"
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -421,8 +425,17 @@ int main(int argc, char** argv)
mod.setTargetTriple(global.params.targetTriple);
// Allocate target machine. First, check whether the user has
// explicitly specified an architecture to compile for.
// Allocate target machine.
// first initialize llvm
#if LLVM_REV >= 73610
#define LLVM_TARGET(A) LLVMInitialize##A##Target(); LLVMInitialize##A##AsmPrinter();
// this is defined to be LLVM_TARGET(target name 1) LLVM_TARGET(target name 2) ...
LDC_TARGETS
#undef LLVM_TARGET
#endif
// Check whether the user has explicitly specified an architecture to compile for.
if (mArch == 0)
{
std::string Err;