mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-09-28 08:10:18 +02:00
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:
+15
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user