diff --git a/src/parsers/int_range.c b/src/parsers/int_range.c index 8d536f3b2afc8caeab72ffb05d6aa3802dfd37c7..7db3c32fde20ddfcd4cbd800afcda71341a8d51b 100644 --- a/src/parsers/int_range.c +++ b/src/parsers/int_range.c @@ -128,70 +128,36 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, /* The allocator */ HAllocator *mm__ = NULL; /* Names */ - char *ir_entry_name = NULL; - int ir_entry_name_len = 0; - char *ir_check_res_name = NULL; - int ir_check_res_name_len = 0; - char *ir_check_res_ast_name = NULL; - int ir_check_res_ast_name_len = 0; - char *ir_check_token_type_name = NULL; - int ir_check_token_type_name_len = 0; - char *ir_check_tt_uint_name = NULL; - int ir_check_tt_uint_name_len = 0; - char *ir_check_tt_sint_name = NULL; - int ir_check_tt_sint_name_len = 0; - char *ir_handle_tt_uint_name = NULL; - int ir_handle_tt_uint_name_len = 0; - char *ir_handle_tt_sint_name = NULL; - int ir_handle_tt_sint_name_len = 0; - char *ir_check_bounds_name = NULL; - int ir_check_bounds_name_len = 0; - char *ir_check_upper_bound_name = NULL; - int ir_check_upper_bound_name_len = 0; - char *ir_success_name = NULL; - int ir_success_name_len = 0; - char *ir_fail_name = NULL; - int ir_fail_name_len = 0; - char *ir_end_name = NULL; - int ir_end_name_len = 0; - char *inner_res_icmp_name = NULL; - int inner_res_icmp_name_len = 0; - char *ret_ast_ptr_name = NULL; - int ret_ast_ptr_name_len = 0; - char *ret_ast_name = NULL; - int ret_ast_name_len = 0; - char *ret_ast_icmp_name = NULL; - int ret_ast_icmp_name_len = 0; - char *token_type_ptr_name = NULL; - int token_type_ptr_name_len = 0; - char *token_type_name = NULL; - int token_type_name_len = 0; - char *token_length_ptr_name = NULL; - int token_length_ptr_name_len = 0; - char *token_length_name = NULL; - int token_length_name_len = 0; - char *token_data_ptr_name = NULL; - int token_data_ptr_name_len = 0; - char *token_data_name = NULL; - int token_data_name_len = 0; - char *tt_uint_icmp_name = NULL; - int tt_uint_icmp_name_len = 0; - char *tt_sint_icmp_name = NULL; - int tt_sint_icmp_name_len = 0; - char *lower_uint_icmp_name = NULL; - int lower_uint_icmp_name_len = 0; - char *lower_sint_icmp_name = NULL; - int lower_sint_icmp_name_len = 0; - char *lower_icmp_name = NULL; - int lower_icmp_name_len = 0; - char *upper_uint_icmp_name = NULL; - int upper_uint_icmp_name_len = 0; - char *upper_sint_icmp_name = NULL; - int upper_sint_icmp_name_len = 0; - char *upper_icmp_name = NULL; - int upper_icmp_name_len = 0; - char *rv_name = NULL; - int rv_name_len = 0; + H_LLVM_DECLARE_NAME(ir_entry); + H_LLVM_DECLARE_NAME(ir_check_res); + H_LLVM_DECLARE_NAME(ir_check_res_ast); + H_LLVM_DECLARE_NAME(ir_check_token_type); + H_LLVM_DECLARE_NAME(ir_check_tt_uint); + H_LLVM_DECLARE_NAME(ir_check_tt_sint); + H_LLVM_DECLARE_NAME(ir_handle_tt_uint); + H_LLVM_DECLARE_NAME(ir_handle_tt_sint); + H_LLVM_DECLARE_NAME(ir_check_bounds); + H_LLVM_DECLARE_NAME(ir_check_upper_bound); + H_LLVM_DECLARE_NAME(ir_success); + H_LLVM_DECLARE_NAME(ir_fail); + H_LLVM_DECLARE_NAME(ir_end); + H_LLVM_DECLARE_NAME(ir_inner_res_icmp); + H_LLVM_DECLARE_NAME(ir_ret_ast_ptr); + H_LLVM_DECLARE_NAME(ir_ret_ast); + H_LLVM_DECLARE_NAME(ir_ret_ast_icmp); + H_LLVM_DECLARE_NAME(ir_token_type_ptr); + H_LLVM_DECLARE_NAME(ir_token_type); + H_LLVM_DECLARE_NAME(ir_token_data_ptr); + H_LLVM_DECLARE_NAME(ir_token_data); + H_LLVM_DECLARE_NAME(ir_tt_uint_icmp); + H_LLVM_DECLARE_NAME(ir_tt_sint_icmp); + H_LLVM_DECLARE_NAME(ir_lower_uint_icmp); + H_LLVM_DECLARE_NAME(ir_lower_sint_icmp); + H_LLVM_DECLARE_NAME(ir_lower_icmp); + H_LLVM_DECLARE_NAME(ir_upper_uint_icmp); + H_LLVM_DECLARE_NAME(ir_upper_sint_icmp); + H_LLVM_DECLARE_NAME(ir_upper_icmp); + H_LLVM_DECLARE_NAME(ir_rv); /* The HRange */ HRange *r = NULL; /* Our status */ @@ -215,10 +181,6 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, LLVMValueRef token_type_ptr; /* Value of token type from ret->ast */ LLVMValueRef token_type; - /* Pointer to token length from ret->ast */ - LLVMValueRef token_length_ptr; - /* Value of token length from ret->ast */ - LLVMValueRef token_length; /* Pointer to token data from ret->ast */ LLVMValueRef token_data_ptr; /* Value of token data from ret->ast */ @@ -257,83 +219,37 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, if (!r) return false; /* Set up our basic blocks */ - ir_entry_name_len = snprintf(NULL, 0, "ir_entry_%p", p); - ir_entry_name = h_new(char, ir_entry_name_len + 1); - snprintf(ir_entry_name, ir_entry_name_len + 1, - "ir_entry_%p", p); + H_LLVM_COMPUTE_NAME(ir_entry, p); entry = LLVMAppendBasicBlock(ctxt->func, ir_entry_name); - ir_check_res_name_len = snprintf(NULL, 0, "ir_check_res_%p", p); - ir_check_res_name = h_new(char, ir_check_res_name_len + 1); - snprintf(ir_check_res_name, ir_check_res_name_len + 1, - "ir_check_res_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_res, p); check_res = LLVMAppendBasicBlock(ctxt->func, ir_check_res_name); - ir_check_res_ast_name_len = snprintf(NULL, 0, "ir_check_res_ast_%p", p); - ir_check_res_ast_name = h_new(char, ir_check_res_ast_name_len + 1); - snprintf(ir_check_res_ast_name, ir_check_res_ast_name_len + 1, - "ir_check_res_ast_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_res_ast, p); check_res_ast = LLVMAppendBasicBlock(ctxt->func, ir_check_res_ast_name); - ir_check_token_type_name_len = - snprintf(NULL, 0, "ir_check_token_type_%p", p); - ir_check_token_type_name = h_new(char, ir_check_token_type_name_len + 1); - snprintf(ir_check_token_type_name, ir_check_token_type_name_len + 1, - "ir_check_token_type_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_token_type, p); check_token_type = LLVMAppendBasicBlock(ctxt->func, ir_check_token_type_name); - ir_check_tt_uint_name_len = - snprintf(NULL, 0, "ir_check_tt_uint_%p", p); - ir_check_tt_uint_name = h_new(char, ir_check_tt_uint_name_len + 1); - snprintf(ir_check_tt_uint_name, ir_check_tt_uint_name_len + 1, - "ir_check_tt_uint_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_tt_uint, p); check_tt_uint = LLVMAppendBasicBlock(ctxt->func, ir_check_tt_uint_name); - ir_check_tt_sint_name_len = - snprintf(NULL, 0, "ir_check_tt_sint_%p", p); - ir_check_tt_sint_name = h_new(char, ir_check_tt_sint_name_len + 1); - snprintf(ir_check_tt_sint_name, ir_check_tt_sint_name_len + 1, - "ir_check_tt_sint_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_tt_sint, p); check_tt_sint = LLVMAppendBasicBlock(ctxt->func, ir_check_tt_sint_name); - ir_handle_tt_uint_name_len = - snprintf(NULL, 0, "ir_handle_tt_uint_%p", p); - ir_handle_tt_uint_name = h_new(char, ir_handle_tt_uint_name_len + 1); - snprintf(ir_handle_tt_uint_name, ir_handle_tt_uint_name_len + 1, - "ir_handle_tt_uint_%p", p); + H_LLVM_COMPUTE_NAME(ir_handle_tt_uint, p); handle_tt_uint = LLVMAppendBasicBlock(ctxt->func, ir_handle_tt_uint_name); - ir_handle_tt_sint_name_len = - snprintf(NULL, 0, "ir_handle_tt_sint_%p", p); - ir_handle_tt_sint_name = h_new(char, ir_handle_tt_sint_name_len + 1); - snprintf(ir_handle_tt_sint_name, ir_handle_tt_sint_name_len + 1, - "ir_handle_tt_sint_%p", p); + H_LLVM_COMPUTE_NAME(ir_handle_tt_sint, p); handle_tt_sint = LLVMAppendBasicBlock(ctxt->func, ir_handle_tt_sint_name); - ir_check_bounds_name_len = snprintf(NULL, 0, "ir_check_bounds_%p", p); - ir_check_bounds_name = h_new(char, ir_check_bounds_name_len + 1); - snprintf(ir_check_bounds_name, ir_check_bounds_name_len + 1, - "ir_check_bounds_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_bounds, p); check_bounds = LLVMAppendBasicBlock(ctxt->func, ir_check_bounds_name); - ir_check_upper_bound_name_len = - snprintf(NULL, 0, "ir_check_upper_bound_%p", p); - ir_check_upper_bound_name = - h_new(char, ir_check_upper_bound_name_len + 1); - snprintf(ir_check_upper_bound_name, ir_check_upper_bound_name_len + 1, - "ir_check_upper_bound_%p", p); + H_LLVM_COMPUTE_NAME(ir_check_upper_bound, p); check_upper_bound = LLVMAppendBasicBlock(ctxt->func, ir_check_upper_bound_name); - ir_success_name_len = snprintf(NULL, 0, "ir_success_%p", p); - ir_success_name = h_new(char, ir_success_name_len + 1); - snprintf(ir_success_name, ir_success_name_len + 1, - "ir_success_%p", p); + H_LLVM_COMPUTE_NAME(ir_success, p); success = LLVMAppendBasicBlock(ctxt->func, ir_success_name); - ir_fail_name_len = snprintf(NULL, 0, "ir_fail_%p", p); - ir_fail_name = h_new(char, ir_fail_name_len + 1); - snprintf(ir_fail_name, ir_fail_name_len + 1, - "ir_fail_%p", p); + H_LLVM_COMPUTE_NAME(ir_fail, p); fail = LLVMAppendBasicBlock(ctxt->func, ir_fail_name); - ir_end_name_len = snprintf(NULL, 0, "ir_end_%p", p); - ir_end_name = h_new(char, ir_end_name_len + 1); - snprintf(ir_end_name, ir_end_name_len + 1, - "ir_end_%p", p); + H_LLVM_COMPUTE_NAME(ir_end, p); end = LLVMAppendBasicBlock(ctxt->func, ir_end_name); /* Basic block: entry */ @@ -359,93 +275,60 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, /* Check that the result is not null */ LLVMPositionBuilderAtEnd(ctxt->builder, check_res); - inner_res_icmp_name_len = snprintf(NULL, 0, - "ir_inner_res_null_icmp_%p", p); - inner_res_icmp_name = h_new(char, inner_res_icmp_name_len + 1); - snprintf(inner_res_icmp_name, inner_res_icmp_name_len + 1, - "ir_inner_res_null_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_inner_res_icmp, p); inner_res_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntNE, inner_res, LLVMConstNull(ctxt->llvm_parseresultptr), - inner_res_icmp_name); + ir_inner_res_icmp_name); LLVMBuildCondBr(ctxt->builder, inner_res_icmp, check_res_ast, fail); /* First, get the AST pointer out */ LLVMPositionBuilderAtEnd(ctxt->builder, check_res_ast); - ret_ast_ptr_name_len = snprintf(NULL, 0, "ret_ast_ptr_%p", p); - ret_ast_ptr_name = h_new(char, ret_ast_ptr_name_len + 1); - snprintf(ret_ast_ptr_name, ret_ast_ptr_name_len + 1, - "ret_ast_ptr_%p", p); + H_LLVM_COMPUTE_NAME(ir_ret_ast_ptr, p); ret_ast_ptr = LLVMBuildStructGEP(ctxt->builder, inner_res, - 0, ret_ast_ptr_name); + 0, ir_ret_ast_ptr_name); /* Deref ret_ast_ptr */ - ret_ast_name_len = snprintf(NULL, 0, "ret_ast_%p", p); - ret_ast_name = h_new(char, ret_ast_name_len + 1); - snprintf(ret_ast_name, ret_ast_name_len + 1, - "ret_ast_%p", p); - ret_ast = LLVMBuildLoad(ctxt->builder, ret_ast_ptr, ret_ast_name); + H_LLVM_COMPUTE_NAME(ir_ret_ast, p); + ret_ast = LLVMBuildLoad(ctxt->builder, ret_ast_ptr, ir_ret_ast_name); /* Check that the AST pointer is not null */ - ret_ast_icmp_name_len = snprintf(NULL, 0, - "ir_ret_ast_null_icmp_%p", p); - ret_ast_icmp_name = h_new(char, ret_ast_icmp_name_len + 1); - snprintf(ret_ast_icmp_name, ret_ast_icmp_name_len + 1, - "ir_ret_ast_null_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_ret_ast_icmp, p); ret_ast_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntNE, ret_ast, LLVMConstNull(ctxt->llvm_parsedtokenptr), - ret_ast_icmp_name); + ir_ret_ast_icmp_name); LLVMBuildCondBr(ctxt->builder, ret_ast_icmp, check_token_type, fail); /* Holly shit, it's a real token! */ LLVMPositionBuilderAtEnd(ctxt->builder, check_token_type); - token_type_ptr_name_len = snprintf(NULL, 0, "ir_token_type_ptr_%p", p); - token_type_ptr_name = h_new(char, token_type_ptr_name_len + 1); - snprintf(token_type_ptr_name, token_type_ptr_name_len + 1, - "ir_token_type_ptr_%p", p); + H_LLVM_COMPUTE_NAME(ir_token_type_ptr, p); token_type_ptr = LLVMBuildStructGEP(ctxt->builder, ret_ast, - 0, token_type_ptr_name); - token_type_name_len = snprintf(NULL, 0, "ir_token_type_%p", p); - token_type_name = h_new(char, token_type_name_len + 1); - snprintf(token_type_name, token_type_name_len + 1, - "ir_token_type_%p", p); + 0, ir_token_type_ptr_name); + H_LLVM_COMPUTE_NAME(ir_token_type, p); token_type = - LLVMBuildLoad(ctxt->builder, token_type_ptr, token_type_name); - token_data_ptr_name_len = - snprintf(NULL, 0, "ir_token_data_ptr_%p", p); - token_data_ptr_name = h_new(char, token_data_ptr_name_len + 1); - snprintf(token_data_ptr_name, token_data_ptr_name_len + 1, - "ir_token_data_ptr_%p", p); + LLVMBuildLoad(ctxt->builder, token_type_ptr, ir_token_type_name); + H_LLVM_COMPUTE_NAME(ir_token_data_ptr, p); token_data_ptr = LLVMBuildStructGEP(ctxt->builder, ret_ast, - 1, token_data_ptr_name); - token_data_name_len = snprintf(NULL, 0, "ir_token_data_%p", p); - token_data_name = h_new(char, token_data_name_len + 1); - snprintf(token_data_name, token_data_name_len + 1, - "ir_token_data_%p", p); + 1, ir_token_data_ptr_name); + H_LLVM_COMPUTE_NAME(ir_token_data, p); token_data = - LLVMBuildLoad(ctxt->builder, token_data_ptr, token_data_name); + LLVMBuildLoad(ctxt->builder, token_data_ptr, ir_token_data_name); /* Now check if we have a TT_UINT */ LLVMBuildBr(ctxt->builder, check_tt_uint); /* Are we doing a TT_UINT? */ LLVMPositionBuilderAtEnd(ctxt->builder, check_tt_uint); - tt_uint_icmp_name_len = snprintf(NULL, 0, "ir_tt_uint_icmp_%p", p); - tt_uint_icmp_name = h_new(char, tt_uint_icmp_name_len + 1); - snprintf(tt_uint_icmp_name, tt_uint_icmp_name_len + 1, - "ir_tt_uint_null_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_tt_uint_icmp, p); tt_uint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntEQ, token_type, LLVMConstInt(LLVMInt32Type(), TT_UINT, 0), - tt_uint_icmp_name); + ir_tt_uint_icmp_name); LLVMBuildCondBr(ctxt->builder, tt_uint_icmp, handle_tt_uint, check_tt_sint); /* Are we doing a TT_SINT? */ LLVMPositionBuilderAtEnd(ctxt->builder, check_tt_sint); - tt_sint_icmp_name_len = snprintf(NULL, 0, "ir_tt_sint_icmp_%p", p); - tt_sint_icmp_name = h_new(char, tt_sint_icmp_name_len + 1); - snprintf(tt_sint_icmp_name, tt_sint_icmp_name_len + 1, - "ir_tt_sint_null_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_tt_sint_icmp, p); tt_sint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntEQ, token_type, LLVMConstInt(LLVMInt32Type(), TT_SINT, 0), - tt_sint_icmp_name); + ir_tt_sint_icmp_name); LLVMBuildCondBr(ctxt->builder, tt_sint_icmp, handle_tt_sint, fail); /* @@ -455,46 +338,30 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, /* Handle the TT_UINT case */ LLVMPositionBuilderAtEnd(ctxt->builder, handle_tt_uint); - lower_uint_icmp_name_len = - snprintf(NULL, 0, "lower_uint_icmp_%p", p); - lower_uint_icmp_name = h_new(char, lower_uint_icmp_name_len + 1); - snprintf(lower_uint_icmp_name, lower_uint_icmp_name_len + 1, - "lower_uint_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_lower_uint_icmp, p); lower_uint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntULT, token_data, LLVMConstInt(LLVMTypeOf(token_data), (uint64_t)(r->lower), 0), - lower_uint_icmp_name); - upper_uint_icmp_name_len = - snprintf(NULL, 0, "upper_uint_icmp_%p", p); - upper_uint_icmp_name = h_new(char, upper_uint_icmp_name_len + 1); - snprintf(upper_uint_icmp_name, upper_uint_icmp_name_len + 1, - "upper_uint_icmp_%p", p); + ir_lower_uint_icmp_name); + H_LLVM_COMPUTE_NAME(ir_upper_uint_icmp, p); upper_uint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntUGT, token_data, LLVMConstInt(LLVMTypeOf(token_data), (uint64_t)(r->upper), 0), - upper_uint_icmp_name); + ir_upper_uint_icmp_name); LLVMBuildBr(ctxt->builder, check_bounds); /* Handle the TT_SINT case */ LLVMPositionBuilderAtEnd(ctxt->builder, handle_tt_sint); - lower_sint_icmp_name_len = - snprintf(NULL, 0, "lower_sint_icmp_%p", p); - lower_sint_icmp_name = h_new(char, lower_sint_icmp_name_len + 1); - snprintf(lower_sint_icmp_name, lower_sint_icmp_name_len + 1, - "lower_sint_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_lower_sint_icmp, p); lower_sint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntSLT, token_data, LLVMConstInt(LLVMTypeOf(token_data), (int64_t)(r->lower), 0), - lower_sint_icmp_name); - upper_sint_icmp_name_len = - snprintf(NULL, 0, "upper_sint_icmp_%p", p); - upper_sint_icmp_name = h_new(char, upper_sint_icmp_name_len + 1); - snprintf(upper_sint_icmp_name, upper_sint_icmp_name_len + 1, - "upper_sint_icmp_%p", p); + ir_lower_sint_icmp_name); + H_LLVM_COMPUTE_NAME(ir_upper_sint_icmp, p); upper_sint_icmp = LLVMBuildICmp(ctxt->builder, LLVMIntSGT, token_data, LLVMConstInt(LLVMTypeOf(token_data), (int64_t)(r->upper), 0), - upper_sint_icmp_name); + ir_upper_sint_icmp_name); LLVMBuildBr(ctxt->builder, check_bounds); /* @@ -502,12 +369,9 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, * handle_tt_sint, so the icmps it uses are phis */ LLVMPositionBuilderAtEnd(ctxt->builder, check_bounds); - lower_icmp_name_len = snprintf(NULL, 0, "lower_icmp_%p", p); - lower_icmp_name = h_new(char, lower_icmp_name_len + 1); - snprintf(lower_icmp_name, lower_icmp_name_len + 1, - "lower_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_lower_icmp, p); lower_icmp = LLVMBuildPhi(ctxt->builder, - LLVMTypeOf(lower_uint_icmp), lower_icmp_name); + LLVMTypeOf(lower_uint_icmp), ir_lower_icmp_name); lower_icmp_incoming_blocks[0] = handle_tt_uint; lower_icmp_incoming_values[0] = lower_uint_icmp; lower_icmp_incoming_blocks[1] = handle_tt_sint; @@ -516,12 +380,9 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, lower_icmp_incoming_values, lower_icmp_incoming_blocks, 2); - upper_icmp_name_len = snprintf(NULL, 0, "upper_icmp_%p", p); - upper_icmp_name = h_new(char, upper_icmp_name_len + 1); - snprintf(upper_icmp_name, upper_icmp_name_len + 1, - "upper_icmp_%p", p); + H_LLVM_COMPUTE_NAME(ir_upper_icmp, p); upper_icmp = LLVMBuildPhi(ctxt->builder, - LLVMTypeOf(upper_uint_icmp), upper_icmp_name); + LLVMTypeOf(upper_uint_icmp), ir_upper_icmp_name); upper_icmp_incoming_blocks[0] = handle_tt_uint; upper_icmp_incoming_values[0] = upper_uint_icmp; upper_icmp_incoming_blocks[1] = handle_tt_sint; @@ -555,10 +416,8 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, * In end, phi for rv */ LLVMPositionBuilderAtEnd(ctxt->builder, end); - rv_name_len = snprintf(NULL, 0, "int_range_rv_%p", p); - rv_name = h_new(char, rv_name_len + 1); - snprintf(rv_name, rv_name_len + 1, "int_range_rv_%p", p); - rv = LLVMBuildPhi(ctxt->builder, ctxt->llvm_parseresultptr, rv_name); + H_LLVM_COMPUTE_NAME(ir_rv, p); + rv = LLVMBuildPhi(ctxt->builder, ctxt->llvm_parseresultptr, ir_rv_name); rv_phi_incoming_blocks[0] = success; rv_phi_incoming_values[0] = inner_res; rv_phi_incoming_blocks[1] = fail; @@ -576,156 +435,36 @@ static bool ir_llvm(HLLVMParserCompileContext *ctxt, } /* Free names */ - - if (ir_entry_name) { - h_free(ir_entry_name); - ir_entry_name = NULL; - } - - if (ir_check_res_name) { - h_free(ir_check_res_name); - ir_check_res_name = NULL; - } - - if (ir_check_res_ast_name) { - h_free(ir_check_res_ast_name); - ir_check_res_ast_name = NULL; - } - - if (ir_check_token_type_name) { - h_free(ir_check_token_type_name); - ir_check_token_type_name = NULL; - } - - if (ir_handle_tt_uint_name) { - h_free(ir_handle_tt_uint_name); - ir_handle_tt_uint_name = NULL; - } - - if (ir_handle_tt_sint_name) { - h_free(ir_handle_tt_sint_name); - ir_handle_tt_sint_name = NULL; - } - - if (ir_check_tt_uint_name) { - h_free(ir_check_tt_uint_name); - ir_check_tt_uint_name = NULL; - } - - if (ir_check_tt_sint_name) { - h_free(ir_check_tt_sint_name); - ir_check_tt_sint_name = NULL; - } - - if (ir_check_bounds_name) { - h_free(ir_check_bounds_name); - ir_check_bounds_name = NULL; - } - - if (ir_check_upper_bound_name) { - h_free(ir_check_upper_bound_name); - ir_check_upper_bound_name = NULL; - } - - if (ir_success_name) { - h_free(ir_success_name); - ir_success_name = NULL; - } - - if (ir_fail_name) { - h_free(ir_fail_name); - ir_fail_name = NULL; - } - - if (ir_end_name) { - h_free(ir_end_name); - ir_end_name = NULL; - } - - if (inner_res_icmp_name) { - h_free(inner_res_icmp_name); - inner_res_icmp_name = NULL; - } - - if (ret_ast_ptr_name) { - h_free(ret_ast_ptr_name); - ret_ast_ptr_name = NULL; - } - - if (ret_ast_name) { - h_free(ret_ast_name); - ret_ast_name = NULL; - } - - if (ret_ast_icmp_name) { - h_free(ret_ast_icmp_name); - ret_ast_icmp_name = NULL; - } - - if (token_type_ptr_name) { - h_free(token_type_ptr_name); - token_type_ptr_name = NULL; - } - - if (token_type_name) { - h_free(token_type_name); - token_type_name = NULL; - } - - if (token_data_ptr_name) { - h_free(token_data_ptr_name); - token_data_ptr_name = NULL; - } - - if (token_data_name) { - h_free(token_data_name); - token_data_name = NULL; - } - - if (tt_uint_icmp_name) { - h_free(tt_uint_icmp_name); - tt_uint_icmp_name = NULL; - } - - if (tt_sint_icmp_name) { - h_free(tt_sint_icmp_name); - tt_sint_icmp_name = NULL; - } - - if (lower_uint_icmp_name) { - h_free(lower_uint_icmp_name); - lower_uint_icmp_name = NULL; - } - - if (lower_sint_icmp_name) { - h_free(lower_sint_icmp_name); - lower_sint_icmp_name = NULL; - } - - if (lower_icmp_name) { - h_free(lower_icmp_name); - lower_icmp_name = NULL; - } - - if (upper_uint_icmp_name) { - h_free(upper_uint_icmp_name); - upper_uint_icmp_name = NULL; - } - - if (upper_sint_icmp_name) { - h_free(upper_sint_icmp_name); - upper_sint_icmp_name = NULL; - } - - if (upper_icmp_name) { - h_free(upper_icmp_name); - upper_icmp_name = NULL; - } - - if (rv_name) { - h_free(rv_name); - rv_name = NULL; - } + H_LLVM_FREE_NAME(ir_entry); + H_LLVM_FREE_NAME(ir_check_res); + H_LLVM_FREE_NAME(ir_check_res_ast); + H_LLVM_FREE_NAME(ir_check_token_type); + H_LLVM_FREE_NAME(ir_check_tt_uint); + H_LLVM_FREE_NAME(ir_check_tt_sint); + H_LLVM_FREE_NAME(ir_handle_tt_uint); + H_LLVM_FREE_NAME(ir_handle_tt_sint); + H_LLVM_FREE_NAME(ir_check_bounds); + H_LLVM_FREE_NAME(ir_check_upper_bound); + H_LLVM_FREE_NAME(ir_success); + H_LLVM_FREE_NAME(ir_fail); + H_LLVM_FREE_NAME(ir_end); + H_LLVM_FREE_NAME(ir_inner_res_icmp); + H_LLVM_FREE_NAME(ir_ret_ast_ptr); + H_LLVM_FREE_NAME(ir_ret_ast); + H_LLVM_FREE_NAME(ir_ret_ast_icmp); + H_LLVM_FREE_NAME(ir_token_type_ptr); + H_LLVM_FREE_NAME(ir_token_type); + H_LLVM_FREE_NAME(ir_token_data_ptr); + H_LLVM_FREE_NAME(ir_token_data); + H_LLVM_FREE_NAME(ir_tt_uint_icmp); + H_LLVM_FREE_NAME(ir_tt_sint_icmp); + H_LLVM_FREE_NAME(ir_lower_uint_icmp); + H_LLVM_FREE_NAME(ir_lower_sint_icmp); + H_LLVM_FREE_NAME(ir_lower_icmp); + H_LLVM_FREE_NAME(ir_upper_uint_icmp); + H_LLVM_FREE_NAME(ir_upper_sint_icmp); + H_LLVM_FREE_NAME(ir_upper_icmp); + H_LLVM_FREE_NAME(ir_rv); return status; }