Mesa (master): gallivm: Override some of the default target options.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jun 14 09:12:14 PDT 2010


Module: Mesa
Branch: master
Commit: 4d2407699ba043735b5fbd5c20fc5ccbff32c948
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d2407699ba043735b5fbd5c20fc5ccbff32c948

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Jun 13 13:13:11 2010 +0100

gallivm: Override some of the default target options.

In particular:
- enable LLVM <-> GDB integration for JIT code
- disable frame-pointer elimination on debug/profile builds
- enable fast-math.

---

 src/gallium/auxiliary/gallivm/lp_bld_init.c   |    5 ++++
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp |   26 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 0a690ea..44cfdc4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -78,6 +78,9 @@ enum LLVM_CodeGenOpt_Level {
 extern void
 lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE);
 
+extern void
+lp_set_target_options(void);
+
 
 void
 lp_build_init(void)
@@ -86,6 +89,8 @@ lp_build_init(void)
    gallivm_debug = debug_get_flags_option("GALLIVM_DEBUG", lp_bld_debug_flags, 0 );
 #endif
 
+   lp_set_target_options();
+
    LLVMInitializeNativeTarget();
 
    LLVMLinkInJIT();
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index f004c0a..87e9f00 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -36,6 +36,7 @@
 
 #include <llvm-c/Core.h>
 #include <llvm-c/ExecutionEngine.h>
+#include <llvm/Target/TargetOptions.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/ExecutionEngine/JITEventListener.h>
 
@@ -119,3 +120,28 @@ lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE)
 {
    llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener());
 }
+
+
+extern "C" void
+lp_set_target_options(void)
+{
+#if defined(DEBUG)
+#if HAVE_LLVM >= 0x0207
+   llvm::JITEmitDebugInfo = true;
+#endif
+#endif
+
+#if defined(DEBUG) || defined(PROFILE)
+   llvm::NoFramePointerElim = true;
+#if HAVE_LLVM >= 0x0207
+   llvm::NoFramePointerElimNonLeaf = true;
+#endif
+#endif
+
+   llvm::NoExcessFPPrecision = false;
+
+   /* XXX: Investigate this */
+#if 0
+   llvm::UnsafeFPMath = true;
+#endif
+}



More information about the mesa-commit mailing list