[Mesa-dev] [PATCH] Handle removal of LLVMAddTargetData in SVN revision 260919
Michel Dänzer
michel at daenzer.net
Tue Feb 16 07:19:49 UTC 2016
On 16.02.2016 15:25, Matthew Dawson wrote:
> 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.
BTW, I recommend getting familiar with piglit so that you can make sure
your changes don't cause any piglit regressions. I did so for this change.
> Signed-off-by: Matthew Dawson <matthew at mjdsystems.ca>
> ---
> 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
AFAICT this TODO comment isn't related to LLVMAddTargetData.
> @@ -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
I pushed your patch with the #if above moved before this comment.
> 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);
I also added HAVE_LLVM < 0x0309 guards around the other occurrences of
TD and data_layout, which are unused with this change.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the mesa-dev
mailing list