| ... | ... | @@ -776,8 +776,8 @@ static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, ZigType *operand_type |
| 776 | 776 | }; |
| 777 | 777 | |
| 778 | 778 | if (operand_type->id == ZigTypeIdVector) { |
| 779 | | sprintf(fn_name, "llvm.%s.with.overflow.v%" PRIu64 "i%" PRIu32, signed_str, |
| 780 | | operand_type->data.vector.len, int_type->data.integral.bit_count); |
| 779 | snprintf(fn_name, sizeof(fn_name), "llvm.%s.with.overflow.v%" PRIu64 "i%" PRIu32, signed_str, |
| 780 | operand_type->data.vector.len, int_type->data.integral.bit_count); |
| 781 | 781 | |
| 782 | 782 | LLVMTypeRef return_elem_types[] = { |
| 783 | 783 | get_llvm_type(g, operand_type), |
| ... | ... | @@ -789,7 +789,7 @@ static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, ZigType *operand_type |
| 789 | 789 | assert(LLVMGetIntrinsicID(fn_val)); |
| 790 | 790 | return fn_val; |
| 791 | 791 | } else { |
| 792 | | sprintf(fn_name, "llvm.%s.with.overflow.i%" PRIu32, signed_str, int_type->data.integral.bit_count); |
| 792 | snprintf(fn_name, sizeof(fn_name), "llvm.%s.with.overflow.i%" PRIu32, signed_str, int_type->data.integral.bit_count); |
| 793 | 793 | |
| 794 | 794 | LLVMTypeRef return_elem_types[] = { |
| 795 | 795 | get_llvm_type(g, operand_type), |
| ... | ... | @@ -882,9 +882,9 @@ static LLVMValueRef get_float_fn(CodeGen *g, ZigType *type_entry, ZigLLVMFnId fn |
| 882 | 882 | |
| 883 | 883 | char fn_name[64]; |
| 884 | 884 | if (is_vector) |
| 885 | | sprintf(fn_name, "llvm.%s.v%" PRIu32 "f%" PRIu32, name, key.data.floating.vector_len, key.data.floating.bit_count); |
| 885 | snprintf(fn_name, sizeof(fn_name), "llvm.%s.v%" PRIu32 "f%" PRIu32, name, key.data.floating.vector_len, key.data.floating.bit_count); |
| 886 | 886 | else |
| 887 | | sprintf(fn_name, "llvm.%s.f%" PRIu32, name, key.data.floating.bit_count); |
| 887 | snprintf(fn_name, sizeof(fn_name), "llvm.%s.f%" PRIu32, name, key.data.floating.bit_count); |
| 888 | 888 | LLVMTypeRef float_type_ref = get_llvm_type(g, type_entry); |
| 889 | 889 | LLVMTypeRef return_elem_types[3] = { float_type_ref, float_type_ref, float_type_ref }; |
| 890 | 890 | LLVMTypeRef fn_type = LLVMFunctionType(float_type_ref, return_elem_types, num_args, false); |
| ... | ... | @@ -1677,11 +1677,11 @@ static LLVMValueRef gen_soft_float_widen_or_shorten(CodeGen *g, ZigType *actual_ |
| 1677 | 1677 | |
| 1678 | 1678 | char fn_name[64]; |
| 1679 | 1679 | if (wanted_bits < actual_bits) { |
| 1680 | | sprintf(fn_name, "__trunc%sf%sf2", |
| 1680 | snprintf(fn_name, sizeof(fn_name), "__trunc%sf%sf2", |
| 1681 | 1681 | get_compiler_rt_type_abbrev(scalar_actual_type), |
| 1682 | 1682 | get_compiler_rt_type_abbrev(scalar_wanted_type)); |
| 1683 | 1683 | } else { |
| 1684 | | sprintf(fn_name, "__extend%sf%sf2", |
| 1684 | snprintf(fn_name, sizeof(fn_name), "__extend%sf%sf2", |
| 1685 | 1685 | get_compiler_rt_type_abbrev(scalar_actual_type), |
| 1686 | 1686 | get_compiler_rt_type_abbrev(scalar_wanted_type)); |
| 1687 | 1687 | } |
| ... | ... | @@ -3008,8 +3008,8 @@ static LLVMValueRef gen_soft_float_un_op(CodeGen *g, LLVMValueRef op, ZigType *o |
| 3008 | 3008 | ZigType *scalar_type = operand_type->id == ZigTypeIdVector ? operand_type->data.vector.elem_type : operand_type; |
| 3009 | 3009 | |
| 3010 | 3010 | char fn_name[64]; |
| 3011 | | sprintf(fn_name, "%s%s%s", libc_float_prefix(g, scalar_type), |
| 3012 | | float_un_op_to_name(op_id), libc_float_suffix(g, scalar_type)); |
| 3011 | snprintf(fn_name, sizeof(fn_name), "%s%s%s", libc_float_prefix(g, scalar_type), |
| 3012 | float_un_op_to_name(op_id), libc_float_suffix(g, scalar_type)); |
| 3013 | 3013 | LLVMValueRef func_ref = get_soft_float_fn(g, fn_name, 1, scalar_type->llvm_type, scalar_type->llvm_type); |
| 3014 | 3014 | |
| 3015 | 3015 | LLVMValueRef result; |
| ... | ... | @@ -3389,9 +3389,9 @@ static LLVMValueRef gen_soft_int_to_float_op(CodeGen *g, LLVMValueRef value_ref, |
| 3389 | 3389 | |
| 3390 | 3390 | char fn_name[64]; |
| 3391 | 3391 | if (is_signed) { |
| 3392 | | sprintf(fn_name, "__float%si%sf", int_compiler_rt_type_abbrev, float_compiler_rt_type_abbrev); |
| 3392 | snprintf(fn_name, sizeof(fn_name), "__float%si%sf", int_compiler_rt_type_abbrev, float_compiler_rt_type_abbrev); |
| 3393 | 3393 | } else { |
| 3394 | | sprintf(fn_name, "__floatun%si%sf", int_compiler_rt_type_abbrev, float_compiler_rt_type_abbrev); |
| 3394 | snprintf(fn_name, sizeof(fn_name), "__floatun%si%sf", int_compiler_rt_type_abbrev, float_compiler_rt_type_abbrev); |
| 3395 | 3395 | } |
| 3396 | 3396 | |
| 3397 | 3397 | int param_count = 1; |
| ... | ... | @@ -3439,9 +3439,9 @@ static LLVMValueRef gen_soft_float_to_int_op(CodeGen *g, LLVMValueRef value_ref, |
| 3439 | 3439 | |
| 3440 | 3440 | char fn_name[64]; |
| 3441 | 3441 | if (is_signed) { |
| 3442 | | sprintf(fn_name, "__fix%sf%si", float_compiler_rt_type_abbrev, int_compiler_rt_type_abbrev); |
| 3442 | snprintf(fn_name, sizeof(fn_name), "__fix%sf%si", float_compiler_rt_type_abbrev, int_compiler_rt_type_abbrev); |
| 3443 | 3443 | } else { |
| 3444 | | sprintf(fn_name, "__fixuns%sf%si", float_compiler_rt_type_abbrev, int_compiler_rt_type_abbrev); |
| 3444 | snprintf(fn_name, sizeof(fn_name), "__fixuns%sf%si", float_compiler_rt_type_abbrev, int_compiler_rt_type_abbrev); |
| 3445 | 3445 | } |
| 3446 | 3446 | |
| 3447 | 3447 | int param_count = 1; |
| ... | ... | @@ -3512,58 +3512,58 @@ static LLVMValueRef gen_soft_float_bin_op(CodeGen *g, LLVMValueRef op1_value, LL |
| 3512 | 3512 | zig_unreachable(); |
| 3513 | 3513 | case IrBinOpCmpEq: |
| 3514 | 3514 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3515 | | sprintf(fn_name, "__eq%sf2", compiler_rt_type_abbrev); |
| 3515 | snprintf(fn_name, sizeof(fn_name), "__eq%sf2", compiler_rt_type_abbrev); |
| 3516 | 3516 | res_icmp = EQ_ZERO; |
| 3517 | 3517 | break; |
| 3518 | 3518 | case IrBinOpCmpNotEq: |
| 3519 | 3519 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3520 | | sprintf(fn_name, "__ne%sf2", compiler_rt_type_abbrev); |
| 3520 | snprintf(fn_name, sizeof(fn_name), "__ne%sf2", compiler_rt_type_abbrev); |
| 3521 | 3521 | res_icmp = NE_ZERO; |
| 3522 | 3522 | break; |
| 3523 | 3523 | case IrBinOpCmpLessOrEq: |
| 3524 | 3524 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3525 | | sprintf(fn_name, "__le%sf2", compiler_rt_type_abbrev); |
| 3525 | snprintf(fn_name, sizeof(fn_name), "__le%sf2", compiler_rt_type_abbrev); |
| 3526 | 3526 | res_icmp = LE_ZERO; |
| 3527 | 3527 | break; |
| 3528 | 3528 | case IrBinOpCmpLessThan: |
| 3529 | 3529 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3530 | | sprintf(fn_name, "__le%sf2", compiler_rt_type_abbrev); |
| 3530 | snprintf(fn_name, sizeof(fn_name), "__le%sf2", compiler_rt_type_abbrev); |
| 3531 | 3531 | res_icmp = EQ_NEG; |
| 3532 | 3532 | break; |
| 3533 | 3533 | case IrBinOpCmpGreaterOrEq: |
| 3534 | 3534 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3535 | | sprintf(fn_name, "__ge%sf2", compiler_rt_type_abbrev); |
| 3535 | snprintf(fn_name, sizeof(fn_name), "__ge%sf2", compiler_rt_type_abbrev); |
| 3536 | 3536 | res_icmp = GE_ZERO; |
| 3537 | 3537 | break; |
| 3538 | 3538 | case IrBinOpCmpGreaterThan: |
| 3539 | 3539 | return_type = g->builtin_types.entry_i32->llvm_type; |
| 3540 | | sprintf(fn_name, "__ge%sf2", compiler_rt_type_abbrev); |
| 3540 | snprintf(fn_name, sizeof(fn_name), "__ge%sf2", compiler_rt_type_abbrev); |
| 3541 | 3541 | res_icmp = EQ_ONE; |
| 3542 | 3542 | break; |
| 3543 | 3543 | case IrBinOpMaximum: |
| 3544 | | sprintf(fn_name, "%sfmax%s", math_float_prefix, math_float_suffix); |
| 3544 | snprintf(fn_name, sizeof(fn_name), "%sfmax%s", math_float_prefix, math_float_suffix); |
| 3545 | 3545 | break; |
| 3546 | 3546 | case IrBinOpMinimum: |
| 3547 | | sprintf(fn_name, "%sfmin%s", math_float_prefix, math_float_suffix); |
| 3547 | snprintf(fn_name, sizeof(fn_name), "%sfmin%s", math_float_prefix, math_float_suffix); |
| 3548 | 3548 | break; |
| 3549 | 3549 | case IrBinOpMult: |
| 3550 | | sprintf(fn_name, "__mul%sf3", compiler_rt_type_abbrev); |
| 3550 | snprintf(fn_name, sizeof(fn_name), "__mul%sf3", compiler_rt_type_abbrev); |
| 3551 | 3551 | break; |
| 3552 | 3552 | case IrBinOpAdd: |
| 3553 | | sprintf(fn_name, "__add%sf3", compiler_rt_type_abbrev); |
| 3553 | snprintf(fn_name, sizeof(fn_name), "__add%sf3", compiler_rt_type_abbrev); |
| 3554 | 3554 | break; |
| 3555 | 3555 | case IrBinOpSub: |
| 3556 | | sprintf(fn_name, "__sub%sf3", compiler_rt_type_abbrev); |
| 3556 | snprintf(fn_name, sizeof(fn_name), "__sub%sf3", compiler_rt_type_abbrev); |
| 3557 | 3557 | break; |
| 3558 | 3558 | case IrBinOpDivUnspecified: |
| 3559 | 3559 | case IrBinOpDivExact: |
| 3560 | 3560 | case IrBinOpDivTrunc: |
| 3561 | 3561 | case IrBinOpDivFloor: |
| 3562 | | sprintf(fn_name, "__div%sf3", compiler_rt_type_abbrev); |
| 3562 | snprintf(fn_name, sizeof(fn_name), "__div%sf3", compiler_rt_type_abbrev); |
| 3563 | 3563 | break; |
| 3564 | 3564 | case IrBinOpRemRem: |
| 3565 | 3565 | case IrBinOpRemMod: |
| 3566 | | sprintf(fn_name, "%sfmod%s", math_float_prefix, math_float_suffix); |
| 3566 | snprintf(fn_name, sizeof(fn_name), "%sfmod%s", math_float_prefix, math_float_suffix); |
| 3567 | 3567 | break; |
| 3568 | 3568 | default: |
| 3569 | 3569 | zig_unreachable(); |
| ... | ... | @@ -5815,9 +5815,9 @@ static LLVMValueRef get_int_builtin_fn(CodeGen *g, ZigType *expr_type, BuiltinFn |
| 5815 | 5815 | |
| 5816 | 5816 | char llvm_name[64]; |
| 5817 | 5817 | if (is_vector) |
| 5818 | | sprintf(llvm_name, "llvm.%s.v%" PRIu32 "i%" PRIu32, fn_name, vector_len, int_type->data.integral.bit_count); |
| 5818 | snprintf(llvm_name, sizeof(llvm_name), "llvm.%s.v%" PRIu32 "i%" PRIu32, fn_name, vector_len, int_type->data.integral.bit_count); |
| 5819 | 5819 | else |
| 5820 | | sprintf(llvm_name, "llvm.%s.i%" PRIu32, fn_name, int_type->data.integral.bit_count); |
| 5820 | snprintf(llvm_name, sizeof(llvm_name), "llvm.%s.i%" PRIu32, fn_name, int_type->data.integral.bit_count); |
| 5821 | 5821 | LLVMTypeRef param_types[] = { |
| 5822 | 5822 | get_llvm_type(g, expr_type), |
| 5823 | 5823 | LLVMInt1Type(), |