diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index 33b6c12962c3..542171c39c7f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -302,6 +302,678 @@ RValue CIRGenFunction::buildRotate(const CallExpr *E, bool IsRotateRight) { return RValue::get(r); } +/// Get builtin name for unhandled BuiltinID in the function +/// `CIRGenFunction::buildBuiltinExpr`. Thoese builtin names are handled +/// in OG code `CodeGenFunction::EmitBuiltinExpr`. +/// NOTE: Every time we implement handling of a case in +/// the function `CIRGenFunction::buildBuiltinExpr`, it should be remove here. +static std::string getUnhandledBuiltinName(unsigned builtinID) { + switch (builtinID) { + default: + return std::string(); + case Builtin::BI__builtin_acos: + return "Builtin::BI__builtin_acos"; + case Builtin::BI__builtin_acosf: + return "Builtin::BI__builtin_acosf"; + case Builtin::BI__builtin_acosf16: + return "Builtin::BI__builtin_acosf16"; + case Builtin::BI__builtin_acosl: + return "Builtin::BI__builtin_acosl"; + case Builtin::BI__builtin_acosf128: + return "Builtin::BI__builtin_acosf128"; + case Builtin::BI__builtin_asin: + return "Builtin::BI__builtin_asin"; + case Builtin::BI__builtin_asinf: + return "Builtin::BI__builtin_asinf"; + case Builtin::BI__builtin_asinf16: + return "Builtin::BI__builtin_asinf16"; + case Builtin::BI__builtin_asinl: + return "Builtin::BI__builtin_asinl"; + case Builtin::BI__builtin_asinf128: + return "Builtin::BI__builtin_asinf128"; + case Builtin::BI__builtin_atan: + return "Builtin::BI__builtin_atan"; + case Builtin::BI__builtin_atanf: + return "Builtin::BI__builtin_atanf"; + case Builtin::BI__builtin_atanf16: + return "Builtin::BI__builtin_atanf16"; + case Builtin::BI__builtin_atanl: + return "Builtin::BI__builtin_atanl"; + case Builtin::BI__builtin_atanf128: + return "Builtin::BI__builtin_atanf128"; + case Builtin::BI__builtin_cosh: + return "Builtin::BI__builtin_cosh"; + case Builtin::BI__builtin_coshf: + return "Builtin::BI__builtin_coshf"; + case Builtin::BI__builtin_coshf16: + return "Builtin::BI__builtin_coshf16"; + case Builtin::BI__builtin_coshl: + return "Builtin::BI__builtin_coshl"; + case Builtin::BI__builtin_coshf128: + return "Builtin::BI__builtin_coshf128"; + case Builtin::BI__builtin_exp10: + return "Builtin::BI__builtin_exp10"; + case Builtin::BI__builtin_exp10f: + return "Builtin::BI__builtin_exp10f"; + case Builtin::BI__builtin_exp10f16: + return "Builtin::BI__builtin_exp10f16"; + case Builtin::BI__builtin_exp10l: + return "Builtin::BI__builtin_exp10l"; + case Builtin::BI__builtin_exp10f128: + return "Builtin::BI__builtin_exp10f128"; + case Builtin::BI__builtin_elementwise_fmod: + return "Builtin::BI__builtin_elementwise_fmod"; + case Builtin::BI__builtin_roundeven: + return "Builtin::BI__builtin_roundeven"; + case Builtin::BI__builtin_roundevenf: + return "Builtin::BI__builtin_roundevenf"; + case Builtin::BI__builtin_roundevenf16: + return "Builtin::BI__builtin_roundevenf16"; + case Builtin::BI__builtin_roundevenl: + return "Builtin::BI__builtin_roundevenl"; + case Builtin::BI__builtin_roundevenf128: + return "Builtin::BI__builtin_roundevenf128"; + case Builtin::BI__builtin_sinh: + return "Builtin::BI__builtin_sinh"; + case Builtin::BI__builtin_sinhf: + return "Builtin::BI__builtin_sinhf"; + case Builtin::BI__builtin_sinhf16: + return "Builtin::BI__builtin_sinhf16"; + case Builtin::BI__builtin_sinhl: + return "Builtin::BI__builtin_sinhl"; + case Builtin::BI__builtin_sinhf128: + return "Builtin::BI__builtin_sinhf128"; + case Builtin::BI__builtin_elementwise_sqrt: + return "Builtin::BI__builtin_elementwise_sqrt"; + case Builtin::BI__builtin_tan: + return "Builtin::BI__builtin_tan"; + case Builtin::BI__builtin_tanf: + return "Builtin::BI__builtin_tanf"; + case Builtin::BI__builtin_tanf16: + return "Builtin::BI__builtin_tanf16"; + case Builtin::BI__builtin_tanl: + return "Builtin::BI__builtin_tanl"; + case Builtin::BI__builtin_tanf128: + return "Builtin::BI__builtin_tanf128"; + case Builtin::BI__builtin_tanh: + return "Builtin::BI__builtin_tanh"; + case Builtin::BI__builtin_tanhf: + return "Builtin::BI__builtin_tanhf"; + case Builtin::BI__builtin_tanhf16: + return "Builtin::BI__builtin_tanhf16"; + case Builtin::BI__builtin_tanhl: + return "Builtin::BI__builtin_tanhl"; + case Builtin::BI__builtin_tanhf128: + return "Builtin::BI__builtin_tanhf128"; + case Builtin::BI__builtin_ldexp: + return "Builtin::BI__builtin_ldexp"; + case Builtin::BI__builtin_ldexpf: + return "Builtin::BI__builtin_ldexpf"; + case Builtin::BI__builtin_ldexpl: + return "Builtin::BI__builtin_ldexpl"; + case Builtin::BI__builtin_ldexpf16: + return "Builtin::BI__builtin_ldexpf16"; + case Builtin::BI__builtin_ldexpf128: + return "Builtin::BI__builtin_ldexpf128"; + case Builtin::BI__builtin_abs: + return "Builtin::BI__builtin_abs"; + case Builtin::BI__builtin_labs: + return "Builtin::BI__builtin_labs"; + case Builtin::BI__builtin_llabs: + return "Builtin::BI__builtin_llabs"; + case Builtin::BI__builtin_preserve_access_index: + return "Builtin::BI__builtin_preserve_access_index"; + case Builtin::BI__lzcnt16: + return "Builtin::BI__lzcnt16"; + case Builtin::BI__lzcnt: + return "Builtin::BI__lzcnt"; + case Builtin::BI__lzcnt64: + return "Builtin::BI__lzcnt64"; + case Builtin::BI__builtin_allow_runtime_check: + return "Builtin::BI__builtin_allow_runtime_check"; + case Builtin::BI__arithmetic_fence: + return "Builtin::BI__arithmetic_fence"; + case Builtin::BI__builtin_bitreverse8: + return "Builtin::BI__builtin_bitreverse8"; + case Builtin::BI__builtin_bitreverse16: + return "Builtin::BI__builtin_bitreverse16"; + case Builtin::BI__builtin_bitreverse32: + return "Builtin::BI__builtin_bitreverse32"; + case Builtin::BI__builtin_bitreverse64: + return "Builtin::BI__builtin_bitreverse64"; + case Builtin::BI__builtin_readcyclecounter: + return "Builtin::BI__builtin_readcyclecounter"; + case Builtin::BI__builtin_readsteadycounter: + return "Builtin::BI__builtin_readsteadycounter"; + case Builtin::BI__builtin_verbose_trap: + return "Builtin::BI__builtin_verbose_trap"; + case Builtin::BI__debugbreak: + return "Builtin::BI__debugbreak"; + case Builtin::BI__builtin_powi: + return "Builtin::BI__builtin_powi"; + case Builtin::BI__builtin_powif: + return "Builtin::BI__builtin_powif"; + case Builtin::BI__builtin_powil: + return "Builtin::BI__builtin_powil"; + case Builtin::BI__builtin_frexpl: + return "Builtin::BI__builtin_frexpl"; + case Builtin::BI__builtin_frexp: + return "Builtin::BI__builtin_frexp"; + case Builtin::BI__builtin_frexpf: + return "Builtin::BI__builtin_frexpf"; + case Builtin::BI__builtin_frexpf128: + return "Builtin::BI__builtin_frexpf128"; + case Builtin::BI__builtin_frexpf16: + return "Builtin::BI__builtin_frexpf16"; + case Builtin::BI__builtin_isgreater: + return "Builtin::BI__builtin_isgreater"; + case Builtin::BI__builtin_isgreaterequal: + return "Builtin::BI__builtin_isgreaterequal"; + case Builtin::BI__builtin_isless: + return "Builtin::BI__builtin_isless"; + case Builtin::BI__builtin_islessequal: + return "Builtin::BI__builtin_islessequal"; + case Builtin::BI__builtin_islessgreater: + return "Builtin::BI__builtin_islessgreater"; + case Builtin::BI__builtin_isunordered: + return "Builtin::BI__builtin_isunordered"; + case Builtin::BI__builtin_isnan: + return "Builtin::BI__builtin_isnan"; + case Builtin::BI__builtin_issignaling: + return "Builtin::BI__builtin_issignaling"; + case Builtin::BI__builtin_isinf: + return "Builtin::BI__builtin_isinf"; + case Builtin::BI__finite: + return "Builtin::BI__finite"; + case Builtin::BI__finitef: + return "Builtin::BI__finitef"; + case Builtin::BI__finitel: + return "Builtin::BI__finitel"; + case Builtin::BI__builtin_isfinite: + return "Builtin::BI__builtin_isfinite"; + case Builtin::BI__builtin_isnormal: + return "Builtin::BI__builtin_isnormal"; + case Builtin::BI__builtin_issubnormal: + return "Builtin::BI__builtin_issubnormal"; + case Builtin::BI__builtin_iszero: + return "Builtin::BI__builtin_iszero"; + case Builtin::BI__builtin_isfpclass: + return "Builtin::BI__builtin_isfpclass"; + case Builtin::BI__builtin_nondeterministic_value: + return "Builtin::BI__builtin_nondeterministic_value"; + case Builtin::BI__builtin_elementwise_abs: + return "Builtin::BI__builtin_elementwise_abs"; + case Builtin::BI__builtin_elementwise_acos: + return "Builtin::BI__builtin_elementwise_acos"; + case Builtin::BI__builtin_elementwise_asin: + return "Builtin::BI__builtin_elementwise_asin"; + case Builtin::BI__builtin_elementwise_atan: + return "Builtin::BI__builtin_elementwise_atan"; + case Builtin::BI__builtin_elementwise_atan2: + return "Builtin::BI__builtin_elementwise_atan2"; + case Builtin::BI__builtin_elementwise_ceil: + return "Builtin::BI__builtin_elementwise_ceil"; + case Builtin::BI__builtin_elementwise_exp: + return "Builtin::BI__builtin_elementwise_exp"; + case Builtin::BI__builtin_elementwise_exp2: + return "Builtin::BI__builtin_elementwise_exp2"; + case Builtin::BI__builtin_elementwise_log: + return "Builtin::BI__builtin_elementwise_log"; + case Builtin::BI__builtin_elementwise_log2: + return "Builtin::BI__builtin_elementwise_log2"; + case Builtin::BI__builtin_elementwise_log10: + return "Builtin::BI__builtin_elementwise_log10"; + case Builtin::BI__builtin_elementwise_pow: + return "Builtin::BI__builtin_elementwise_pow"; + case Builtin::BI__builtin_elementwise_bitreverse: + return "Builtin::BI__builtin_elementwise_bitreverse"; + case Builtin::BI__builtin_elementwise_cos: + return "Builtin::BI__builtin_elementwise_cos"; + case Builtin::BI__builtin_elementwise_cosh: + return "Builtin::BI__builtin_elementwise_cosh"; + case Builtin::BI__builtin_elementwise_floor: + return "Builtin::BI__builtin_elementwise_floor"; + case Builtin::BI__builtin_elementwise_popcount: + return "Builtin::BI__builtin_elementwise_popcount"; + case Builtin::BI__builtin_elementwise_roundeven: + return "Builtin::BI__builtin_elementwise_roundeven"; + case Builtin::BI__builtin_elementwise_round: + return "Builtin::BI__builtin_elementwise_round"; + case Builtin::BI__builtin_elementwise_rint: + return "Builtin::BI__builtin_elementwise_rint"; + case Builtin::BI__builtin_elementwise_nearbyint: + return "Builtin::BI__builtin_elementwise_nearbyint"; + case Builtin::BI__builtin_elementwise_sin: + return "Builtin::BI__builtin_elementwise_sin"; + case Builtin::BI__builtin_elementwise_sinh: + return "Builtin::BI__builtin_elementwise_sinh"; + case Builtin::BI__builtin_elementwise_tan: + return "Builtin::BI__builtin_elementwise_tan"; + case Builtin::BI__builtin_elementwise_tanh: + return "Builtin::BI__builtin_elementwise_tanh"; + case Builtin::BI__builtin_elementwise_trunc: + return "Builtin::BI__builtin_elementwise_trunc"; + case Builtin::BI__builtin_elementwise_canonicalize: + return "Builtin::BI__builtin_elementwise_canonicalize"; + case Builtin::BI__builtin_elementwise_copysign: + return "Builtin::BI__builtin_elementwise_copysign"; + case Builtin::BI__builtin_elementwise_fma: + return "Builtin::BI__builtin_elementwise_fma"; + case Builtin::BI__builtin_elementwise_add_sat: + return "Builtin::BI__builtin_elementwise_add_sat"; + case Builtin::BI__builtin_elementwise_sub_sat: + return "Builtin::BI__builtin_elementwise_sub_sat"; + case Builtin::BI__builtin_elementwise_max: + return "Builtin::BI__builtin_elementwise_max"; + case Builtin::BI__builtin_elementwise_min: + return "Builtin::BI__builtin_elementwise_min"; + case Builtin::BI__builtin_elementwise_maximum: + return "Builtin::BI__builtin_elementwise_maximum"; + case Builtin::BI__builtin_elementwise_minimum: + return "Builtin::BI__builtin_elementwise_minimum"; + case Builtin::BI__builtin_reduce_max: + return "Builtin::BI__builtin_reduce_max"; + case Builtin::BI__builtin_reduce_min: + return "Builtin::BI__builtin_reduce_min"; + case Builtin::BI__builtin_reduce_add: + return "Builtin::BI__builtin_reduce_add"; + case Builtin::BI__builtin_reduce_mul: + return "Builtin::BI__builtin_reduce_mul"; + case Builtin::BI__builtin_reduce_xor: + return "Builtin::BI__builtin_reduce_xor"; + case Builtin::BI__builtin_reduce_or: + return "Builtin::BI__builtin_reduce_or"; + case Builtin::BI__builtin_reduce_and: + return "Builtin::BI__builtin_reduce_and"; + case Builtin::BI__builtin_reduce_maximum: + return "Builtin::BI__builtin_reduce_maximum"; + case Builtin::BI__builtin_reduce_minimum: + return "Builtin::BI__builtin_reduce_minimum"; + case Builtin::BI__builtin_matrix_transpose: + return "Builtin::BI__builtin_matrix_transpose"; + case Builtin::BI__builtin_matrix_column_major_load: + return "Builtin::BI__builtin_matrix_column_major_load"; + case Builtin::BI__builtin_matrix_column_major_store: + return "Builtin::BI__builtin_matrix_column_major_store"; + case Builtin::BI__builtin_isinf_sign: + return "Builtin::BI__builtin_isinf_sign"; + case Builtin::BI__builtin_flt_rounds: + return "Builtin::BI__builtin_flt_rounds"; + case Builtin::BI__builtin_set_flt_rounds: + return "Builtin::BI__builtin_set_flt_rounds"; + case Builtin::BI__builtin_fpclassify: + return "Builtin::BI__builtin_fpclassify"; + case Builtin::BI__builtin_alloca_with_align_uninitialized: + return "Builtin::BI__builtin_alloca_with_align_uninitialized"; + case Builtin::BI__builtin_alloca_with_align: + return "Builtin::BI__builtin_alloca_with_align"; + case Builtin::BI__builtin_bzero: + return "Builtin::BI__builtin_bzero"; + case Builtin::BI__builtin_bcopy: + return "Builtin::BI__builtin_bcopy"; + case Builtin::BI__builtin_memcpy_inline: + return "Builtin::BI__builtin_memcpy_inline"; + case Builtin::BI__builtin_char_memchr: + return "Builtin::BI__builtin_char_memchr"; + case Builtin::BI__builtin___memcpy_chk: + return "Builtin::BI__builtin___memcpy_chk"; + case Builtin::BI__builtin_objc_memmove_collectable: + return "Builtin::BI__builtin_objc_memmove_collectable"; + case Builtin::BI__builtin___memmove_chk: + return "Builtin::BI__builtin___memmove_chk"; + case Builtin::BI__builtin_memmove: + return "Builtin::BI__builtin_memmove"; + case Builtin::BI__builtin_memset: + return "Builtin::BI__builtin_memset"; + case Builtin::BI__builtin_memset_inline: + return "Builtin::BI__builtin_memset_inline"; + case Builtin::BI__builtin___memset_chk: + return "Builtin::BI__builtin___memset_chk"; + case Builtin::BI__builtin_wmemchr: + return "Builtin::BI__builtin_wmemchr"; + case Builtin::BI__builtin_wmemcmp: + return "Builtin::BI__builtin_wmemcmp"; + case Builtin::BI__builtin_dwarf_cfa: + return "Builtin::BI__builtin_dwarf_cfa"; + case Builtin::BI__builtin_return_address: + return "Builtin::BI__builtin_return_address"; + case Builtin::BI__builtin_frame_address: + return "Builtin::BI__builtin_frame_address"; + case Builtin::BI__builtin_extract_return_addr: + return "Builtin::BI__builtin_extract_return_addr"; + case Builtin::BI__builtin_frob_return_addr: + return "Builtin::BI__builtin_frob_return_addr"; + case Builtin::BI__builtin_dwarf_sp_column: + return "Builtin::BI__builtin_dwarf_sp_column"; + case Builtin::BI__builtin_init_dwarf_reg_size_table: + return "Builtin::BI__builtin_init_dwarf_reg_size_table"; + case Builtin::BI__builtin_eh_return: + return "Builtin::BI__builtin_eh_return"; + case Builtin::BI__builtin_unwind_init: + return "Builtin::BI__builtin_unwind_init"; + case Builtin::BI__builtin_extend_pointer: + return "Builtin::BI__builtin_extend_pointer"; + case Builtin::BI__builtin_setjmp: + return "Builtin::BI__builtin_setjmp"; + case Builtin::BI__builtin_longjmp: + return "Builtin::BI__builtin_longjmp"; + case Builtin::BI__builtin_launder: + return "Builtin::BI__builtin_launder"; + case Builtin::BI__sync_fetch_and_or: + return "Builtin::BI__sync_fetch_and_or"; + case Builtin::BI__sync_fetch_and_and: + return "Builtin::BI__sync_fetch_and_and"; + case Builtin::BI__sync_fetch_and_xor: + return "Builtin::BI__sync_fetch_and_xor"; + case Builtin::BI__sync_fetch_and_nand: + return "Builtin::BI__sync_fetch_and_nand"; + case Builtin::BI__sync_add_and_fetch: + return "Builtin::BI__sync_add_and_fetch"; + case Builtin::BI__sync_sub_and_fetch: + return "Builtin::BI__sync_sub_and_fetch"; + case Builtin::BI__sync_and_and_fetch: + return "Builtin::BI__sync_and_and_fetch"; + case Builtin::BI__sync_or_and_fetch: + return "Builtin::BI__sync_or_and_fetch"; + case Builtin::BI__sync_xor_and_fetch: + return "Builtin::BI__sync_xor_and_fetch"; + case Builtin::BI__sync_nand_and_fetch: + return "Builtin::BI__sync_nand_and_fetch"; + case Builtin::BI__sync_val_compare_and_swap: + return "Builtin::BI__sync_val_compare_and_swap"; + case Builtin::BI__sync_bool_compare_and_swap: + return "Builtin::BI__sync_bool_compare_and_swap"; + case Builtin::BI__sync_lock_test_and_set: + return "Builtin::BI__sync_lock_test_and_set"; + case Builtin::BI__sync_lock_release: + return "Builtin::BI__sync_lock_release"; + case Builtin::BI__sync_swap: + return "Builtin::BI__sync_swap"; + case Builtin::BI__sync_fetch_and_or_1: + return "Builtin::BI__sync_fetch_and_or_1"; + case Builtin::BI__sync_fetch_and_or_2: + return "Builtin::BI__sync_fetch_and_or_2"; + case Builtin::BI__sync_fetch_and_or_4: + return "Builtin::BI__sync_fetch_and_or_4"; + case Builtin::BI__sync_fetch_and_or_8: + return "Builtin::BI__sync_fetch_and_or_8"; + case Builtin::BI__sync_fetch_and_or_16: + return "Builtin::BI__sync_fetch_and_or_16"; + case Builtin::BI__sync_fetch_and_and_1: + return "Builtin::BI__sync_fetch_and_and_1"; + case Builtin::BI__sync_fetch_and_and_2: + return "Builtin::BI__sync_fetch_and_and_2"; + case Builtin::BI__sync_fetch_and_and_4: + return "Builtin::BI__sync_fetch_and_and_4"; + case Builtin::BI__sync_fetch_and_and_8: + return "Builtin::BI__sync_fetch_and_and_8"; + case Builtin::BI__sync_fetch_and_and_16: + return "Builtin::BI__sync_fetch_and_and_16"; + case Builtin::BI__sync_fetch_and_xor_1: + return "Builtin::BI__sync_fetch_and_xor_1"; + case Builtin::BI__sync_fetch_and_xor_2: + return "Builtin::BI__sync_fetch_and_xor_2"; + case Builtin::BI__sync_fetch_and_xor_4: + return "Builtin::BI__sync_fetch_and_xor_4"; + case Builtin::BI__sync_fetch_and_xor_8: + return "Builtin::BI__sync_fetch_and_xor_8"; + case Builtin::BI__sync_fetch_and_xor_16: + return "Builtin::BI__sync_fetch_and_xor_16"; + case Builtin::BI__sync_fetch_and_nand_1: + return "Builtin::BI__sync_fetch_and_nand_1"; + case Builtin::BI__sync_fetch_and_nand_2: + return "Builtin::BI__sync_fetch_and_nand_2"; + case Builtin::BI__sync_fetch_and_nand_4: + return "Builtin::BI__sync_fetch_and_nand_4"; + case Builtin::BI__sync_fetch_and_nand_8: + return "Builtin::BI__sync_fetch_and_nand_8"; + case Builtin::BI__sync_fetch_and_nand_16: + return "Builtin::BI__sync_fetch_and_nand_16"; + case Builtin::BI__sync_fetch_and_min: + return "Builtin::BI__sync_fetch_and_min"; + case Builtin::BI__sync_fetch_and_max: + return "Builtin::BI__sync_fetch_and_max"; + case Builtin::BI__sync_fetch_and_umin: + return "Builtin::BI__sync_fetch_and_umin"; + case Builtin::BI__sync_fetch_and_umax: + return "Builtin::BI__sync_fetch_and_umax"; + case Builtin::BI__sync_add_and_fetch_1: + return "Builtin::BI__sync_add_and_fetch_1"; + case Builtin::BI__sync_add_and_fetch_2: + return "Builtin::BI__sync_add_and_fetch_2"; + case Builtin::BI__sync_add_and_fetch_4: + return "Builtin::BI__sync_add_and_fetch_4"; + case Builtin::BI__sync_add_and_fetch_8: + return "Builtin::BI__sync_add_and_fetch_8"; + case Builtin::BI__sync_add_and_fetch_16: + return "Builtin::BI__sync_add_and_fetch_16"; + case Builtin::BI__sync_sub_and_fetch_1: + return "Builtin::BI__sync_sub_and_fetch_1"; + case Builtin::BI__sync_sub_and_fetch_2: + return "Builtin::BI__sync_sub_and_fetch_2"; + case Builtin::BI__sync_sub_and_fetch_4: + return "Builtin::BI__sync_sub_and_fetch_4"; + case Builtin::BI__sync_sub_and_fetch_8: + return "Builtin::BI__sync_sub_and_fetch_8"; + case Builtin::BI__sync_sub_and_fetch_16: + return "Builtin::BI__sync_sub_and_fetch_16"; + case Builtin::BI__sync_and_and_fetch_1: + return "Builtin::BI__sync_and_and_fetch_1"; + case Builtin::BI__sync_and_and_fetch_2: + return "Builtin::BI__sync_and_and_fetch_2"; + case Builtin::BI__sync_and_and_fetch_4: + return "Builtin::BI__sync_and_and_fetch_4"; + case Builtin::BI__sync_and_and_fetch_8: + return "Builtin::BI__sync_and_and_fetch_8"; + case Builtin::BI__sync_and_and_fetch_16: + return "Builtin::BI__sync_and_and_fetch_16"; + case Builtin::BI__sync_or_and_fetch_1: + return "Builtin::BI__sync_or_and_fetch_1"; + case Builtin::BI__sync_or_and_fetch_2: + return "Builtin::BI__sync_or_and_fetch_2"; + case Builtin::BI__sync_or_and_fetch_4: + return "Builtin::BI__sync_or_and_fetch_4"; + case Builtin::BI__sync_or_and_fetch_8: + return "Builtin::BI__sync_or_and_fetch_8"; + case Builtin::BI__sync_or_and_fetch_16: + return "Builtin::BI__sync_or_and_fetch_16"; + case Builtin::BI__sync_xor_and_fetch_1: + return "Builtin::BI__sync_xor_and_fetch_1"; + case Builtin::BI__sync_xor_and_fetch_2: + return "Builtin::BI__sync_xor_and_fetch_2"; + case Builtin::BI__sync_xor_and_fetch_4: + return "Builtin::BI__sync_xor_and_fetch_4"; + case Builtin::BI__sync_xor_and_fetch_8: + return "Builtin::BI__sync_xor_and_fetch_8"; + case Builtin::BI__sync_xor_and_fetch_16: + return "Builtin::BI__sync_xor_and_fetch_16"; + case Builtin::BI__sync_nand_and_fetch_1: + return "Builtin::BI__sync_nand_and_fetch_1"; + case Builtin::BI__sync_nand_and_fetch_2: + return "Builtin::BI__sync_nand_and_fetch_2"; + case Builtin::BI__sync_nand_and_fetch_4: + return "Builtin::BI__sync_nand_and_fetch_4"; + case Builtin::BI__sync_nand_and_fetch_8: + return "Builtin::BI__sync_nand_and_fetch_8"; + case Builtin::BI__sync_nand_and_fetch_16: + return "Builtin::BI__sync_nand_and_fetch_16"; + case Builtin::BI__sync_swap_1: + return "Builtin::BI__sync_swap_1"; + case Builtin::BI__sync_swap_2: + return "Builtin::BI__sync_swap_2"; + case Builtin::BI__sync_swap_4: + return "Builtin::BI__sync_swap_4"; + case Builtin::BI__sync_swap_8: + return "Builtin::BI__sync_swap_8"; + case Builtin::BI__sync_swap_16: + return "Builtin::BI__sync_swap_16"; + case Builtin::BI__sync_lock_test_and_set_1: + return "Builtin::BI__sync_lock_test_and_set_1"; + case Builtin::BI__sync_lock_test_and_set_2: + return "Builtin::BI__sync_lock_test_and_set_2"; + case Builtin::BI__sync_lock_test_and_set_4: + return "Builtin::BI__sync_lock_test_and_set_4"; + case Builtin::BI__sync_lock_test_and_set_8: + return "Builtin::BI__sync_lock_test_and_set_8"; + case Builtin::BI__sync_lock_test_and_set_16: + return "Builtin::BI__sync_lock_test_and_set_16"; + case Builtin::BI__sync_lock_release_1: + return "Builtin::BI__sync_lock_release_1"; + case Builtin::BI__sync_lock_release_2: + return "Builtin::BI__sync_lock_release_2"; + case Builtin::BI__sync_lock_release_4: + return "Builtin::BI__sync_lock_release_4"; + case Builtin::BI__sync_lock_release_8: + return "Builtin::BI__sync_lock_release_8"; + case Builtin::BI__sync_lock_release_16: + return "Builtin::BI__sync_lock_release_16"; + case Builtin::BI__sync_synchronize: + return "Builtin::BI__sync_synchronize"; + case Builtin::BI__builtin_nontemporal_load: + return "Builtin::BI__builtin_nontemporal_load"; + case Builtin::BI__builtin_nontemporal_store: + return "Builtin::BI__builtin_nontemporal_store"; + case Builtin::BI__c11_atomic_is_lock_free: + return "Builtin::BI__c11_atomic_is_lock_free"; + case Builtin::BI__atomic_is_lock_free: + return "Builtin::BI__atomic_is_lock_free"; + case Builtin::BI__atomic_test_and_set: + return "Builtin::BI__atomic_test_and_set"; + case Builtin::BI__atomic_clear: + return "Builtin::BI__atomic_clear"; + case Builtin::BI__atomic_thread_fence: + return "Builtin::BI__atomic_thread_fence"; + case Builtin::BI__atomic_signal_fence: + return "Builtin::BI__atomic_signal_fence"; + case Builtin::BI__c11_atomic_thread_fence: + return "Builtin::BI__c11_atomic_thread_fence"; + case Builtin::BI__c11_atomic_signal_fence: + return "Builtin::BI__c11_atomic_signal_fence"; + case Builtin::BI__builtin_signbit: + return "Builtin::BI__builtin_signbit"; + case Builtin::BI__builtin_signbitf: + return "Builtin::BI__builtin_signbitf"; + case Builtin::BI__builtin_signbitl: + return "Builtin::BI__builtin_signbitl"; + case Builtin::BI__warn_memset_zero_len: + return "Builtin::BI__warn_memset_zero_len"; + case Builtin::BI__annotation: + return "Builtin::BI__annotation"; + case Builtin::BI__builtin_annotation: + return "Builtin::BI__builtin_annotation"; + case Builtin::BI__builtin_addcb: + return "Builtin::BI__builtin_addcb"; + case Builtin::BI__builtin_addcs: + return "Builtin::BI__builtin_addcs"; + case Builtin::BI__builtin_addc: + return "Builtin::BI__builtin_addc"; + case Builtin::BI__builtin_addcl: + return "Builtin::BI__builtin_addcl"; + case Builtin::BI__builtin_addcll: + return "Builtin::BI__builtin_addcll"; + case Builtin::BI__builtin_subcb: + return "Builtin::BI__builtin_subcb"; + case Builtin::BI__builtin_subcs: + return "Builtin::BI__builtin_subcs"; + case Builtin::BI__builtin_subc: + return "Builtin::BI__builtin_subc"; + case Builtin::BI__builtin_subcl: + return "Builtin::BI__builtin_subcl"; + case Builtin::BI__builtin_subcll: + return "Builtin::BI__builtin_subcll"; + case Builtin::BI__addressof: + return "Builtin::BI__addressof"; + case Builtin::BI__builtin_addressof: + return "Builtin::BI__builtin_addressof"; + case Builtin::BI__builtin_function_start: + return "Builtin::BI__builtin_function_start"; + case Builtin::BI__builtin_operator_new: + return "Builtin::BI__builtin_operator_new"; + case Builtin::BI__builtin_operator_delete: + return "Builtin::BI__builtin_operator_delete"; + case Builtin::BI__builtin_is_aligned: + return "Builtin::BI__builtin_is_aligned"; + case Builtin::BI__builtin_align_up: + return "Builtin::BI__builtin_align_up"; + case Builtin::BI__builtin_align_down: + return "Builtin::BI__builtin_align_down"; + case Builtin::BI__noop: + return "Builtin::BI__noop"; + case Builtin::BI__builtin_call_with_static_chain: + return "Builtin::BI__builtin_call_with_static_chain"; + case Builtin::BI__iso_volatile_load8: + return "Builtin::BI__iso_volatile_load8"; + case Builtin::BI__iso_volatile_load16: + return "Builtin::BI__iso_volatile_load16"; + case Builtin::BI__iso_volatile_load32: + return "Builtin::BI__iso_volatile_load32"; + case Builtin::BI__iso_volatile_load64: + return "Builtin::BI__iso_volatile_load64"; + case Builtin::BI__iso_volatile_store8: + return "Builtin::BI__iso_volatile_store8"; + case Builtin::BI__iso_volatile_store16: + return "Builtin::BI__iso_volatile_store16"; + case Builtin::BI__iso_volatile_store32: + return "Builtin::BI__iso_volatile_store32"; + case Builtin::BI__iso_volatile_store64: + return "Builtin::BI__iso_volatile_store64"; + case Builtin::BI__builtin_ptrauth_sign_constant: + return "Builtin::BI__builtin_ptrauth_sign_constant"; + case Builtin::BI__builtin_ptrauth_auth: + return "Builtin::BI__builtin_ptrauth_auth"; + case Builtin::BI__builtin_ptrauth_auth_and_resign: + return "Builtin::BI__builtin_ptrauth_auth_and_resign"; + case Builtin::BI__builtin_ptrauth_blend_discriminator: + return "Builtin::BI__builtin_ptrauth_blend_discriminator"; + case Builtin::BI__builtin_ptrauth_sign_generic_data: + return "Builtin::BI__builtin_ptrauth_sign_generic_data"; + case Builtin::BI__builtin_ptrauth_sign_unauthenticated: + return "Builtin::BI__builtin_ptrauth_sign_unauthenticated"; + case Builtin::BI__builtin_ptrauth_strip: + return "Builtin::BI__builtin_ptrauth_strip"; + case Builtin::BI__exception_code: + return "Builtin::BI__exception_code"; + case Builtin::BI__exception_info: + return "Builtin::BI__exception_info"; + case Builtin::BI__abnormal_termination: + return "Builtin::BI__abnormal_termination"; + case Builtin::BI__builtin_store_half: + return "Builtin::BI__builtin_store_half"; + case Builtin::BI__builtin_store_halff: + return "Builtin::BI__builtin_store_halff"; + case Builtin::BI__builtin_load_half: + return "Builtin::BI__builtin_load_half"; + case Builtin::BI__builtin_load_halff: + return "Builtin::BI__builtin_load_halff"; + case Builtin::BI__builtin_printf: + return "Builtin::BI__builtin_printf"; + case Builtin::BI__builtin_canonicalize: + return "Builtin::BI__builtin_canonicalize"; + case Builtin::BI__builtin_canonicalizef: + return "Builtin::BI__builtin_canonicalizef"; + case Builtin::BI__builtin_canonicalizef16: + return "Builtin::BI__builtin_canonicalizef16"; + case Builtin::BI__builtin_canonicalizel: + return "Builtin::BI__builtin_canonicalizel"; + case Builtin::BI__builtin_thread_pointer: + return "Builtin::BI__builtin_thread_pointer"; + case Builtin::BI__builtin_os_log_format: + return "Builtin::BI__builtin_os_log_format"; + case Builtin::BI__xray_customevent: + return "Builtin::BI__xray_customevent"; + case Builtin::BI__xray_typedevent: + return "Builtin::BI__xray_typedevent"; + case Builtin::BI__builtin_ms_va_start: + return "Builtin::BI__builtin_ms_va_start"; + case Builtin::BI__builtin_ms_va_end: + return "Builtin::BI__builtin_ms_va_end"; + case Builtin::BI__builtin_ms_va_copy: + return "Builtin::BI__builtin_ms_va_copy"; + case Builtin::BI__builtin_get_device_side_mangled_name: + return "Builtin::BI__builtin_get_device_side_mangled_name"; + } +} + RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue) { @@ -1343,6 +2015,16 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, } } + // If a Builtin is not handled in above code but handled in original + // clang codegen, we will assert here with its name. + // It would be confusing and bad for triaging to let it go on + // as they will fail evetunally with unrelated message. + std::string unhandledName = getUnhandledBuiltinName(BuiltinID); + if (!unhandledName.empty()) { + llvm::errs() << unhandledName << " "; + llvm_unreachable("NYI"); + } + // If this is an alias for a lib function (e.g. __builtin_sin), emit // the call using the normal call path, but using the unmangled // version of the function name.