LLVM removed LLVMAddTargetData for the 3.9 release in r260919.  For the two
places in mesa where this is called, only enable the lines when compiling
for less then 3.9.

For the radeon driver, I'm not sure how to check if any other LLVM calls need
to be adjusted.  I think since the target data used is extracted from the
LLVMModule, it isn't necessary to pass it back to LLVM again.

The code does compile, and at least for radeonsi does run OpenGL games.

Signed-off-by: Matthew Dawson <[email protected]>
---
 src/gallium/auxiliary/gallivm/lp_bld_init.c   | 2 ++
 src/gallium/drivers/radeon/radeon_llvm_util.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c 
b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 96aba73..8c81170 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -112,6 +112,7 @@ create_pass_manager(struct gallivm_state *gallivm)
    gallivm->passmgr = LLVMCreateFunctionPassManagerForModule(gallivm->module);
    if (!gallivm->passmgr)
       return FALSE;
+#if HAVE_LLVM < 0x0309
    /*
     * TODO: some per module pass manager with IPO passes might be helpful -
     * the generated texture functions may benefit from inlining if they are
@@ -120,6 +121,7 @@ create_pass_manager(struct gallivm_state *gallivm)
 
    // Old versions of LLVM get the DataLayout from the pass manager.
    LLVMAddTargetData(gallivm->target, gallivm->passmgr);
+#endif
 
    /* Setting the module's DataLayout to an empty string will cause the
     * ExecutionEngine to copy to the DataLayout string from its target
diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c 
b/src/gallium/drivers/radeon/radeon_llvm_util.c
index 0dfd9ad..ee21437 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_util.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_util.c
@@ -77,7 +77,9 @@ static void radeon_llvm_optimize(LLVMModuleRef mod)
                }
        }
 
+#if HAVE_LLVM < 0x0309
        LLVMAddTargetData(TD, pass_manager);
+#endif
        LLVMAddAlwaysInlinerPass(pass_manager);
        LLVMPassManagerBuilderPopulateModulePassManager(builder, pass_manager);
 
-- 
2.7.0

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to