llvmpipe: Make sure the JIT engine and X86 target are linked on MSVC build.

Basically mimic the llvm 2.6 way of linking execution engines and
targets.
This commit is contained in:
José Fonseca 2009-10-28 11:05:32 +00:00
parent 5eba607db6
commit 182ff3e47a
6 changed files with 118 additions and 4 deletions

View file

@ -57,6 +57,9 @@ C_SOURCES = \
lp_tile_cache.c \
lp_tile_soa.c
CPP_SOURCES = \
lp_bld_misc.cpp
include ../../Makefile.template
lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_access.py ../../auxiliary/util/u_format.csv

View file

@ -34,6 +34,7 @@ llvmpipe = env.ConvenienceLibrary(
'lp_bld_format_soa.c',
'lp_bld_interp.c',
'lp_bld_intr.c',
'lp_bld_misc.cpp',
'lp_bld_pack.c',
'lp_bld_sample.c',
'lp_bld_sample_soa.c',

View file

@ -0,0 +1,62 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "llvm/Config/config.h"
#include "pipe/p_config.h"
#include "lp_bld_misc.h"
#ifndef LLVM_NATIVE_ARCH
namespace llvm {
extern void LinkInJIT();
}
void
LLVMLinkInJIT(void)
{
llvm::LinkInJIT();
}
extern "C" int X86TargetMachineModule;
void
LLVMInitializeNativeTarget(void)
{
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
X86TargetMachineModule = 1;
#endif
}
#endif

View file

@ -0,0 +1,50 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef LP_BLD_MISC_H
#define LP_BLD_MISC_H
#ifdef __cplusplus
extern "C" {
#endif
void
LLVMLinkInJIT(void);
void
LLVMInitializeNativeTarget(void);
#ifdef __cplusplus
}
#endif
#endif /* !LP_BLD_MISC_H */

View file

@ -39,6 +39,7 @@
#include "util/u_cpu_detect.h"
#include "lp_screen.h"
#include "lp_bld_intr.h"
#include "lp_bld_misc.h"
#include "lp_jit.h"
@ -156,10 +157,8 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
util_cpu_caps.has_sse4_1 = 0;
#endif
#ifdef LLVM_NATIVE_ARCH
LLVMLinkInJIT();
LLVMInitializeNativeTarget();
#endif
screen->module = LLVMModuleCreateWithName("llvmpipe");

View file

@ -37,6 +37,7 @@
#include "util/u_cpu_detect.h"
#include "lp_bld_const.h"
#include "lp_bld_misc.h"
#include "lp_test.h"
@ -379,10 +380,8 @@ int main(int argc, char **argv)
n = atoi(argv[i]);
}
#ifdef LLVM_NATIVE_ARCH
LLVMLinkInJIT();
LLVMInitializeNativeTarget();
#endif
util_cpu_detect();