[Mesa-dev] [PATCH] radv: setup llvm target data layout
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Mon Mar 13 22:58:07 UTC 2017
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
On Mon, Mar 13, 2017 at 9:52 PM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Ported from radeonsi, pointed out by Tom.
>
> "This prevents LLVM from using sext instructions for local memory
> offsets and allows the backend to fold immediate offsets into the
> instruction. This also prevents some incorrect code generation for
> ptrtoint and inttoptr instructions."
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/amd/common/ac_nir_to_llvm.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 47091a2..417b34e 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -4911,6 +4911,13 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
> memset(shader_info, 0, sizeof(*shader_info));
>
> LLVMSetTarget(ctx.module, options->supports_spill ? "amdgcn-mesa-mesa3d" : "amdgcn--");
> +
> + LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
> + char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
> + LLVMSetDataLayout(ctx.module, data_layout_str);
> + LLVMDisposeTargetData(data_layout);
> + LLVMDisposeMessage(data_layout_str);
> +
> setup_types(&ctx);
>
> ctx.builder = LLVMCreateBuilderInContext(ctx.context);
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list