FreeBSD Bugzilla – Attachment 181281 Details for
Bug 218196
graphics/libGL: fix build with LLVM 4.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
graphics/libGL: fix build with LLVM 4.0
patch-graphics_libGL.diff (text/plain), 35.55 KB, created by
Eric Camachat
on 2017-03-28 21:50:15 UTC
(
hide
)
Description:
graphics/libGL: fix build with LLVM 4.0
Filename:
MIME Type:
Creator:
Eric Camachat
Created:
2017-03-28 21:50:15 UTC
Size:
35.55 KB
patch
obsolete
>Index: Makefile.common >=================================================================== >--- Makefile.common (revision 437148) >+++ Makefile.common (working copy) >@@ -60,7 +60,7 @@ > > COMPONENT= ${PORTNAME:tl:C/^lib//:C/mesa-//} > >-MESA_LLVM_VER=39 >+MESA_LLVM_VER=40 > > CONFIGURE_ARGS+= --with-sha1=libcrypto > >Index: files/patch-src_gallium_auxiliary_draw_draw_llvm.c >=================================================================== >--- files/patch-src_gallium_auxiliary_draw_draw_llvm.c (nonexistent) >+++ files/patch-src_gallium_auxiliary_draw_draw_llvm.c (working copy) >@@ -0,0 +1,22 @@ >+--- src/gallium/auxiliary/draw/draw_llvm.c.orig 2017-02-20 03:46:54.000000000 -0800 >++++ src/gallium/auxiliary/draw/draw_llvm.c 2017-03-24 11:18:24.753337000 -0700 >+@@ -1574,8 +1574,7 @@ draw_llvm_generate(struct draw_llvm *llv >+ LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); >+ for (i = 0; i < num_arg_types; ++i) >+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) >+- LLVMAddAttribute(LLVMGetParam(variant_func, i), >+- LLVMNoAliasAttribute); >++ lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS); >+ >+ context_ptr = LLVMGetParam(variant_func, 0); >+ io_ptr = LLVMGetParam(variant_func, 1); >+@@ -2189,8 +2188,7 @@ draw_gs_llvm_generate(struct draw_llvm * >+ >+ for (i = 0; i < ARRAY_SIZE(arg_types); ++i) >+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) >+- LLVMAddAttribute(LLVMGetParam(variant_func, i), >+- LLVMNoAliasAttribute); >++ lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS); >+ >+ context_ptr = LLVMGetParam(variant_func, 0); >+ input_array = LLVMGetParam(variant_func, 1); > >Property changes on: files/patch-src_gallium_auxiliary_draw_draw_llvm.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.c >=================================================================== >--- files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.c (nonexistent) >+++ files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.c (working copy) >@@ -0,0 +1,99 @@ >+--- src/gallium/auxiliary/gallivm/lp_bld_intr.c.orig 2017-03-24 14:07:46.566133000 -0700 >++++ src/gallium/auxiliary/gallivm/lp_bld_intr.c 2017-03-24 14:08:08.499367000 -0700 >+@@ -46,6 +46,7 @@ >+ >+ #include "util/u_debug.h" >+ #include "util/u_string.h" >++#include "util/bitscan.h" >+ >+ #include "lp_bld_const.h" >+ #include "lp_bld_intr.h" >+@@ -120,13 +121,73 @@ lp_declare_intrinsic(LLVMModuleRef modul >+ } >+ >+ >++#if HAVE_LLVM < 0x0400 >++static LLVMAttribute lp_attr_to_llvm_attr(enum lp_func_attr attr) >++{ >++ switch (attr) { >++ case LP_FUNC_ATTR_ALWAYSINLINE: return LLVMAlwaysInlineAttribute; >++ case LP_FUNC_ATTR_BYVAL: return LLVMByValAttribute; >++ case LP_FUNC_ATTR_INREG: return LLVMInRegAttribute; >++ case LP_FUNC_ATTR_NOALIAS: return LLVMNoAliasAttribute; >++ case LP_FUNC_ATTR_NOUNWIND: return LLVMNoUnwindAttribute; >++ case LP_FUNC_ATTR_READNONE: return LLVMReadNoneAttribute; >++ case LP_FUNC_ATTR_READONLY: return LLVMReadOnlyAttribute; >++ default: >++ _debug_printf("Unhandled function attribute: %x\n", attr); >++ return 0; >++ } >++} >++ >++#else >++ >++static const char *attr_to_str(enum lp_func_attr attr) >++{ >++ switch (attr) { >++ case LP_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline"; >++ case LP_FUNC_ATTR_BYVAL: return "byval"; >++ case LP_FUNC_ATTR_INREG: return "inreg"; >++ case LP_FUNC_ATTR_NOALIAS: return "noalias"; >++ case LP_FUNC_ATTR_NOUNWIND: return "nounwind"; >++ case LP_FUNC_ATTR_READNONE: return "readnone"; >++ case LP_FUNC_ATTR_READONLY: return "readonly"; >++ default: >++ _debug_printf("Unhandled function attribute: %x\n", attr); >++ return 0; >++ } >++} >++ >++#endif >++ >++void >++lp_add_function_attr(LLVMValueRef function, >++ int attr_idx, >++ enum lp_func_attr attr) >++{ >++ >++#if HAVE_LLVM < 0x0400 >++ LLVMAttribute llvm_attr = lp_attr_to_llvm_attr(attr); >++ if (attr_idx == -1) { >++ LLVMAddFunctionAttr(function, llvm_attr); >++ } else { >++ LLVMAddAttribute(LLVMGetParam(function, attr_idx - 1), llvm_attr); >++ } >++#else >++ LLVMContextRef context = LLVMGetModuleContext(LLVMGetGlobalParent(function)); >++ const char *attr_name = attr_to_str(attr); >++ unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name, >++ strlen(attr_name)); >++ LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(context, kind_id, 0); >++ LLVMAddAttributeAtIndex(function, attr_idx, llvm_attr); >++#endif >++} >++ >+ LLVMValueRef >+ lp_build_intrinsic(LLVMBuilderRef builder, >+ const char *name, >+ LLVMTypeRef ret_type, >+ LLVMValueRef *args, >+ unsigned num_args, >+- LLVMAttribute attr) >++ unsigned attr_mask) >+ { >+ LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder))); >+ LLVMValueRef function; >+@@ -148,7 +209,12 @@ lp_build_intrinsic(LLVMBuilderRef builde >+ /* NoUnwind indicates that the intrinsic never raises a C++ exception. >+ * Set it for all intrinsics. >+ */ >+- LLVMAddFunctionAttr(function, attr | LLVMNoUnwindAttribute); >++ attr_mask |= LP_FUNC_ATTR_NOUNWIND; >++ >++ while (attr_mask) { >++ enum lp_func_attr attr = 1 << u_bit_scan(&attr_mask); >++ lp_add_function_attr(function, -1, attr); >++ } >+ >+ if (gallivm_debug & GALLIVM_DEBUG_IR) { >+ lp_debug_dump_value(function); > >Property changes on: files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.h >=================================================================== >--- files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.h (nonexistent) >+++ files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.h (working copy) >@@ -0,0 +1,39 @@ >+--- src/gallium/auxiliary/gallivm/lp_bld_intr.h.orig 2017-02-20 03:46:54.000000000 -0800 >++++ src/gallium/auxiliary/gallivm/lp_bld_intr.h 2017-03-24 11:18:24.754156000 -0700 >+@@ -46,6 +46,16 @@ >+ */ >+ #define LP_MAX_FUNC_ARGS 32 >+ >++enum lp_func_attr { >++ LP_FUNC_ATTR_ALWAYSINLINE = (1 << 0), >++ LP_FUNC_ATTR_BYVAL = (1 << 1), >++ LP_FUNC_ATTR_INREG = (1 << 2), >++ LP_FUNC_ATTR_NOALIAS = (1 << 3), >++ LP_FUNC_ATTR_NOUNWIND = (1 << 4), >++ LP_FUNC_ATTR_READNONE = (1 << 5), >++ LP_FUNC_ATTR_READONLY = (1 << 6), >++ LP_FUNC_ATTR_LAST = (1 << 7) >++}; >+ >+ void >+ lp_format_intrinsic(char *name, >+@@ -60,13 +70,18 @@ lp_declare_intrinsic(LLVMModuleRef modul >+ LLVMTypeRef *arg_types, >+ unsigned num_args); >+ >++void >++lp_add_function_attr(LLVMValueRef function, >++ int attr_idx, >++ enum lp_func_attr attr); >++ >+ LLVMValueRef >+ lp_build_intrinsic(LLVMBuilderRef builder, >+ const char *name, >+ LLVMTypeRef ret_type, >+ LLVMValueRef *args, >+ unsigned num_args, >+- LLVMAttribute attr); >++ unsigned attr_mask); >+ >+ >+ LLVMValueRef > >Property changes on: files/patch-src_gallium_auxiliary_gallivm_lp_bld_intr.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_auxiliary_gallivm_lp_bld_sample_soa.c >=================================================================== >--- files/patch-src_gallium_auxiliary_gallivm_lp_bld_sample_soa.c (nonexistent) >+++ files/patch-src_gallium_auxiliary_gallivm_lp_bld_sample_soa.c (working copy) >@@ -0,0 +1,20 @@ >+--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c.orig 2017-02-20 03:46:54.000000000 -0800 >++++ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 2017-03-24 11:18:24.755867000 -0700 >+@@ -60,6 +60,7 @@ >+ #include "lp_bld_struct.h" >+ #include "lp_bld_quad.h" >+ #include "lp_bld_pack.h" >++#include "lp_bld_intr.h" >+ >+ >+ /** >+@@ -3316,7 +3317,8 @@ lp_build_sample_soa_func(struct gallivm_ >+ >+ for (i = 0; i < num_param; ++i) { >+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) { >+- LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute); >++ >++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS); >+ } >+ } >+ > >Property changes on: files/patch-src_gallium_auxiliary_gallivm_lp_bld_sample_soa.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_drivers_llvmpipe_lp_state_fs.c >=================================================================== >--- files/patch-src_gallium_drivers_llvmpipe_lp_state_fs.c (nonexistent) >+++ files/patch-src_gallium_drivers_llvmpipe_lp_state_fs.c (working copy) >@@ -0,0 +1,82 @@ >+--- src/gallium/drivers/llvmpipe/lp_state_fs.c.orig 2017-03-24 13:06:45.849265000 -0700 >++++ src/gallium/drivers/llvmpipe/lp_state_fs.c 2017-03-24 13:08:00.385629000 -0700 >+@@ -1,9 +1,9 @@ >+ /************************************************************************** >+- * >++ * >+ * Copyright 2009 VMware, Inc. >+ * Copyright 2007 VMware, Inc. >+ * All Rights Reserved. >+- * >++ * >+ * Permission is hereby granted, free of charge, to any person obtaining a >+ * copy of this software and associated documentation files (the >+ * "Software"), to deal in the Software without restriction, including >+@@ -11,11 +11,11 @@ >+ * distribute, sub license, and/or sell copies of the Software, and to >+ * permit persons to whom the Software is furnished to do so, subject to >+ * the following conditions: >+- * >++ * >+ * The above copyright notice and this permission notice (including the >+ * next paragraph) shall be included in all copies or substantial portions >+ * of the Software. >+- * >++ * >+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. >+@@ -23,7 +23,7 @@ >+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, >+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE >+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. >+- * >++ * >+ **************************************************************************/ >+ >+ /** >+@@ -2257,7 +2257,7 @@ generate_fragment(struct llvmpipe_contex >+ blend_type.width = 8; /* 8-bit ubyte values */ >+ blend_type.length = 16; /* 16 elements per vector */ >+ >+- /* >++ /* >+ * Generate the function prototype. Any change here must be reflected in >+ * lp_jit.h's lp_jit_frag_func function pointer type, and vice-versa. >+ */ >+@@ -2296,7 +2296,7 @@ generate_fragment(struct llvmpipe_contex >+ */ >+ for(i = 0; i < ARRAY_SIZE(arg_types); ++i) >+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) >+- LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute); >++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS); >+ >+ context_ptr = LLVMGetParam(function, 0); >+ x = LLVMGetParam(function, 1); >+@@ -2557,7 +2557,7 @@ dump_fs_variant_key(const struct lp_frag >+ void >+ lp_debug_fs_variant(const struct lp_fragment_shader_variant *variant) >+ { >+- debug_printf("llvmpipe: Fragment shader #%u variant #%u:\n", >++ debug_printf("llvmpipe: Fragment shader #%u variant #%u:\n", >+ variant->shader->no, variant->no); >+ tgsi_dump(variant->shader->base.tokens, 0); >+ dump_fs_variant_key(&variant->key); >+@@ -2632,7 +2632,7 @@ generate_variant(struct llvmpipe_context >+ } >+ >+ lp_jit_init_types(variant); >+- >++ >+ if (variant->jit_function[RAST_EDGE_TEST] == NULL) >+ generate_fragment(lp, shader, variant, RAST_EDGE_TEST); >+ >+@@ -3124,7 +3124,7 @@ make_variant_key(struct llvmpipe_context >+ * Update fragment shader state. This is called just prior to drawing >+ * something when some fragment-related state has changed. >+ */ >+-void >++void >+ llvmpipe_update_fs(struct llvmpipe_context *lp) >+ { >+ struct lp_fragment_shader *shader = lp->fs; > >Property changes on: files/patch-src_gallium_drivers_llvmpipe_lp_state_fs.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_drivers_llvmpipe_lp_state_setup.c >=================================================================== >--- files/patch-src_gallium_drivers_llvmpipe_lp_state_setup.c (nonexistent) >+++ files/patch-src_gallium_drivers_llvmpipe_lp_state_setup.c (working copy) >@@ -0,0 +1,93 @@ >+--- src/gallium/drivers/llvmpipe/lp_state_setup.c.orig 2017-03-24 13:06:45.848147000 -0700 >++++ src/gallium/drivers/llvmpipe/lp_state_setup.c 2017-03-24 13:07:39.073135000 -0700 >+@@ -110,7 +110,7 @@ store_coef(struct gallivm_state *gallivm >+ >+ >+ >+-static void >++static void >+ emit_constant_coef4(struct gallivm_state *gallivm, >+ struct lp_setup_args *args, >+ unsigned slot, >+@@ -125,7 +125,7 @@ emit_constant_coef4(struct gallivm_state >+ * Setup the fragment input attribute with the front-facing value. >+ * \param frontface is the triangle front facing? >+ */ >+-static void >++static void >+ emit_facing_coef(struct gallivm_state *gallivm, >+ struct lp_setup_args *args, >+ unsigned slot ) >+@@ -258,7 +258,7 @@ lp_do_offset_tri(struct gallivm_state *g >+ >+ /* mult = MAX2(dzdx, dzdy) * pgon_offset_scale */ >+ max = LLVMBuildFCmp(b, LLVMRealUGT, dzdx, dzdy, ""); >+- max_value = LLVMBuildSelect(b, max, dzdx, dzdy, "max"); >++ max_value = LLVMBuildSelect(b, max, dzdx, dzdy, "max"); >+ >+ mult = LLVMBuildFMul(b, max_value, >+ lp_build_const_float(gallivm, key->pgon_offset_scale), ""); >+@@ -392,7 +392,7 @@ load_attribute(struct gallivm_state *gal >+ * sometimes completely in case of tris covering a block fully, >+ * which obviously wouldn't work)). >+ */ >+-static void >++static void >+ emit_coef4( struct gallivm_state *gallivm, >+ struct lp_setup_args *args, >+ unsigned slot, >+@@ -434,7 +434,7 @@ emit_coef4( struct gallivm_state *galliv >+ } >+ >+ >+-static void >++static void >+ emit_linear_coef( struct gallivm_state *gallivm, >+ struct lp_setup_args *args, >+ unsigned slot, >+@@ -442,7 +442,7 @@ emit_linear_coef( struct gallivm_state * >+ { >+ /* nothing to do anymore */ >+ emit_coef4(gallivm, >+- args, slot, >++ args, slot, >+ attribv[0], >+ attribv[1], >+ attribv[2]); >+@@ -457,7 +457,7 @@ emit_linear_coef( struct gallivm_state * >+ * Later, when we compute the value at a particular fragment position we'll >+ * divide the interpolated value by the interpolated W at that fragment. >+ */ >+-static void >++static void >+ apply_perspective_corr( struct gallivm_state *gallivm, >+ struct lp_setup_args *args, >+ unsigned slot, >+@@ -559,7 +559,7 @@ emit_apply_cyl_wrap(struct gallivm_state >+ /** >+ * Compute the inputs-> dadx, dady, a0 values. >+ */ >+-static void >++static void >+ emit_tri_coef( struct gallivm_state *gallivm, >+ const struct lp_setup_variant_key *key, >+ struct lp_setup_args *args) >+@@ -624,8 +624,7 @@ set_noalias(LLVMBuilderRef builder, >+ int i; >+ for(i = 0; i < nr_args; ++i) >+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) >+- LLVMAddAttribute(LLVMGetParam(function, i), >+- LLVMNoAliasAttribute); >++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS); >+ } >+ >+ static void >+@@ -937,7 +936,7 @@ cull_setup_variants(struct llvmpipe_cont >+ * prior to drawing something when some fragment-related state has >+ * changed. >+ */ >+-void >++void >+ llvmpipe_update_setup(struct llvmpipe_context *lp) >+ { >+ struct lp_setup_variant_key *key = &lp->setup_variant.key; > >Property changes on: files/patch-src_gallium_drivers_llvmpipe_lp_state_setup.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_drivers_radeonsi_si_shader.c >=================================================================== >--- files/patch-src_gallium_drivers_radeonsi_si_shader.c (nonexistent) >+++ files/patch-src_gallium_drivers_radeonsi_si_shader.c (working copy) >@@ -0,0 +1,256 @@ >+--- src/gallium/drivers/radeonsi/si_shader.c.orig 2017-02-20 03:46:54.000000000 -0800 >++++ src/gallium/drivers/radeonsi/si_shader.c 2017-03-24 11:21:43.735415000 -0700 >+@@ -413,7 +413,7 @@ static void declare_input_vs( >+ args[2] = buffer_index; >+ input = lp_build_intrinsic(gallivm->builder, >+ "llvm.SI.vs.load.input", ctx->v4f32, args, 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* Break up the vec4 into individual components */ >+ for (chan = 0; chan < 4; chan++) { >+@@ -808,7 +808,7 @@ static LLVMValueRef build_buffer_load(st >+ type_names[func]); >+ >+ return lp_build_intrinsic(gallivm->builder, name, types[func], args, >+- ARRAY_SIZE(args), LLVMReadOnlyAttribute); >++ ARRAY_SIZE(args), LP_FUNC_ATTR_READONLY); >+ } else { >+ LLVMValueRef args[] = { >+ LLVMBuildBitCast(gallivm->builder, rsrc, ctx->v16i8, ""), >+@@ -839,7 +839,7 @@ static LLVMValueRef build_buffer_load(st >+ type_names[func], arg_type); >+ >+ return lp_build_intrinsic(gallivm->builder, name, types[func], args, >+- ARRAY_SIZE(args), LLVMReadOnlyAttribute); >++ ARRAY_SIZE(args), LP_FUNC_ATTR_READONLY); >+ } >+ } >+ >+@@ -1126,14 +1126,14 @@ static LLVMValueRef fetch_input_gs( >+ value = lp_build_intrinsic(gallivm->builder, >+ "llvm.SI.buffer.load.dword.i32.i32", >+ ctx->i32, args, 9, >+- LLVMReadOnlyAttribute); >++ LP_FUNC_ATTR_READONLY); >+ if (tgsi_type_is_64bit(type)) { >+ LLVMValueRef value2; >+ args[2] = lp_build_const_int32(gallivm, (param * 4 + swizzle + 1) * 256); >+ value2 = lp_build_intrinsic(gallivm->builder, >+ "llvm.SI.buffer.load.dword.i32.i32", >+ ctx->i32, args, 9, >+- LLVMReadOnlyAttribute); >++ LP_FUNC_ATTR_READONLY); >+ return si_llvm_emit_fetch_64bit(bld_base, type, >+ value, value2); >+ } >+@@ -1285,12 +1285,12 @@ static void interp_fs_input(struct si_sh >+ args[1] = attr_number; >+ front = lp_build_intrinsic(gallivm->builder, intr_name, >+ ctx->f32, args, args[3] ? 4 : 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ args[1] = back_attr_number; >+ back = lp_build_intrinsic(gallivm->builder, intr_name, >+ ctx->f32, args, args[3] ? 4 : 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ result[chan] = LLVMBuildSelect(gallivm->builder, >+ is_face_positive, >+@@ -1307,7 +1307,7 @@ static void interp_fs_input(struct si_sh >+ args[3] = interp_param; >+ result[0] = lp_build_intrinsic(gallivm->builder, intr_name, >+ ctx->f32, args, args[3] ? 4 : 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ result[1] = >+ result[2] = lp_build_const_float(gallivm, 0.0f); >+ result[3] = lp_build_const_float(gallivm, 1.0f); >+@@ -1322,7 +1322,7 @@ static void interp_fs_input(struct si_sh >+ args[3] = interp_param; >+ result[chan] = lp_build_intrinsic(gallivm->builder, intr_name, >+ ctx->f32, args, args[3] ? 4 : 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ } >+ } >+@@ -1463,18 +1463,18 @@ static LLVMValueRef get_thread_id(struct >+ >+ if (HAVE_LLVM < 0x0308) { >+ tid = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", >+- ctx->i32, NULL, 0, LLVMReadNoneAttribute); >++ ctx->i32, NULL, 0, LP_FUNC_ATTR_READNONE); >+ } else { >+ LLVMValueRef tid_args[2]; >+ tid_args[0] = lp_build_const_int32(gallivm, 0xffffffff); >+ tid_args[1] = lp_build_const_int32(gallivm, 0); >+ tid_args[1] = lp_build_intrinsic(gallivm->builder, >+ "llvm.amdgcn.mbcnt.lo", ctx->i32, >+- tid_args, 2, LLVMReadNoneAttribute); >++ tid_args, 2, LP_FUNC_ATTR_READNONE); >+ >+ tid = lp_build_intrinsic(gallivm->builder, >+ "llvm.amdgcn.mbcnt.hi", ctx->i32, >+- tid_args, 2, LLVMReadNoneAttribute); >++ tid_args, 2, LP_FUNC_ATTR_READNONE); >+ } >+ set_range_metadata(ctx, tid, 0, 64); >+ return tid; >+@@ -1491,7 +1491,7 @@ static LLVMValueRef buffer_load_const(st >+ LLVMValueRef args[2] = {resource, offset}; >+ >+ return lp_build_intrinsic(builder, "llvm.SI.load.const", ctx->f32, args, 2, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ >+ static LLVMValueRef load_sample_position(struct si_shader_context *radeon_bld, LLVMValueRef sample_id) >+@@ -1729,7 +1729,7 @@ static void declare_system_value( >+ value = lp_build_intrinsic(gallivm->builder, >+ "llvm.amdgcn.ps.live", >+ ctx->i1, NULL, 0, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ value = LLVMBuildNot(gallivm->builder, value, ""); >+ value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, ""); >+ break; >+@@ -1942,7 +1942,7 @@ static void si_llvm_init_export_args(str >+ packed = lp_build_intrinsic(base->gallivm->builder, >+ "llvm.SI.packf16", >+ ctx->i32, pack_args, 2, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ args[chan + 5] = >+ LLVMBuildBitCast(base->gallivm->builder, >+ packed, ctx->f32, ""); >+@@ -2087,7 +2087,7 @@ static LLVMValueRef si_scale_alpha_by_sa >+ >+ coverage = lp_build_intrinsic(gallivm->builder, "llvm.ctpop.i32", >+ ctx->i32, >+- &coverage, 1, LLVMReadNoneAttribute); >++ &coverage, 1, LP_FUNC_ATTR_READNONE); >+ >+ coverage = LLVMBuildUIToFP(gallivm->builder, coverage, >+ ctx->f32, ""); >+@@ -3668,7 +3668,7 @@ static void load_emit_buffer(struct si_s >+ emit_data->output[emit_data->chan] = lp_build_intrinsic( >+ builder, intrinsic_name, dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadOnlyAttribute); >++ LP_FUNC_ATTR_READONLY); >+ } >+ >+ static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx, >+@@ -3773,7 +3773,7 @@ static void load_emit( >+ lp_build_intrinsic( >+ builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadOnlyAttribute); >++ LP_FUNC_ATTR_READONLY); >+ } else { >+ get_image_intr_name("llvm.amdgcn.image.load", >+ emit_data->dst_type, /* vdata */ >+@@ -3785,7 +3785,7 @@ static void load_emit( >+ lp_build_intrinsic( >+ builder, intrinsic_name, emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadOnlyAttribute); >++ LP_FUNC_ATTR_READONLY); >+ } >+ } >+ >+@@ -4221,7 +4221,7 @@ static void resq_emit( >+ out = lp_build_intrinsic( >+ builder, "llvm.SI.getresinfo.i32", emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* Divide the number of layers by 6 to get the number of cubes. */ >+ if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY) { >+@@ -4455,7 +4455,7 @@ static void txq_emit(const struct lp_bui >+ emit_data->output[emit_data->chan] = lp_build_intrinsic( >+ base->gallivm->builder, "llvm.SI.getresinfo.i32", >+ emit_data->dst_type, emit_data->args, emit_data->arg_count, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* Divide the number of layers by 6 to get the number of cubes. */ >+ if (target == TGSI_TEXTURE_CUBE_ARRAY || >+@@ -4873,7 +4873,7 @@ static void si_lower_gather4_integer(str >+ emit_data->output[emit_data->chan] = >+ lp_build_intrinsic(builder, intr_name, emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ >+ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action, >+@@ -4897,7 +4897,7 @@ static void build_tex_intrinsic(const st >+ base->gallivm->builder, >+ "llvm.SI.vs.load.input", emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ return; >+ } >+ >+@@ -4974,7 +4974,7 @@ static void build_tex_intrinsic(const st >+ emit_data->output[emit_data->chan] = lp_build_intrinsic( >+ base->gallivm->builder, intr_name, emit_data->dst_type, >+ emit_data->args, emit_data->arg_count, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ >+ static void si_llvm_emit_txqs( >+@@ -5072,13 +5072,13 @@ static void si_llvm_emit_ddxy( >+ args[1] = val; >+ tl = lp_build_intrinsic(gallivm->builder, >+ "llvm.amdgcn.ds.bpermute", ctx->i32, >+- args, 2, LLVMReadNoneAttribute); >++ args, 2, LP_FUNC_ATTR_READNONE); >+ >+ args[0] = LLVMBuildMul(gallivm->builder, trbl_tid, >+ lp_build_const_int32(gallivm, 4), ""); >+ trbl = lp_build_intrinsic(gallivm->builder, >+ "llvm.amdgcn.ds.bpermute", ctx->i32, >+- args, 2, LLVMReadNoneAttribute); >++ args, 2, LP_FUNC_ATTR_READNONE); >+ } else { >+ LLVMValueRef store_ptr, load_ptr0, load_ptr1; >+ >+@@ -5261,7 +5261,7 @@ static void build_interp_intrinsic(const >+ emit_data->output[chan] = >+ lp_build_intrinsic(gallivm->builder, intr_name, >+ ctx->f32, args, args[3] ? 4 : 3, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ } >+ >+@@ -5446,10 +5446,10 @@ static void si_create_function(struct si >+ * SGPR spilling significantly. >+ */ >+ if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) { >+- LLVMAddAttribute(P, LLVMByValAttribute); >++ lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_BYVAL); >+ lp_add_attr_dereferenceable(P, UINT64_MAX); >+ } else >+- LLVMAddAttribute(P, LLVMInRegAttribute); >++ lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_INREG); >+ } >+ >+ if (ctx->screen->b.debug_flags & DBG_UNSAFE_MATH) { >+@@ -6395,7 +6395,7 @@ static int si_generate_gs_copy_shader(st >+ lp_build_intrinsic(gallivm->builder, >+ "llvm.SI.buffer.load.dword.i32.i32", >+ ctx->i32, args, 9, >+- LLVMReadOnlyAttribute), >++ LP_FUNC_ATTR_READONLY), >+ ctx->f32, ""); >+ } >+ } > >Property changes on: files/patch-src_gallium_drivers_radeonsi_si_shader.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_drivers_radeonsi_si_shader_tgsi_alu.c >=================================================================== >--- files/patch-src_gallium_drivers_radeonsi_si_shader_tgsi_alu.c (nonexistent) >+++ files/patch-src_gallium_drivers_radeonsi_si_shader_tgsi_alu.c (working copy) >@@ -0,0 +1,92 @@ >+--- src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c.orig 2017-02-20 03:46:54.000000000 -0800 >++++ src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c 2017-03-24 11:18:24.760067000 -0700 >+@@ -399,7 +399,7 @@ static void emit_frac(const struct lp_bu >+ >+ LLVMValueRef floor = lp_build_intrinsic(builder, intr, emit_data->dst_type, >+ &emit_data->args[0], 1, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ emit_data->output[emit_data->chan] = LLVMBuildFSub(builder, >+ emit_data->args[0], floor, ""); >+ } >+@@ -449,7 +449,7 @@ build_tgsi_intrinsic_nomem(const struct >+ emit_data->output[emit_data->chan] = >+ lp_build_intrinsic(base->gallivm->builder, action->intr_name, >+ emit_data->dst_type, emit_data->args, >+- emit_data->arg_count, LLVMReadNoneAttribute); >++ emit_data->arg_count, LP_FUNC_ATTR_READNONE); >+ } >+ >+ static void emit_bfi(const struct lp_build_tgsi_action *action, >+@@ -507,7 +507,7 @@ static void emit_bfe(const struct lp_bui >+ >+ bfe_sm5 = lp_build_intrinsic(builder, action->intr_name, >+ emit_data->dst_type, emit_data->args, >+- emit_data->arg_count, LLVMReadNoneAttribute); >++ emit_data->arg_count, LP_FUNC_ATTR_READNONE); >+ >+ /* Correct for GLSL semantics. */ >+ cond = LLVMBuildICmp(builder, LLVMIntUGE, emit_data->args[2], >+@@ -539,7 +539,7 @@ static void emit_lsb(const struct lp_bui >+ LLVMValueRef lsb = >+ lp_build_intrinsic(gallivm->builder, "llvm.cttz.i32", >+ emit_data->dst_type, args, ARRAY_SIZE(args), >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* TODO: We need an intrinsic to skip this conditional. */ >+ /* Check for zero: */ >+@@ -566,7 +566,7 @@ static void emit_umsb(const struct lp_bu >+ LLVMValueRef msb = >+ lp_build_intrinsic(builder, "llvm.ctlz.i32", >+ emit_data->dst_type, args, ARRAY_SIZE(args), >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* The HW returns the last bit index from MSB, but TGSI wants >+ * the index from LSB. Invert it by doing "31 - msb". */ >+@@ -593,7 +593,7 @@ static void emit_imsb(const struct lp_bu >+ LLVMValueRef msb = >+ lp_build_intrinsic(builder, "llvm.AMDGPU.flbit.i32", >+ emit_data->dst_type, &arg, 1, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ >+ /* The HW returns the last bit index from MSB, but TGSI wants >+ * the index from LSB. Invert it by doing "31 - msb". */ >+@@ -917,13 +917,13 @@ static LLVMValueRef build_cube_intrinsic >+ LLVMValueRef out[4]; >+ >+ out[0] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubetc", >+- f32, in, 3, LLVMReadNoneAttribute); >++ f32, in, 3, LP_FUNC_ATTR_READNONE); >+ out[1] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubesc", >+- f32, in, 3, LLVMReadNoneAttribute); >++ f32, in, 3, LP_FUNC_ATTR_READNONE); >+ out[2] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubema", >+- f32, in, 3, LLVMReadNoneAttribute); >++ f32, in, 3, LP_FUNC_ATTR_READNONE); >+ out[3] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubeid", >+- f32, in, 3, LLVMReadNoneAttribute); >++ f32, in, 3, LP_FUNC_ATTR_READNONE); >+ >+ return lp_build_gather_values(gallivm, out, 4); >+ } else { >+@@ -937,7 +937,7 @@ static LLVMValueRef build_cube_intrinsic >+ >+ return lp_build_intrinsic(gallivm->builder, "llvm.AMDGPU.cube", >+ LLVMTypeOf(vec), &vec, 1, >+- LLVMReadNoneAttribute); >++ LP_FUNC_ATTR_READNONE); >+ } >+ } >+ >+@@ -959,7 +959,7 @@ static void si_llvm_cube_to_2d_coords(st >+ lp_build_const_int32(gallivm, i), ""); >+ >+ coords[2] = lp_build_intrinsic(builder, "llvm.fabs.f32", >+- type, &coords[2], 1, LLVMReadNoneAttribute); >++ type, &coords[2], 1, LP_FUNC_ATTR_READNONE); >+ coords[2] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, coords[2]); >+ >+ mad_args[1] = coords[2]; > >Property changes on: files/patch-src_gallium_drivers_radeonsi_si_shader_tgsi_alu.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_state_trackers_clover_llvm_codegen_bitcode.cpp >=================================================================== >--- files/patch-src_gallium_state_trackers_clover_llvm_codegen_bitcode.cpp (nonexistent) >+++ files/patch-src_gallium_state_trackers_clover_llvm_codegen_bitcode.cpp (working copy) >@@ -0,0 +1,33 @@ >+--- src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp.orig 2017-03-24 14:45:44.224748000 -0700 >++++ src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 2017-03-24 14:50:20.817764000 -0700 >+@@ -32,12 +32,18 @@ >+ /// >+ >+ #include "llvm/codegen.hpp" >++#include "llvm/compat.hpp" >+ #include "llvm/metadata.hpp" >+ #include "core/error.hpp" >+ #include "util/algorithm.hpp" >+ >+ #include <map> >++#if HAVE_LLVM < 0x0400 >+ #include <llvm/Bitcode/ReaderWriter.h> >++#else >++#include <llvm/Bitcode/BitcodeReader.h> >++#include <llvm/Bitcode/BitcodeWriter.h> >++#endif >+ #include <llvm/Support/raw_ostream.h> >+ >+ using namespace clover; >+@@ -92,8 +98,9 @@ clover::llvm::parse_module_library(const >+ std::string &r_log) { >+ auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef( >+ as_string(m.secs[0].data), " "), ctx); >+- if (!mod) >+- fail(r_log, error(CL_INVALID_PROGRAM), mod.getError().message()); >++ compat::handle_module_error(mod, [&](const std::string &s) { >++ fail(r_log, error(CL_INVALID_PROGRAM), s); >++ }); >+ >+ return std::unique_ptr<::llvm::Module>(std::move(*mod)); >+ } > >Property changes on: files/patch-src_gallium_state_trackers_clover_llvm_codegen_bitcode.cpp >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src_gallium_state_trackers_clover_llvm_compat.hpp >=================================================================== >--- files/patch-src_gallium_state_trackers_clover_llvm_compat.hpp (nonexistent) >+++ files/patch-src_gallium_state_trackers_clover_llvm_compat.hpp (working copy) >@@ -0,0 +1,34 @@ >+--- src/gallium/state_trackers/clover/llvm/compat.hpp.orig 2017-03-24 14:48:10.921731000 -0700 >++++ src/gallium/state_trackers/clover/llvm/compat.hpp 2017-03-24 14:49:20.623489000 -0700 >+@@ -39,6 +39,11 @@ >+ #include <llvm/Linker/Linker.h> >+ #include <llvm/Transforms/IPO.h> >+ #include <llvm/Target/TargetMachine.h> >++#if HAVE_LLVM >= 0x0400 >++#include <llvm/Support/Error.h> >++#else >++#include <llvm/Support/ErrorOr.h> >++#endif >+ >+ #if HAVE_LLVM >= 0x0307 >+ #include <llvm/IR/LegacyPassManager.h> >+@@ -158,6 +163,19 @@ namespace clover { >+ #else >+ const auto default_reloc_model = ::llvm::Reloc::Default; >+ #endif >++ >++ template<typename M, typename F> void >++ handle_module_error(M &mod, const F &f) { >++#if HAVE_LLVM >= 0x0400 >++ if (::llvm::Error err = mod.takeError()) >++ ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase &eib) { >++ f(eib.message()); >++ }); >++#else >++ if (!mod) >++ f(mod.getError().message()); >++#endif >++ } >+ } >+ } >+ } > >Property changes on: files/patch-src_gallium_state_trackers_clover_llvm_compat.hpp >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 218196
: 181281