diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-20 20:55:58 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-27 10:24:57 +0100 |
commit | f1242a897687eab3ab969cec280a2f7f9e4795ae (patch) | |
tree | 7f8491cdad8b235ed59908abdc328c4f61446a11 /src | |
parent | bedfa06eaf242a87c1b590f1504b8082d3d8ac1f (diff) |
amd/common: add new add_arg() helper for SGPRs/VGPRs arguments
The idea is to clean up the add arguments logic.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index b2fc5b091a8..78bb190be54 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -257,6 +257,30 @@ struct arg_info { uint8_t num_vgprs_used; }; +enum ac_arg_regfile { + ARG_SGPR, + ARG_VGPR, +}; + +static void +add_arg(struct arg_info *info, enum ac_arg_regfile regfile, LLVMTypeRef type, + LLVMValueRef *param_ptr) +{ + assert(info->count < MAX_ARGS); + + info->assign[info->count] = param_ptr; + info->types[info->count] = type; + info->count++; + + if (regfile == ARG_SGPR) { + info->num_sgprs_used += ac_get_type_size(type) / 4; + info->sgpr_count++; + } else { + assert(regfile == ARG_VGPR); + info->num_vgprs_used += ac_get_type_size(type) / 4; + } +} + static inline void add_argument(struct arg_info *info, LLVMTypeRef type, LLVMValueRef *param_ptr) |