From: Brian Paul Date: Mon, 25 Apr 2016 21:56:08 +0000 (-0600) Subject: gallivm: s/Elements/ARRAY_SIZE/ X-Git-Tag: upstream/17.1.0~10531 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e522a76226acfcf786457ce4472294d9e36adc94;p=platform%2Fupstream%2Fmesa.git gallivm: s/Elements/ARRAY_SIZE/ Reviewed-by: Jose Fonseca --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 17cf296..9c78837 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -3039,7 +3039,7 @@ lp_build_exp2(struct lp_build_context *bld, expipart = LLVMBuildBitCast(builder, expipart, vec_type, ""); expfpart = lp_build_polynomial(bld, fpart, lp_build_exp2_polynomial, - Elements(lp_build_exp2_polynomial)); + ARRAY_SIZE(lp_build_exp2_polynomial)); res = LLVMBuildFMul(builder, expipart, expfpart, ""); @@ -3237,7 +3237,7 @@ lp_build_log2_approx(struct lp_build_context *bld, /* compute P(z) */ logmant = lp_build_polynomial(bld, z, lp_build_log2_polynomial, - Elements(lp_build_log2_polynomial)); + ARRAY_SIZE(lp_build_log2_polynomial)); /* logmant = y * P(z) */ logmant = lp_build_mul(bld, y, logmant); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_assert.c b/src/gallium/auxiliary/gallivm/lp_bld_assert.c index 37c142b..0275576 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_assert.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_assert.c @@ -77,7 +77,7 @@ lp_build_assert(struct gallivm_state *gallivm, function = lp_build_const_func_pointer(gallivm, func_to_pointer((func_pointer)lp_assert), - ret_type, arg_types, Elements(arg_types), + ret_type, arg_types, ARRAY_SIZE(arg_types), "assert"); /* build function call param list */ @@ -88,5 +88,5 @@ lp_build_assert(struct gallivm_state *gallivm, assert(LLVMTypeOf(args[0]) == arg_types[0]); assert(LLVMTypeOf(args[1]) == arg_types[1]); - LLVMBuildCall(builder, function, args, Elements(args), ""); + LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), ""); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index b921e97..9f6b9e9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -579,7 +579,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, arg_types[2] = i32t; arg_types[3] = i32t; function_type = LLVMFunctionType(ret_type, arg_types, - Elements(arg_types), 0); + ARRAY_SIZE(arg_types), 0); /* make const pointer for the C fetch_rgba_8unorm function */ function = lp_build_const_int_pointer(gallivm, @@ -617,7 +617,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, args[3] = LLVMBuildExtractElement(builder, j, index, ""); } - LLVMBuildCall(builder, function, args, Elements(args), ""); + LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), ""); tmp = LLVMBuildLoad(builder, tmp_ptr, ""); @@ -686,7 +686,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, function = lp_build_const_func_pointer(gallivm, func_to_pointer((func_pointer) format_desc->fetch_rgba_float), ret_type, - arg_types, Elements(arg_types), + arg_types, ARRAY_SIZE(arg_types), format_desc->short_name); } @@ -714,7 +714,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, args[3] = LLVMBuildExtractElement(builder, j, index, ""); } - LLVMBuildCall(builder, function, args, Elements(args), ""); + LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), ""); tmps[k] = LLVMBuildLoad(builder, tmp_ptr, ""); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_cached.c b/src/gallium/auxiliary/gallivm/lp_bld_format_cached.c index b683e7f..e08062d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_cached.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_cached.c @@ -90,7 +90,7 @@ store_cached_block(struct gallivm_state *gallivm, indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_TAGS); indices[2] = hash_index; - ptr = LLVMBuildGEP(builder, cache, indices, Elements(indices), ""); + ptr = LLVMBuildGEP(builder, cache, indices, ARRAY_SIZE(indices), ""); LLVMBuildStore(builder, tag_value, ptr); indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_DATA); @@ -98,7 +98,7 @@ store_cached_block(struct gallivm_state *gallivm, lp_build_const_int32(gallivm, 16), ""); for (count = 0; count < 4; count++) { indices[2] = hash_index; - ptr = LLVMBuildGEP(builder, cache, indices, Elements(indices), ""); + ptr = LLVMBuildGEP(builder, cache, indices, ARRAY_SIZE(indices), ""); ptr = LLVMBuildBitCast(builder, ptr, type_ptr4x32, ""); LLVMBuildStore(builder, col[count], ptr); hash_index = LLVMBuildAdd(builder, hash_index, @@ -118,7 +118,7 @@ lookup_cached_pixel(struct gallivm_state *gallivm, indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_DATA); indices[2] = index; - member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), ""); + member_ptr = LLVMBuildGEP(builder, ptr, indices, ARRAY_SIZE(indices), ""); return LLVMBuildLoad(builder, member_ptr, "cache_data"); } @@ -134,7 +134,7 @@ lookup_tag_data(struct gallivm_state *gallivm, indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_TAGS); indices[2] = index; - member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), ""); + member_ptr = LLVMBuildGEP(builder, ptr, indices, ARRAY_SIZE(indices), ""); return LLVMBuildLoad(builder, member_ptr, "tag_data"); } @@ -181,7 +181,7 @@ update_cached_block(struct gallivm_state *gallivm, arg_types[2] = i32t; arg_types[3] = i32t; function_type = LLVMFunctionType(ret_type, arg_types, - Elements(arg_types), 0); + ARRAY_SIZE(arg_types), 0); /* make const pointer for the C fetch_rgba_8unorm function */ function = lp_build_const_int_pointer(gallivm, @@ -217,7 +217,7 @@ update_cached_block(struct gallivm_state *gallivm, args[1] = ptr_addr; args[2] = LLVMConstInt(i32t, i, 0); args[3] = LLVMConstInt(i32t, j, 0); - LLVMBuildCall(builder, function, args, Elements(args), ""); + LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), ""); } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index 620aece..a26cc48 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -395,7 +395,7 @@ lp_build_select(struct lp_build_context *bld, args[2] = mask; res = lp_build_intrinsic(builder, intrinsic, - arg_type, args, Elements(args), 0); + arg_type, args, ARRAY_SIZE(args), 0); if (arg_type != bld->vec_type) { res = LLVMBuildBitCast(builder, res, bld->vec_type, ""); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c index d80c997..35b4c58 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c @@ -164,7 +164,7 @@ lp_build_extract_range(struct gallivm_state *gallivm, LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; unsigned i; - assert(size <= Elements(elems)); + assert(size <= ARRAY_SIZE(elems)); for (i = 0; i < size; ++i) elems[i] = lp_build_const_int32(gallivm, i + start); @@ -193,7 +193,7 @@ lp_build_concat(struct gallivm_state *gallivm, LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH/2]; LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH]; - assert(src_type.length * num_vectors <= Elements(shuffles)); + assert(src_type.length * num_vectors <= ARRAY_SIZE(shuffles)); assert(util_is_power_of_two(num_vectors)); new_length = src_type.length; @@ -881,7 +881,7 @@ lp_build_pad_vector(struct gallivm_state *gallivm, undef = LLVMGetUndef(type); src_length = LLVMGetVectorSize(type); - assert(dst_length <= Elements(elems)); + assert(dst_length <= ARRAY_SIZE(elems)); assert(dst_length >= src_length); if (src_length == dst_length) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 69d829e..14131b3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -199,7 +199,7 @@ lp_build_printf(struct gallivm_state *gallivm, int i; argcount = lp_get_printf_arg_count(fmt); - assert(Elements(params) >= argcount + 1); + assert(ARRAY_SIZE(params) >= argcount + 1); va_start(arglist, fmt); for (i = 1; i <= argcount; i++) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.c b/src/gallium/auxiliary/gallivm/lp_bld_struct.c index 0df4416..067740b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_struct.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.c @@ -54,7 +54,7 @@ lp_build_struct_get_ptr(struct gallivm_state *gallivm, assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind); indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = lp_build_const_int32(gallivm, member); - member_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), ""); + member_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, ARRAY_SIZE(indices), ""); lp_build_name(member_ptr, "%s.%s_ptr", LLVMGetValueName(ptr), name); return member_ptr; } @@ -88,7 +88,7 @@ lp_build_array_get_ptr(struct gallivm_state *gallivm, assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = index; - element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), ""); + element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, ARRAY_SIZE(indices), ""); #ifdef DEBUG lp_build_name(element_ptr, "&%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index)); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c index 906a174..f8f43a5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c @@ -67,14 +67,14 @@ analyse_src(struct analysis_context *ctx, if (!src->Indirect && !src->Absolute && !src->Negate) { unsigned swizzle = tgsi_util_get_src_register_swizzle(src, chan); if (src->File == TGSI_FILE_TEMPORARY) { - if (src->Index < Elements(ctx->temp)) { + if (src->Index < ARRAY_SIZE(ctx->temp)) { *chan_info = ctx->temp[src->Index][swizzle]; } } else { chan_info->file = src->File; if (src->File == TGSI_FILE_IMMEDIATE) { - assert(src->Index < Elements(ctx->imm)); - if (src->Index < Elements(ctx->imm)) { + assert(src->Index < ARRAY_SIZE(ctx->imm)); + if (src->Index < ARRAY_SIZE(ctx->imm)) { chan_info->u.value = ctx->imm[src->Index][swizzle]; } } else { @@ -110,7 +110,7 @@ analyse_tex(struct analysis_context *ctx, struct lp_tgsi_info *info = ctx->info; unsigned chan; - if (info->num_texs < Elements(info->tex)) { + if (info->num_texs < ARRAY_SIZE(info->tex)) { struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs]; boolean indirect = FALSE; unsigned readmask = 0; @@ -206,7 +206,7 @@ analyse_sample(struct analysis_context *ctx, struct lp_tgsi_info *info = ctx->info; unsigned chan; - if (info->num_texs < Elements(info->tex)) { + if (info->num_texs < ARRAY_SIZE(info->tex)) { struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs]; unsigned target = ctx->sample_target[inst->Src[1].Register.Index]; boolean indirect = FALSE; @@ -301,10 +301,10 @@ analyse_instruction(struct analysis_context *ctx, if (dst->File == TGSI_FILE_TEMPORARY) { regs = ctx->temp; - max_regs = Elements(ctx->temp); + max_regs = ARRAY_SIZE(ctx->temp); } else if (dst->File == TGSI_FILE_OUTPUT) { regs = info->output; - max_regs = Elements(info->output); + max_regs = ARRAY_SIZE(info->output); } else if (dst->File == TGSI_FILE_ADDRESS || dst->File == TGSI_FILE_PREDICATE) { continue; @@ -580,7 +580,7 @@ lp_build_tgsi_info(const struct tgsi_token *tokens, const unsigned size = parse.FullToken.FullImmediate.Immediate.NrTokens - 1; assert(size <= 4); - if (ctx->num_imms < Elements(ctx->imm)) { + if (ctx->num_imms < ARRAY_SIZE(ctx->imm)) { for (chan = 0; chan < size; ++chan) { float value = parse.FullToken.FullImmediate.u[chan].Float; ctx->imm[ctx->num_imms][chan] = value;