summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_init.cpp
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-03-03 12:00:08 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-03-03 12:02:26 +0000
commita9e6da7b4cd2019e5ac501bfa1d1aeff49e1982c (patch)
tree87d9fc072469a01711466c015de173f08e254780 /src/gallium/auxiliary/gallivm/lp_bld_init.cpp
parentf58ca9b02bb4b19d57dfe38016626a89c3757de6 (diff)
gallivm: Centralize initialization. Fix stack alignment issues on Windows.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_init.cpp')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.cpp44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.cpp b/src/gallium/auxiliary/gallivm/lp_bld_init.cpp
index 6b559db159..067397a520 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.cpp
@@ -26,39 +26,34 @@
**************************************************************************/
+#include <llvm/Config/config.h>
+#include <llvm/Target/TargetSelect.h>
+#include <llvm/Target/TargetOptions.h>
+
#include "pipe/p_config.h"
#include "lp_bld_init.h"
-#ifndef LLVM_NATIVE_ARCH
-
-namespace llvm {
- extern void LinkInJIT();
-}
+extern "C" void LLVMLinkInJIT();
-void
-LLVMLinkInJIT(void)
+extern "C" void
+lp_build_init(void)
{
- llvm::LinkInJIT();
-}
-
-
-extern "C" int X86TargetMachineModule;
-
-
-int
-LLVMInitializeNativeTarget(void)
-{
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
- X86TargetMachineModule = 1;
+#if defined(PIPE_OS_WINDOWS) && defined(PIPE_ARCH_X86)
+ /*
+ * This is mis-detected on some hardware / software combinations.
+ */
+ llvm::StackAlignment = 4;
+ llvm::RealignStack = true;
#endif
- return 0;
-}
+ /* Same as LLVMInitializeNativeTarget(); */
+ llvm::InitializeNativeTarget();
-#endif
+ LLVMLinkInJIT();
+}
/*
@@ -69,7 +64,6 @@ LLVMInitializeNativeTarget(void)
*/
#if defined(_MSC_VER) && defined(_DEBUG)
#include <crtdefs.h>
-extern "C" {
- _CRTIMP void __cdecl _invalid_parameter_noinfo(void) {}
-}
+extern "C" _CRTIMP void __cdecl
+_invalid_parameter_noinfo(void) {}
#endif