aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-06-05 21:20:33 +0100
committerDave Airlie <[email protected]>2017-06-07 06:00:30 +0100
commit1ec4f008a2b5348828a4a2e48cd7129811ff3fe4 (patch)
treeb4d5a05b9de926178573d45d4c861f4d89e657e3 /src
parent7b46e2a74bfd7aa9616abeaf00d79f40a03f808d (diff)
ac/nir: move gpr counting inside argument handling.
This just moves this code in here to it's cleaner. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d9bf4ea4e53..8e8c57dbad7 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -260,6 +260,9 @@ struct arg_info {
uint8_t count;
uint8_t user_sgpr_count;
uint8_t sgpr_count;
+ uint8_t num_user_sgprs_used;
+ uint8_t num_sgprs_used;
+ uint8_t num_vgprs_used;
};
static inline void
@@ -277,6 +280,7 @@ add_sgpr_argument(struct arg_info *info,
LLVMTypeRef type, LLVMValueRef *param_ptr)
{
add_argument(info, type, param_ptr);
+ info->num_sgprs_used += llvm_get_type_size(type) / 4;
info->sgpr_count++;
}
@@ -286,6 +290,7 @@ add_user_sgpr_argument(struct arg_info *info,
LLVMValueRef *param_ptr)
{
add_sgpr_argument(info, type, param_ptr);
+ info->num_user_sgprs_used += llvm_get_type_size(type) / 4;
info->user_sgpr_count++;
}
@@ -295,6 +300,7 @@ add_vgpr_argument(struct arg_info *info,
LLVMValueRef *param_ptr)
{
add_argument(info, type, param_ptr);
+ info->num_vgprs_used += llvm_get_type_size(type) / 4;
}
static inline void
@@ -827,20 +833,16 @@ static void create_function(struct nir_to_llvm_context *ctx)
ctx->options->unsafe_math);
set_llvm_calling_convention(ctx->main_function, ctx->stage);
- ctx->shader_info->num_input_sgprs = 0;
- ctx->shader_info->num_input_vgprs = 0;
- ctx->shader_info->num_user_sgprs = ctx->options->supports_spill ? 2 : 0;
- for (i = 0; i < args.user_sgpr_count; i++)
- ctx->shader_info->num_user_sgprs += llvm_get_type_size(args.types[i]) / 4;
+ ctx->shader_info->num_input_vgprs = 0;
+ ctx->shader_info->num_input_sgprs = ctx->shader_info->num_user_sgprs =
+ ctx->options->supports_spill ? 2 : 0;
- ctx->shader_info->num_input_sgprs = ctx->shader_info->num_user_sgprs;
- for (; i < args.sgpr_count; i++)
- ctx->shader_info->num_input_sgprs += llvm_get_type_size(args.types[i]) / 4;
+ ctx->shader_info->num_user_sgprs += args.num_user_sgprs_used;
+ ctx->shader_info->num_input_sgprs += args.num_sgprs_used;
if (ctx->stage != MESA_SHADER_FRAGMENT)
- for (; i < args.count; ++i)
- ctx->shader_info->num_input_vgprs += llvm_get_type_size(args.types[i]) / 4;
+ ctx->shader_info->num_input_vgprs = args.num_vgprs_used;
assign_arguments(ctx->main_function, &args);