Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

PR:		276104
MFC after:	1 month
This commit is contained in:
Dimitry Andric 2023-12-18 21:30:12 +01:00
commit 5f757f3ff9
5644 changed files with 334511 additions and 188365 deletions

View file

@ -51,6 +51,447 @@
# xargs -n1 | sort | uniq -d;
# done
# 2024mmdd: new clang import which bumps version from 17 to 18
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_builtin_vars.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_cmath.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_complex_builtins.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_device_functions.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_intrinsics.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_libdevice_declares.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_math.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_math_forward_declares.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_runtime_wrapper.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_texture_intrinsics.h
OLD_FILES+=usr/lib/clang/17/include/__clang_hip_cmath.h
OLD_FILES+=usr/lib/clang/17/include/__clang_hip_libdevice_declares.h
OLD_FILES+=usr/lib/clang/17/include/__clang_hip_math.h
OLD_FILES+=usr/lib/clang/17/include/__clang_hip_runtime_wrapper.h
OLD_FILES+=usr/lib/clang/17/include/__clang_hip_stdlib.h
OLD_FILES+=usr/lib/clang/17/include/__stddef_max_align_t.h
OLD_FILES+=usr/lib/clang/17/include/__wmmintrin_aes.h
OLD_FILES+=usr/lib/clang/17/include/__wmmintrin_pclmul.h
OLD_FILES+=usr/lib/clang/17/include/adxintrin.h
OLD_FILES+=usr/lib/clang/17/include/altivec.h
OLD_FILES+=usr/lib/clang/17/include/ammintrin.h
OLD_FILES+=usr/lib/clang/17/include/amxcomplexintrin.h
OLD_FILES+=usr/lib/clang/17/include/amxfp16intrin.h
OLD_FILES+=usr/lib/clang/17/include/amxintrin.h
OLD_FILES+=usr/lib/clang/17/include/arm64intr.h
OLD_FILES+=usr/lib/clang/17/include/arm_acle.h
OLD_FILES+=usr/lib/clang/17/include/arm_bf16.h
OLD_FILES+=usr/lib/clang/17/include/arm_cde.h
OLD_FILES+=usr/lib/clang/17/include/arm_cmse.h
OLD_FILES+=usr/lib/clang/17/include/arm_fp16.h
OLD_FILES+=usr/lib/clang/17/include/arm_mve.h
OLD_FILES+=usr/lib/clang/17/include/arm_neon.h
OLD_FILES+=usr/lib/clang/17/include/arm_neon_sve_bridge.h
OLD_FILES+=usr/lib/clang/17/include/arm_sme_draft_spec_subject_to_change.h
OLD_FILES+=usr/lib/clang/17/include/arm_sve.h
OLD_FILES+=usr/lib/clang/17/include/armintr.h
OLD_FILES+=usr/lib/clang/17/include/avx2intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512bf16intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512bitalgintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512bwintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512cdintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512dqintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512erintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512fintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512fp16intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512ifmaintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512ifmavlintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512pfintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vbmi2intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vbmiintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vbmivlintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlbf16intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlbitalgintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlbwintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlcdintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vldqintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlfp16intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlvbmi2intrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlvnniintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vlvp2intersectintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vnniintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vp2intersectintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vpopcntdqintrin.h
OLD_FILES+=usr/lib/clang/17/include/avx512vpopcntdqvlintrin.h
OLD_FILES+=usr/lib/clang/17/include/avxifmaintrin.h
OLD_FILES+=usr/lib/clang/17/include/avxintrin.h
OLD_FILES+=usr/lib/clang/17/include/avxneconvertintrin.h
OLD_FILES+=usr/lib/clang/17/include/avxvnniint16intrin.h
OLD_FILES+=usr/lib/clang/17/include/avxvnniint8intrin.h
OLD_FILES+=usr/lib/clang/17/include/avxvnniintrin.h
OLD_FILES+=usr/lib/clang/17/include/bmi2intrin.h
OLD_FILES+=usr/lib/clang/17/include/bmiintrin.h
OLD_FILES+=usr/lib/clang/17/include/builtins.h
OLD_FILES+=usr/lib/clang/17/include/cet.h
OLD_FILES+=usr/lib/clang/17/include/cetintrin.h
OLD_FILES+=usr/lib/clang/17/include/cldemoteintrin.h
OLD_FILES+=usr/lib/clang/17/include/clflushoptintrin.h
OLD_FILES+=usr/lib/clang/17/include/clwbintrin.h
OLD_FILES+=usr/lib/clang/17/include/clzerointrin.h
OLD_FILES+=usr/lib/clang/17/include/cmpccxaddintrin.h
OLD_FILES+=usr/lib/clang/17/include/cpuid.h
OLD_FILES+=usr/lib/clang/17/include/crc32intrin.h
OLD_FILES+=usr/lib/clang/17/include/cuda_wrappers/algorithm
OLD_FILES+=usr/lib/clang/17/include/cuda_wrappers/bits/shared_ptr_base.h
OLD_DIRS+=usr/lib/clang/17/include/cuda_wrappers/bits
OLD_FILES+=usr/lib/clang/17/include/cuda_wrappers/cmath
OLD_FILES+=usr/lib/clang/17/include/cuda_wrappers/complex
OLD_FILES+=usr/lib/clang/17/include/cuda_wrappers/new
OLD_DIRS+=usr/lib/clang/17/include/cuda_wrappers
OLD_FILES+=usr/lib/clang/17/include/emmintrin.h
OLD_FILES+=usr/lib/clang/17/include/enqcmdintrin.h
OLD_FILES+=usr/lib/clang/17/include/f16cintrin.h
OLD_FILES+=usr/lib/clang/17/include/float.h
OLD_FILES+=usr/lib/clang/17/include/fma4intrin.h
OLD_FILES+=usr/lib/clang/17/include/fmaintrin.h
OLD_FILES+=usr/lib/clang/17/include/fuzzer/FuzzedDataProvider.h
OLD_DIRS+=usr/lib/clang/17/include/fuzzer
OLD_FILES+=usr/lib/clang/17/include/fxsrintrin.h
OLD_FILES+=usr/lib/clang/17/include/gfniintrin.h
OLD_FILES+=usr/lib/clang/17/include/hexagon_circ_brev_intrinsics.h
OLD_FILES+=usr/lib/clang/17/include/hexagon_protos.h
OLD_FILES+=usr/lib/clang/17/include/hexagon_types.h
OLD_FILES+=usr/lib/clang/17/include/hlsl/hlsl_basic_types.h
OLD_FILES+=usr/lib/clang/17/include/hlsl/hlsl_intrinsics.h
OLD_DIRS+=usr/lib/clang/17/include/hlsl
OLD_FILES+=usr/lib/clang/17/include/hlsl.h
OLD_FILES+=usr/lib/clang/17/include/hresetintrin.h
OLD_FILES+=usr/lib/clang/17/include/htmintrin.h
OLD_FILES+=usr/lib/clang/17/include/htmxlintrin.h
OLD_FILES+=usr/lib/clang/17/include/hvx_hexagon_protos.h
OLD_FILES+=usr/lib/clang/17/include/ia32intrin.h
OLD_FILES+=usr/lib/clang/17/include/immintrin.h
OLD_FILES+=usr/lib/clang/17/include/intrin.h
OLD_FILES+=usr/lib/clang/17/include/inttypes.h
OLD_FILES+=usr/lib/clang/17/include/invpcidintrin.h
OLD_FILES+=usr/lib/clang/17/include/iso646.h
OLD_FILES+=usr/lib/clang/17/include/keylockerintrin.h
OLD_FILES+=usr/lib/clang/17/include/larchintrin.h
OLD_FILES+=usr/lib/clang/17/include/limits.h
OLD_FILES+=usr/lib/clang/17/include/lwpintrin.h
OLD_FILES+=usr/lib/clang/17/include/lzcntintrin.h
OLD_FILES+=usr/lib/clang/17/include/mm3dnow.h
OLD_FILES+=usr/lib/clang/17/include/mm_malloc.h
OLD_FILES+=usr/lib/clang/17/include/mmintrin.h
OLD_FILES+=usr/lib/clang/17/include/module.modulemap
OLD_FILES+=usr/lib/clang/17/include/movdirintrin.h
OLD_FILES+=usr/lib/clang/17/include/msa.h
OLD_FILES+=usr/lib/clang/17/include/mwaitxintrin.h
OLD_FILES+=usr/lib/clang/17/include/nmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/omp-tools.h
OLD_FILES+=usr/lib/clang/17/include/omp.h
OLD_FILES+=usr/lib/clang/17/include/ompt.h
OLD_FILES+=usr/lib/clang/17/include/opencl-c-base.h
OLD_FILES+=usr/lib/clang/17/include/opencl-c.h
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/__clang_openmp_device_functions.h
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/cmath
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/complex
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/complex.h
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/complex_cmath.h
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/math.h
OLD_FILES+=usr/lib/clang/17/include/openmp_wrappers/new
OLD_DIRS+=usr/lib/clang/17/include/openmp_wrappers
OLD_FILES+=usr/lib/clang/17/include/orc_rt/c_api.h
OLD_DIRS+=usr/lib/clang/17/include/orc_rt
OLD_FILES+=usr/lib/clang/17/include/pconfigintrin.h
OLD_FILES+=usr/lib/clang/17/include/pkuintrin.h
OLD_FILES+=usr/lib/clang/17/include/pmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/popcntintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/bmi2intrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/bmiintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/emmintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/immintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/mm_malloc.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/mmintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/pmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/smmintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/tmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/x86gprintrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/x86intrin.h
OLD_FILES+=usr/lib/clang/17/include/ppc_wrappers/xmmintrin.h
OLD_DIRS+=usr/lib/clang/17/include/ppc_wrappers
OLD_FILES+=usr/lib/clang/17/include/prfchiintrin.h
OLD_FILES+=usr/lib/clang/17/include/prfchwintrin.h
OLD_FILES+=usr/lib/clang/17/include/profile/InstrProfData.inc
OLD_FILES+=usr/lib/clang/17/include/profile/MemProfData.inc
OLD_DIRS+=usr/lib/clang/17/include/profile
OLD_FILES+=usr/lib/clang/17/include/ptwriteintrin.h
OLD_FILES+=usr/lib/clang/17/include/raointintrin.h
OLD_FILES+=usr/lib/clang/17/include/rdpruintrin.h
OLD_FILES+=usr/lib/clang/17/include/rdseedintrin.h
OLD_FILES+=usr/lib/clang/17/include/riscv_ntlh.h
OLD_FILES+=usr/lib/clang/17/include/riscv_vector.h
OLD_FILES+=usr/lib/clang/17/include/rtmintrin.h
OLD_FILES+=usr/lib/clang/17/include/s390intrin.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/allocator_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/asan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/common_interface_defs.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/coverage_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/dfsan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/hwasan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/linux_syscall_hooks.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/lsan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/memprof_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/msan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/netbsd_syscall_hooks.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/scudo_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/tsan_interface.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/tsan_interface_atomic.h
OLD_FILES+=usr/lib/clang/17/include/sanitizer/ubsan_interface.h
OLD_DIRS+=usr/lib/clang/17/include/sanitizer
OLD_FILES+=usr/lib/clang/17/include/serializeintrin.h
OLD_FILES+=usr/lib/clang/17/include/sgxintrin.h
OLD_FILES+=usr/lib/clang/17/include/sha512intrin.h
OLD_FILES+=usr/lib/clang/17/include/shaintrin.h
OLD_FILES+=usr/lib/clang/17/include/sifive_vector.h
OLD_FILES+=usr/lib/clang/17/include/sm3intrin.h
OLD_FILES+=usr/lib/clang/17/include/sm4intrin.h
OLD_FILES+=usr/lib/clang/17/include/smmintrin.h
OLD_FILES+=usr/lib/clang/17/include/stdalign.h
OLD_FILES+=usr/lib/clang/17/include/stdarg.h
OLD_FILES+=usr/lib/clang/17/include/stdatomic.h
OLD_FILES+=usr/lib/clang/17/include/stdbool.h
OLD_FILES+=usr/lib/clang/17/include/stddef.h
OLD_FILES+=usr/lib/clang/17/include/stdint.h
OLD_FILES+=usr/lib/clang/17/include/stdnoreturn.h
OLD_FILES+=usr/lib/clang/17/include/tbmintrin.h
OLD_FILES+=usr/lib/clang/17/include/tgmath.h
OLD_FILES+=usr/lib/clang/17/include/tmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/tsxldtrkintrin.h
OLD_FILES+=usr/lib/clang/17/include/uintrintrin.h
OLD_FILES+=usr/lib/clang/17/include/unwind.h
OLD_FILES+=usr/lib/clang/17/include/vadefs.h
OLD_FILES+=usr/lib/clang/17/include/vaesintrin.h
OLD_FILES+=usr/lib/clang/17/include/varargs.h
OLD_FILES+=usr/lib/clang/17/include/vecintrin.h
OLD_FILES+=usr/lib/clang/17/include/velintrin.h
OLD_FILES+=usr/lib/clang/17/include/velintrin_approx.h
OLD_FILES+=usr/lib/clang/17/include/velintrin_gen.h
OLD_FILES+=usr/lib/clang/17/include/vpclmulqdqintrin.h
OLD_FILES+=usr/lib/clang/17/include/waitpkgintrin.h
OLD_FILES+=usr/lib/clang/17/include/wasm_simd128.h
OLD_FILES+=usr/lib/clang/17/include/wbnoinvdintrin.h
OLD_FILES+=usr/lib/clang/17/include/wmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/x86gprintrin.h
OLD_FILES+=usr/lib/clang/17/include/x86intrin.h
OLD_FILES+=usr/lib/clang/17/include/xmmintrin.h
OLD_FILES+=usr/lib/clang/17/include/xopintrin.h
OLD_FILES+=usr/lib/clang/17/include/xray/xray_interface.h
OLD_FILES+=usr/lib/clang/17/include/xray/xray_log_interface.h
OLD_FILES+=usr/lib/clang/17/include/xray/xray_records.h
OLD_DIRS+=usr/lib/clang/17/include/xray
OLD_FILES+=usr/lib/clang/17/include/xsavecintrin.h
OLD_FILES+=usr/lib/clang/17/include/xsaveintrin.h
OLD_FILES+=usr/lib/clang/17/include/xsaveoptintrin.h
OLD_FILES+=usr/lib/clang/17/include/xsavesintrin.h
OLD_FILES+=usr/lib/clang/17/include/xtestintrin.h
OLD_DIRS+=usr/lib/clang/17/include
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-aarch64.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-arm.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-armhf.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-i386.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-powerpc64.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-powerpc64le.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-preinit-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-riscv64.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan-x86_64.so
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_cxx-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi_diag-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi_diag-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi_diag-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi_diag-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi_diag-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.dd-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.dd-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.fuzzer-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.fuzzer-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.fuzzer_interceptors-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.fuzzer_no_main-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.fuzzer_no_main-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan_cxx-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan_cxx-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan_cxx-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.msan_cxx-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-powerpc.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.profile-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.safestack-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.safestack-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.safestack-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.stats_client-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan_cxx-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan_cxx-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan_cxx-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.tsan_cxx-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_minimal-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-i386.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-powerpc64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-riscv64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-basic-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-basic-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-basic-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-basic-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-basic-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-fdr-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-fdr-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-fdr-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-fdr-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-fdr-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-profiling-aarch64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-profiling-arm.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-profiling-armhf.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-profiling-powerpc64le.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-profiling-x86_64.a
OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.xray-x86_64.a
OLD_DIRS+=usr/lib/clang/17/lib/freebsd
OLD_DIRS+=usr/lib/clang/17/lib
OLD_FILES+=usr/lib/clang/17/share/asan_ignorelist.txt
OLD_FILES+=usr/lib/clang/17/share/cfi_ignorelist.txt
OLD_FILES+=usr/lib/clang/17/share/msan_ignorelist.txt
OLD_DIRS+=usr/lib/clang/17/share
OLD_DIRS+=usr/lib/clang/17
# 2024mmdd: new libc++ import which bumps version from 17 to 18
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/algorithm_fwd.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/algorithm_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/execution_defs.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/execution_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_algorithm_defs.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_algorithm_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_memory_defs.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_memory_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_numeric_defs.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/glue_numeric_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/memory_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/numeric_fwd.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/numeric_impl.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_for.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_for_each.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_invoke.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_merge.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_scan.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_stable_partial_sort.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_stable_sort.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_transform_reduce.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/parallel_transform_scan.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/omp/util.h
OLD_DIRS+=usr/include/include/c++/v1/__pstl/internal/omp
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/parallel_backend.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/parallel_backend_omp.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/parallel_backend_serial.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/parallel_backend_tbb.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/parallel_backend_utils.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/unseq_backend_simd.h
OLD_FILES+=usr/include/include/c++/v1/__pstl/internal/utils.h
OLD_DIRS+=usr/include/include/c++/v1/__pstl/internal
OLD_DIRS+=usr/include/include/c++/v1/__pstl
OLD_FILES+=usr/include/include/c++/v1/__pstl_algorithm
OLD_FILES+=usr/include/include/c++/v1/__pstl_memory
OLD_FILES+=usr/include/include/c++/v1/__pstl_numeric
OLD_FILES+=usr/include/include/c++/v1/__type_traits/predicate_traits.h
OLD_FILES+=usr/include/include/c++/v1/__utility/terminate_on_exception.h
OLD_FILES+=usr/include/include/c++/v1/experimental/deque
OLD_FILES+=usr/include/include/c++/v1/experimental/forward_list
OLD_FILES+=usr/include/include/c++/v1/experimental/list
OLD_FILES+=usr/include/include/c++/v1/experimental/map
OLD_FILES+=usr/include/include/c++/v1/experimental/memory_resource
OLD_FILES+=usr/include/include/c++/v1/experimental/regex
OLD_FILES+=usr/include/include/c++/v1/experimental/set
OLD_FILES+=usr/include/include/c++/v1/experimental/string
OLD_FILES+=usr/include/include/c++/v1/experimental/unordered_map
OLD_FILES+=usr/include/include/c++/v1/experimental/unordered_set
OLD_FILES+=usr/include/include/c++/v1/experimental/vector
OLD_FILES+=usr/include/include/c++/v1/limits.h
OLD_FILES+=usr/include/include/c++/v1/setjmp.h
# 20240321: remove empty /usr/libdata/gcc directory
OLD_DIRS+=usr/libdata/gcc

View file

@ -7,6 +7,7 @@
.github/
.gitignore
.mailmap
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.TXT
README.md
@ -111,6 +112,7 @@ clang/tools/clang-format/clang-format.el
clang/tools/clang-format/clang-format.py
clang/tools/clang-format/fuzzer/
clang/tools/clang-format/git-clang-format
clang/tools/clang-format/git-clang-format.bat
clang/tools/clang-format-vs/
clang/tools/clang-fuzzer/
clang/tools/clang-import-test/
@ -144,6 +146,7 @@ clang/utils/FuzzTest
clang/utils/TableGen/CMakeLists.txt
clang/utils/TestUtils/
clang/utils/VtableTest/
clang/utils/analyze_safe_buffer_debug_notes.py
clang/utils/analyzer/
clang/utils/bash-autocomplete.sh
clang/utils/builtin-defines.c
@ -160,6 +163,7 @@ clang/utils/modfuzz.py
clang/utils/module-deps-to-rsp.py
clang/utils/perf-training/
clang/utils/token-delta.py
clang/utils/update_options_td_flags.py
clang/utils/valgrind/
clang/www/
clang-tools-extra/
@ -216,6 +220,7 @@ compiler-rt/lib/safestack/CMakeLists.txt
compiler-rt/lib/sanitizer_common/.clang-format
compiler-rt/lib/sanitizer_common/CMakeLists.txt
compiler-rt/lib/sanitizer_common/scripts/
compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt
compiler-rt/lib/sanitizer_common/tests/
compiler-rt/lib/scudo/standalone/CMakeLists.txt
compiler-rt/lib/scudo/standalone/benchmarks/
@ -262,6 +267,7 @@ libcxx/include/__support/
libcxx/lib/
libcxx/modules/CMakeLists.txt
libcxx/modules/CMakeLists.txt.in
libcxx/modules/README.md
libcxx/src/CMakeLists.txt
libcxx/src/support/win32/
libcxx/test/
@ -291,7 +297,7 @@ lldb/.clang-format
lldb/.clang-tidy
lldb/.gitignore
lldb/CMakeLists.txt
lldb/CODE_OWNERS.txt
lldb/CodeOwners.rst
lldb/bindings/CMakeLists.txt
lldb/bindings/lua/CMakeLists.txt
lldb/bindings/python/CMakeLists.txt
@ -299,7 +305,6 @@ lldb/bindings/python/get-python-config.py
lldb/cmake/
lldb/docs/.htaccess
lldb/docs/CMakeLists.txt
lldb/docs/_static/
lldb/docs/conf.py
lldb/docs/doxygen-mainpage.dox
lldb/docs/doxygen.cfg.in
@ -308,7 +313,6 @@ lldb/docs/lldb-for-gdb-users.txt
lldb/docs/lldb-gdb-remote.txt
lldb/docs/lldb-platform-packets.txt
lldb/docs/resources/
lldb/docs/status/
lldb/docs/testsuite/
lldb/docs/use/
lldb/examples/
@ -341,6 +345,7 @@ lldb/source/Plugins/ABI/Hexagon/CMakeLists.txt
lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
lldb/source/Plugins/ABI/Mips/CMakeLists.txt
lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
lldb/source/Plugins/ABI/SystemZ/CMakeLists.txt
lldb/source/Plugins/ABI/X86/CMakeLists.txt
lldb/source/Plugins/Architecture/AArch64/CMakeLists.txt
@ -353,6 +358,7 @@ lldb/source/Plugins/Disassembler/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt
@ -370,10 +376,12 @@ lldb/source/Plugins/Instruction/MIPS64/CMakeLists.txt
lldb/source/Plugins/Instruction/PPC64/CMakeLists.txt
lldb/source/Plugins/Instruction/RISCV/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/Utility/CMakeLists.txt
lldb/source/Plugins/JITLoader/CMakeLists.txt
lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
lldb/source/Plugins/Language/CMakeLists.txt
@ -438,6 +446,7 @@ lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/None/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt
lldb/source/Plugins/StructuredData/CMakeLists.txt
lldb/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt
lldb/source/Plugins/SymbolFile/Breakpad/CMakeLists.txt
@ -448,6 +457,10 @@ lldb/source/Plugins/SymbolFile/JSON/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/source/Plugins/SymbolFile/Symtab/CMakeLists.txt
lldb/source/Plugins/SymbolLocator/CMakeLists.txt
lldb/source/Plugins/SymbolLocator/DebugSymbols/CMakeLists.txt
lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt
lldb/source/Plugins/SymbolLocator/Default/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/ELF/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/MacOSX/
@ -479,11 +492,12 @@ lldb/tools/debugserver/
lldb/tools/driver/CMakeLists.txt
lldb/tools/driver/lldb-Info.plist.in
lldb/tools/intel-features/
lldb/tools/lldb-dap/
lldb/tools/lldb-fuzzer/
lldb/tools/lldb-instr/CMakeLists.txt
lldb/tools/lldb-server/CMakeLists.txt
lldb/tools/lldb-test/
lldb/tools/lldb-vscode/
lldb/tools/lldb-vscode
lldb/unittests/
lldb/use_lldb_suite_root.py
lldb/utils/CMakeLists.txt
@ -555,6 +569,7 @@ llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt
llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt
llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
llvm/lib/ExecutionEngine/Orc/Debugging/CMakeLists.txt
llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt
llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt
llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt
@ -562,7 +577,9 @@ llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt
llvm/lib/Extensions/
llvm/lib/FileCheck/CMakeLists.txt
llvm/lib/Frontend/CMakeLists.txt
llvm/lib/Frontend/Driver/CMakeLists.txt
llvm/lib/Frontend/HLSL/CMakeLists.txt
llvm/lib/Frontend/Offloading/CMakeLists.txt
llvm/lib/Frontend/OpenACC/CMakeLists.txt
llvm/lib/Frontend/OpenMP/CMakeLists.txt
llvm/lib/FuzzMutate/CMakeLists.txt
@ -743,6 +760,7 @@ llvm/lib/Transforms/CFGuard/CMakeLists.txt
llvm/lib/Transforms/CMakeLists.txt
llvm/lib/Transforms/Coroutines/CMakeLists.txt
llvm/lib/Transforms/Hello/
llvm/lib/Transforms/HipStdPar/CMakeLists.txt
llvm/lib/Transforms/IPO/CMakeLists.txt
llvm/lib/Transforms/InstCombine/CMakeLists.txt
llvm/lib/Transforms/Instrumentation/CMakeLists.txt
@ -824,8 +842,8 @@ llvm/tools/llvm-profdata/CMakeLists.txt
llvm/tools/llvm-profgen/
llvm/tools/llvm-rc/
llvm/tools/llvm-readobj/CMakeLists.txt
llvm/tools/llvm-readtapi/
llvm/tools/llvm-reduce/
llvm/tools/llvm-remark-size-diff/
llvm/tools/llvm-remarkutil/CMakeLists.txt
llvm/tools/llvm-rtdyld/CMakeLists.txt
llvm/tools/llvm-rust-demangle-fuzzer/
@ -837,7 +855,6 @@ llvm/tools/llvm-split/
llvm/tools/llvm-stress/CMakeLists.txt
llvm/tools/llvm-strings/CMakeLists.txt
llvm/tools/llvm-symbolizer/CMakeLists.txt
llvm/tools/llvm-tapi-diff/CMakeLists.txt
llvm/tools/llvm-tli-checker/CMakeLists.txt
llvm/tools/llvm-undname/
llvm/tools/llvm-xray/CMakeLists.txt
@ -850,6 +867,7 @@ llvm/tools/opt-viewer/
llvm/tools/remarks-shlib/
llvm/tools/sancov/
llvm/tools/sanstats/
llvm/tools/spirv-tools/
llvm/tools/verify-uselistorder/
llvm/tools/vfabi-demangle-fuzzer/
llvm/tools/xcode-toolchain/
@ -867,6 +885,7 @@ llvm/utils/PerfectShuffle/
llvm/utils/Reviewing/
llvm/utils/TableGen/CMakeLists.txt
llvm/utils/TableGen/GlobalISel/CMakeLists.txt
llvm/utils/TableGen/README.md
llvm/utils/TableGen/jupyter/
llvm/utils/TableGen/tdtags
llvm/utils/Target/
@ -918,7 +937,6 @@ llvm/utils/llvm-original-di-preservation.py
llvm/utils/llvm.grm
llvm/utils/merge-stats.py
llvm/utils/not/
llvm/utils/phabricator/
llvm/utils/pipeline.py
llvm/utils/prepare-code-coverage-artifact.py
llvm/utils/reduce_pipeline.py

View file

@ -95,7 +95,7 @@ CINDEX_LINKAGE void clang_free(void *buffer);
CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
/**
* Object encapsulating information about a module.map file.
* Object encapsulating information about a module.modulemap file.
*/
typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
@ -109,7 +109,7 @@ CINDEX_LINKAGE CXModuleMapDescriptor
clang_ModuleMapDescriptor_create(unsigned options);
/**
* Sets the framework module name that the module.map describes.
* Sets the framework module name that the module.modulemap describes.
* \returns 0 for success, non-zero to indicate an error.
*/
CINDEX_LINKAGE enum CXErrorCode
@ -117,7 +117,7 @@ clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
const char *name);
/**
* Sets the umbrella header name that the module.map describes.
* Sets the umbrella header name that the module.modulemap describes.
* \returns 0 for success, non-zero to indicate an error.
*/
CINDEX_LINKAGE enum CXErrorCode

View file

@ -2136,7 +2136,11 @@ enum CXCursorKind {
*/
CXCursor_OMPErrorDirective = 305,
CXCursor_LastStmt = CXCursor_OMPErrorDirective,
/** OpenMP scope directive.
*/
CXCursor_OMPScopeDirective = 306,
CXCursor_LastStmt = CXCursor_OMPScopeDirective,
/**
* Cursor that represents the translation unit itself.
@ -2976,6 +2980,7 @@ enum CXCallingConv {
CXCallingConv_AArch64VectorCall = 16,
CXCallingConv_SwiftAsync = 17,
CXCallingConv_AArch64SVEPCS = 18,
CXCallingConv_M68kRTD = 19,
CXCallingConv_Invalid = 100,
CXCallingConv_Unexposed = 200

View file

@ -0,0 +1,175 @@
//===--- APINotesManager.h - Manage API Notes Files -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_APINOTES_APINOTESMANAGER_H
#define LLVM_CLANG_APINOTES_APINOTESMANAGER_H
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/VersionTuple.h"
#include <memory>
#include <string>
namespace clang {
class DirectoryEntry;
class FileEntry;
class LangOptions;
class SourceManager;
namespace api_notes {
class APINotesReader;
/// The API notes manager helps find API notes associated with declarations.
///
/// API notes are externally-provided annotations for declarations that can
/// introduce new attributes (covering availability, nullability of
/// parameters/results, and so on) for specific declarations without directly
/// modifying the headers that contain those declarations.
///
/// The API notes manager is responsible for finding and loading the
/// external API notes files that correspond to a given header. Its primary
/// operation is \c findAPINotes(), which finds the API notes reader that
/// provides information about the declarations at that location.
class APINotesManager {
using ReaderEntry = llvm::PointerUnion<DirectoryEntryRef, APINotesReader *>;
SourceManager &SM;
/// Whether to implicitly search for API notes files based on the
/// source file from which an entity was declared.
bool ImplicitAPINotes;
/// The Swift version to use when interpreting versioned API notes.
llvm::VersionTuple SwiftVersion;
enum ReaderKind : unsigned { Public = 0, Private = 1 };
/// API notes readers for the current module.
///
/// There can be up to two of these, one for public headers and one
/// for private headers.
///
/// Not using std::unique_ptr to store these, since the reader pointers are
/// also stored in llvm::PointerUnion below.
APINotesReader *CurrentModuleReaders[2] = {nullptr, nullptr};
/// A mapping from header file directories to the API notes reader for
/// that directory, or a redirection to another directory entry that may
/// have more information, or NULL to indicate that there is no API notes
/// reader for this directory.
llvm::DenseMap<const DirectoryEntry *, ReaderEntry> Readers;
/// Load the API notes associated with the given file, whether it is
/// the binary or source form of API notes.
///
/// \returns the API notes reader for this file, or null if there is
/// a failure.
std::unique_ptr<APINotesReader> loadAPINotes(FileEntryRef APINotesFile);
/// Load the API notes associated with the given buffer, whether it is
/// the binary or source form of API notes.
///
/// \returns the API notes reader for this file, or null if there is
/// a failure.
std::unique_ptr<APINotesReader> loadAPINotes(StringRef Buffer);
/// Load the given API notes file for the given header directory.
///
/// \param HeaderDir The directory at which we
///
/// \returns true if an error occurred.
bool loadAPINotes(const DirectoryEntry *HeaderDir, FileEntryRef APINotesFile);
/// Look for API notes in the given directory.
///
/// This might find either a binary or source API notes.
OptionalFileEntryRef findAPINotesFile(DirectoryEntryRef Directory,
StringRef FileName,
bool WantPublic = true);
/// Attempt to load API notes for the given framework. A framework will have
/// the API notes file under either {FrameworkPath}/APINotes,
/// {FrameworkPath}/Headers or {FrameworkPath}/PrivateHeaders, while a
/// library will have the API notes simply in its directory.
///
/// \param FrameworkPath The path to the framework.
/// \param Public Whether to load the public API notes. Otherwise, attempt
/// to load the private API notes.
///
/// \returns the header directory entry (e.g., for Headers or PrivateHeaders)
/// for which the API notes were successfully loaded, or NULL if API notes
/// could not be loaded for any reason.
OptionalDirectoryEntryRef loadFrameworkAPINotes(llvm::StringRef FrameworkPath,
llvm::StringRef FrameworkName,
bool Public);
public:
APINotesManager(SourceManager &SM, const LangOptions &LangOpts);
~APINotesManager();
/// Set the Swift version to use when filtering API notes.
void setSwiftVersion(llvm::VersionTuple Version) {
this->SwiftVersion = Version;
}
/// Load the API notes for the current module.
///
/// \param M The current module.
/// \param LookInModule Whether to look inside the module itself.
/// \param SearchPaths The paths in which we should search for API notes
/// for the current module.
///
/// \returns true if API notes were successfully loaded, \c false otherwise.
bool loadCurrentModuleAPINotes(Module *M, bool LookInModule,
ArrayRef<std::string> SearchPaths);
/// Get FileEntry for the APINotes of the module that is currently being
/// compiled.
///
/// \param M The current module.
/// \param LookInModule Whether to look inside the directory of the current
/// module.
/// \param SearchPaths The paths in which we should search for API
/// notes for the current module.
///
/// \returns a vector of FileEntry where APINotes files are.
llvm::SmallVector<FileEntryRef, 2>
getCurrentModuleAPINotes(Module *M, bool LookInModule,
ArrayRef<std::string> SearchPaths);
/// Load Compiled API notes for current module.
///
/// \param Buffers Array of compiled API notes.
///
/// \returns true if API notes were successfully loaded, \c false otherwise.
bool loadCurrentModuleAPINotesFromBuffer(ArrayRef<StringRef> Buffers);
/// Retrieve the set of API notes readers for the current module.
ArrayRef<APINotesReader *> getCurrentModuleReaders() const {
bool HasPublic = CurrentModuleReaders[ReaderKind::Public];
bool HasPrivate = CurrentModuleReaders[ReaderKind::Private];
assert((!HasPrivate || HasPublic) && "private module requires public module");
if (!HasPrivate && !HasPublic)
return {};
return ArrayRef(CurrentModuleReaders).slice(0, HasPrivate ? 2 : 1);
}
/// Find the API notes readers that correspond to the given source location.
llvm::SmallVector<APINotesReader *, 2> findAPINotes(SourceLocation Loc);
};
} // end namespace api_notes
} // end namespace clang
#endif

View file

@ -0,0 +1,34 @@
//===--- APINotesOptions.h --------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_APINOTES_APINOTESOPTIONS_H
#define LLVM_CLANG_APINOTES_APINOTESOPTIONS_H
#include "llvm/Support/VersionTuple.h"
#include <string>
#include <vector>
namespace clang {
/// Tracks various options which control how API notes are found and handled.
class APINotesOptions {
public:
/// The Swift version which should be used for API notes.
llvm::VersionTuple SwiftVersion;
/// The set of search paths where we API notes can be found for particular
/// modules.
///
/// The API notes in this directory are stored as <ModuleName>.apinotes, and
/// are only applied when building the module <ModuleName>.
std::vector<std::string> ModuleSearchPaths;
};
} // namespace clang
#endif // LLVM_CLANG_APINOTES_APINOTESOPTIONS_H

View file

@ -0,0 +1,200 @@
//===--- APINotesReader.h - API Notes Reader --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the \c APINotesReader class that reads source API notes
// data providing additional information about source code as a separate input,
// such as the non-nil/nilable annotations for method parameters.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_APINOTES_READER_H
#define LLVM_CLANG_APINOTES_READER_H
#include "clang/APINotes/Types.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/VersionTuple.h"
#include <memory>
namespace clang {
namespace api_notes {
/// A class that reads API notes data from a binary file that was written by
/// the \c APINotesWriter.
class APINotesReader {
class Implementation;
std::unique_ptr<Implementation> Implementation;
APINotesReader(llvm::MemoryBuffer *InputBuffer,
llvm::VersionTuple SwiftVersion, bool &Failed);
public:
/// Create a new API notes reader from the given member buffer, which
/// contains the contents of a binary API notes file.
///
/// \returns the new API notes reader, or null if an error occurred.
static std::unique_ptr<APINotesReader>
Create(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
llvm::VersionTuple SwiftVersion);
~APINotesReader();
APINotesReader(const APINotesReader &) = delete;
APINotesReader &operator=(const APINotesReader &) = delete;
/// Captures the completed versioned information for a particular part of
/// API notes, including both unversioned API notes and each versioned API
/// note for that particular entity.
template <typename T> class VersionedInfo {
/// The complete set of results.
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results;
/// The index of the result that is the "selected" set based on the desired
/// Swift version, or null if nothing matched.
std::optional<unsigned> Selected;
public:
/// Form an empty set of versioned information.
VersionedInfo(std::nullopt_t) : Selected(std::nullopt) {}
/// Form a versioned info set given the desired version and a set of
/// results.
VersionedInfo(
llvm::VersionTuple Version,
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results);
/// Retrieve the selected index in the result set.
std::optional<unsigned> getSelected() const { return Selected; }
/// Return the number of versioned results we know about.
unsigned size() const { return Results.size(); }
/// Access all versioned results.
const std::pair<llvm::VersionTuple, T> *begin() const {
assert(!Results.empty());
return Results.begin();
}
const std::pair<llvm::VersionTuple, T> *end() const {
return Results.end();
}
/// Access a specific versioned result.
const std::pair<llvm::VersionTuple, T> &operator[](unsigned index) const {
assert(index < Results.size());
return Results[index];
}
};
/// Look for the context ID of the given Objective-C class.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The ID, if known.
std::optional<ContextID> lookupObjCClassID(llvm::StringRef Name);
/// Look for information regarding the given Objective-C class.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The information about the class, if known.
VersionedInfo<ObjCContextInfo> lookupObjCClassInfo(llvm::StringRef Name);
/// Look for the context ID of the given Objective-C protocol.
///
/// \param Name The name of the protocol we're looking for.
///
/// \returns The ID of the protocol, if known.
std::optional<ContextID> lookupObjCProtocolID(llvm::StringRef Name);
/// Look for information regarding the given Objective-C protocol.
///
/// \param Name The name of the protocol we're looking for.
///
/// \returns The information about the protocol, if known.
VersionedInfo<ObjCContextInfo> lookupObjCProtocolInfo(llvm::StringRef Name);
/// Look for information regarding the given Objective-C property in
/// the given context.
///
/// \param CtxID The ID that references the context we are looking for.
/// \param Name The name of the property we're looking for.
/// \param IsInstance Whether we are looking for an instance property (vs.
/// a class property).
///
/// \returns Information about the property, if known.
VersionedInfo<ObjCPropertyInfo>
lookupObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstance);
/// Look for information regarding the given Objective-C method in
/// the given context.
///
/// \param CtxID The ID that references the context we are looking for.
/// \param Selector The selector naming the method we're looking for.
/// \param IsInstanceMethod Whether we are looking for an instance method.
///
/// \returns Information about the method, if known.
VersionedInfo<ObjCMethodInfo> lookupObjCMethod(ContextID CtxID,
ObjCSelectorRef Selector,
bool IsInstanceMethod);
/// Look for information regarding the given global variable.
///
/// \param Name The name of the global variable.
///
/// \returns information about the global variable, if known.
VersionedInfo<GlobalVariableInfo>
lookupGlobalVariable(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);
/// Look for information regarding the given global function.
///
/// \param Name The name of the global function.
///
/// \returns information about the global function, if known.
VersionedInfo<GlobalFunctionInfo>
lookupGlobalFunction(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);
/// Look for information regarding the given enumerator.
///
/// \param Name The name of the enumerator.
///
/// \returns information about the enumerator, if known.
VersionedInfo<EnumConstantInfo> lookupEnumConstant(llvm::StringRef Name);
/// Look for information regarding the given tag
/// (struct/union/enum/C++ class).
///
/// \param Name The name of the tag.
///
/// \returns information about the tag, if known.
VersionedInfo<TagInfo> lookupTag(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);
/// Look for information regarding the given typedef.
///
/// \param Name The name of the typedef.
///
/// \returns information about the typedef, if known.
VersionedInfo<TypedefInfo>
lookupTypedef(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);
/// Look for the context ID of the given C++ namespace.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The ID, if known.
std::optional<ContextID>
lookupNamespaceID(llvm::StringRef Name,
std::optional<ContextID> ParentNamespaceID = std::nullopt);
};
} // end namespace api_notes
} // end namespace clang
#endif // LLVM_CLANG_APINOTES_READER_H

View file

@ -0,0 +1,110 @@
//===-- APINotesWriter.h - API Notes Writer ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_APINOTES_WRITER_H
#define LLVM_CLANG_APINOTES_WRITER_H
#include "clang/APINotes/Types.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include <memory>
namespace clang {
class FileEntry;
namespace api_notes {
class APINotesWriter {
class Implementation;
std::unique_ptr<Implementation> Implementation;
public:
APINotesWriter(llvm::StringRef ModuleName, const FileEntry *SF);
~APINotesWriter();
APINotesWriter(const APINotesWriter &) = delete;
APINotesWriter &operator=(const APINotesWriter &) = delete;
void writeToStream(llvm::raw_ostream &OS);
/// Add information about a specific Objective-C class or protocol or a C++
/// namespace.
///
/// \param Name The name of this class/protocol/namespace.
/// \param Kind Whether this is a class, a protocol, or a namespace.
/// \param Info Information about this class/protocol/namespace.
///
/// \returns the ID of the class, protocol, or namespace, which can be used to
/// add properties and methods to the class/protocol/namespace.
ContextID addObjCContext(std::optional<ContextID> ParentCtxID,
llvm::StringRef Name, ContextKind Kind,
const ObjCContextInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about a specific Objective-C property.
///
/// \param CtxID The context in which this property resides.
/// \param Name The name of this property.
/// \param Info Information about this property.
void addObjCProperty(ContextID CtxID, llvm::StringRef Name,
bool IsInstanceProperty, const ObjCPropertyInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about a specific Objective-C method.
///
/// \param CtxID The context in which this method resides.
/// \param Selector The selector that names this method.
/// \param IsInstanceMethod Whether this method is an instance method
/// (vs. a class method).
/// \param Info Information about this method.
void addObjCMethod(ContextID CtxID, ObjCSelectorRef Selector,
bool IsInstanceMethod, const ObjCMethodInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about a global variable.
///
/// \param Name The name of this global variable.
/// \param Info Information about this global variable.
void addGlobalVariable(std::optional<Context> Ctx, llvm::StringRef Name,
const GlobalVariableInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about a global function.
///
/// \param Name The name of this global function.
/// \param Info Information about this global function.
void addGlobalFunction(std::optional<Context> Ctx, llvm::StringRef Name,
const GlobalFunctionInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about an enumerator.
///
/// \param Name The name of this enumerator.
/// \param Info Information about this enumerator.
void addEnumConstant(llvm::StringRef Name, const EnumConstantInfo &Info,
llvm::VersionTuple SwiftVersion);
/// Add information about a tag (struct/union/enum/C++ class).
///
/// \param Name The name of this tag.
/// \param Info Information about this tag.
void addTag(std::optional<Context> Ctx, llvm::StringRef Name,
const TagInfo &Info, llvm::VersionTuple SwiftVersion);
/// Add information about a typedef.
///
/// \param Name The name of this typedef.
/// \param Info Information about this typedef.
void addTypedef(std::optional<Context> Ctx, llvm::StringRef Name,
const TypedefInfo &Info, llvm::VersionTuple SwiftVersion);
};
} // namespace api_notes
} // namespace clang
#endif // LLVM_CLANG_APINOTES_WRITER_H

View file

@ -10,14 +10,25 @@
#define LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
namespace clang {
class FileEntry;
} // namespace clang
namespace clang {
namespace api_notes {
/// Parses the APINotes YAML content and writes the representation back to the
/// specified stream. This provides a means of testing the YAML processing of
/// the APINotes format.
bool parseAndDumpAPINotes(llvm::StringRef YI, llvm::raw_ostream &OS);
/// Converts API notes from YAML format to binary format.
bool compileAPINotes(llvm::StringRef YAMLInput, const FileEntry *SourceFile,
llvm::raw_ostream &OS,
llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
void *DiagHandlerCtxt = nullptr);
} // namespace api_notes
} // namespace clang

View file

@ -10,6 +10,7 @@
#define LLVM_CLANG_APINOTES_TYPES_H
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include <climits>
#include <optional>
@ -143,16 +144,10 @@ public:
return SwiftBridge;
}
void setSwiftBridge(const std::optional<std::string> &SwiftType) {
void setSwiftBridge(std::optional<std::string> SwiftType) {
SwiftBridge = SwiftType;
}
void setSwiftBridge(const std::optional<llvm::StringRef> &SwiftType) {
SwiftBridge = SwiftType
? std::optional<std::string>(std::string(*SwiftType))
: std::nullopt;
}
const std::optional<std::string> &getNSErrorDomain() const {
return NSErrorDomain;
}
@ -659,6 +654,10 @@ class TagInfo : public CommonTypeInfo {
unsigned IsFlagEnum : 1;
public:
std::optional<std::string> SwiftImportAs;
std::optional<std::string> SwiftRetainOp;
std::optional<std::string> SwiftReleaseOp;
std::optional<EnumExtensibilityKind> EnumExtensibility;
TagInfo() : HasFlagEnum(0), IsFlagEnum(0) {}
@ -676,6 +675,13 @@ public:
TagInfo &operator|=(const TagInfo &RHS) {
static_cast<CommonTypeInfo &>(*this) |= RHS;
if (!SwiftImportAs)
SwiftImportAs = RHS.SwiftImportAs;
if (!SwiftRetainOp)
SwiftRetainOp = RHS.SwiftRetainOp;
if (!SwiftReleaseOp)
SwiftReleaseOp = RHS.SwiftReleaseOp;
if (!HasFlagEnum)
setFlagEnum(RHS.isFlagEnum());
@ -692,6 +698,9 @@ public:
inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) {
return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
LHS.SwiftImportAs == RHS.SwiftImportAs &&
LHS.SwiftRetainOp == RHS.SwiftRetainOp &&
LHS.SwiftReleaseOp == RHS.SwiftReleaseOp &&
LHS.isFlagEnum() == RHS.isFlagEnum() &&
LHS.EnumExtensibility == RHS.EnumExtensibility;
}
@ -727,6 +736,42 @@ inline bool operator==(const TypedefInfo &LHS, const TypedefInfo &RHS) {
inline bool operator!=(const TypedefInfo &LHS, const TypedefInfo &RHS) {
return !(LHS == RHS);
}
/// The file extension used for the source representation of API notes.
static const constexpr char SOURCE_APINOTES_EXTENSION[] = "apinotes";
/// Opaque context ID used to refer to an Objective-C class or protocol or a C++
/// namespace.
class ContextID {
public:
unsigned Value;
explicit ContextID(unsigned value) : Value(value) {}
};
enum class ContextKind : uint8_t {
ObjCClass = 0,
ObjCProtocol = 1,
Namespace = 2,
};
struct Context {
ContextID id;
ContextKind kind;
Context(ContextID id, ContextKind kind) : id(id), kind(kind) {}
};
/// A temporary reference to an Objective-C selector, suitable for
/// referencing selector data on the stack.
///
/// Instances of this struct do not store references to any of the
/// data they contain; it is up to the user to ensure that the data
/// referenced by the identifier list persists.
struct ObjCSelectorRef {
unsigned NumArgs;
llvm::ArrayRef<llvm::StringRef> Identifiers;
};
} // namespace api_notes
} // namespace clang

View file

@ -102,7 +102,7 @@ class MigrationProcess {
public:
bool HadARCErrors;
MigrationProcess(const CompilerInvocation &CI,
MigrationProcess(CompilerInvocation &CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
DiagnosticConsumer *diagClient,
StringRef outputDir = StringRef());

View file

@ -9,12 +9,13 @@
#ifndef LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
#define LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
#include "clang/Basic/FileEntry.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
#include <variant>
namespace llvm {
class MemoryBuffer;
@ -23,7 +24,6 @@ namespace llvm {
namespace clang {
class FileManager;
class FileEntry;
class DiagnosticsEngine;
class PreprocessorOptions;
@ -33,11 +33,11 @@ class FileRemapper {
// FIXME: Reuse the same FileManager for multiple ASTContexts.
std::unique_ptr<FileManager> FileMgr;
typedef llvm::PointerUnion<const FileEntry *, llvm::MemoryBuffer *> Target;
typedef llvm::DenseMap<const FileEntry *, Target> MappingsTy;
using Target = std::variant<FileEntryRef, llvm::MemoryBuffer *>;
using MappingsTy = llvm::DenseMap<FileEntryRef, Target>;
MappingsTy FromToMappings;
llvm::DenseMap<const FileEntry *, const FileEntry *> ToFromMappings;
llvm::DenseMap<const FileEntry *, FileEntryRef> ToFromMappings;
public:
FileRemapper();
@ -66,10 +66,10 @@ public:
void clear(StringRef outputDir = StringRef());
private:
void remap(const FileEntry *file, std::unique_ptr<llvm::MemoryBuffer> memBuf);
void remap(const FileEntry *file, const FileEntry *newfile);
void remap(FileEntryRef file, std::unique_ptr<llvm::MemoryBuffer> memBuf);
void remap(FileEntryRef file, FileEntryRef newfile);
const FileEntry *getOriginalFile(StringRef filePath);
OptionalFileEntryRef getOriginalFile(StringRef filePath);
void resetTarget(Target &targ);
bool report(const Twine &err, DiagnosticsEngine &Diag);

View file

@ -270,12 +270,16 @@ private:
APValue *Elts = nullptr;
unsigned NumElts = 0;
Vec() = default;
Vec(const Vec &) = delete;
Vec &operator=(const Vec &) = delete;
~Vec() { delete[] Elts; }
};
struct Arr {
APValue *Elts;
unsigned NumElts, ArrSize;
Arr(unsigned NumElts, unsigned ArrSize);
Arr(const Arr &) = delete;
Arr &operator=(const Arr &) = delete;
~Arr();
};
struct StructData {
@ -283,12 +287,16 @@ private:
unsigned NumBases;
unsigned NumFields;
StructData(unsigned NumBases, unsigned NumFields);
StructData(const StructData &) = delete;
StructData &operator=(const StructData &) = delete;
~StructData();
};
struct UnionData {
const FieldDecl *Field;
APValue *Value;
UnionData();
UnionData(const UnionData &) = delete;
UnionData &operator=(const UnionData &) = delete;
~UnionData();
};
struct AddrLabelDiffData {

View file

@ -14,14 +14,21 @@
#ifndef LLVM_CLANG_AST_ASTCONCEPT_H
#define LLVM_CLANG_AST_ASTCONCEPT_H
#include "clang/AST/Expr.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateBase.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/SmallVector.h"
#include <utility>
namespace clang {
class ConceptDecl;
class Expr;
class NamedDecl;
struct PrintingPolicy;
/// The result of a constraint satisfaction check, containing the necessary
/// information to diagnose an unsatisfied constraint.
@ -107,10 +114,18 @@ struct ASTConstraintSatisfaction final :
Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction);
};
/// \brief Common data class for constructs that reference concepts with
/// template arguments.
/// A reference to a concept and its template args, as it appears in the code.
///
/// Examples:
/// template <int X> requires is_even<X> int half = X/2;
/// ~~~~~~~~~~ (in ConceptSpecializationExpr)
///
/// std::input_iterator auto I = Container.begin();
/// ~~~~~~~~~~~~~~~~~~~ (in AutoTypeLoc)
///
/// template <std::derives_from<Expr> T> void dump();
/// ~~~~~~~~~~~~~~~~~~~~~~~ (in TemplateTypeParmDecl)
class ConceptReference {
protected:
// \brief The optional nested name specifier used when naming the concept.
NestedNameSpecifierLoc NestedNameSpec;
@ -134,7 +149,6 @@ protected:
/// concept.
const ASTTemplateArgumentListInfo *ArgsAsWritten;
public:
ConceptReference(NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl,
ConceptDecl *NamedConcept,
@ -143,8 +157,12 @@ public:
ConceptName(ConceptNameInfo), FoundDecl(FoundDecl),
NamedConcept(NamedConcept), ArgsAsWritten(ArgsAsWritten) {}
ConceptReference()
: FoundDecl(nullptr), NamedConcept(nullptr), ArgsAsWritten(nullptr) {}
public:
static ConceptReference *
Create(const ASTContext &C, NestedNameSpecifierLoc NNS,
SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo,
NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten);
const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
return NestedNameSpec;
@ -158,6 +176,26 @@ public:
SourceLocation getTemplateKWLoc() const { return TemplateKWLoc; }
SourceLocation getLocation() const { return getConceptNameLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
// Note that if the qualifier is null the template KW must also be null.
if (auto QualifierLoc = getNestedNameSpecifierLoc())
return QualifierLoc.getBeginLoc();
return getConceptNameInfo().getBeginLoc();
}
SourceLocation getEndLoc() const LLVM_READONLY {
return getTemplateArgsAsWritten() &&
getTemplateArgsAsWritten()->getRAngleLoc().isValid()
? getTemplateArgsAsWritten()->getRAngleLoc()
: getConceptNameInfo().getEndLoc();
}
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getBeginLoc(), getEndLoc());
}
NamedDecl *getFoundDecl() const {
return FoundDecl;
}
@ -175,22 +213,32 @@ public:
bool hasExplicitTemplateArgs() const {
return ArgsAsWritten != nullptr;
}
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
void dump() const;
void dump(llvm::raw_ostream &) const;
};
class TypeConstraint : public ConceptReference {
/// Models the abbreviated syntax to constrain a template type parameter:
/// template <convertible_to<string> T> void print(T object);
/// ~~~~~~~~~~~~~~~~~~~~~~
/// Semantically, this adds an "immediately-declared constraint" with extra arg:
/// requires convertible_to<T, string>
///
/// In the C++ grammar, a type-constraint is also used for auto types:
/// convertible_to<string> auto X = ...;
/// We do *not* model these as TypeConstraints, but AutoType(Loc) directly.
class TypeConstraint {
/// \brief The immediately-declared constraint expression introduced by this
/// type-constraint.
Expr *ImmediatelyDeclaredConstraint = nullptr;
ConceptReference *ConceptRef;
public:
TypeConstraint(NestedNameSpecifierLoc NNS,
DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl,
ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
Expr *ImmediatelyDeclaredConstraint) :
ConceptReference(NNS, /*TemplateKWLoc=*/SourceLocation(), ConceptNameInfo,
FoundDecl, NamedConcept, ArgsAsWritten),
ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint) {}
TypeConstraint(ConceptReference *ConceptRef,
Expr *ImmediatelyDeclaredConstraint)
: ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint),
ConceptRef(ConceptRef) {}
/// \brief Get the immediately-declared constraint expression introduced by
/// this type-constraint, that is - the constraint expression that is added to
@ -199,7 +247,41 @@ public:
return ImmediatelyDeclaredConstraint;
}
void print(llvm::raw_ostream &OS, PrintingPolicy Policy) const;
ConceptReference *getConceptReference() const { return ConceptRef; }
// FIXME: Instead of using these concept related functions the callers should
// directly work with the corresponding ConceptReference.
ConceptDecl *getNamedConcept() const { return ConceptRef->getNamedConcept(); }
SourceLocation getConceptNameLoc() const {
return ConceptRef->getConceptNameLoc();
}
bool hasExplicitTemplateArgs() const {
return ConceptRef->hasExplicitTemplateArgs();
}
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
return ConceptRef->getTemplateArgsAsWritten();
}
SourceLocation getTemplateKWLoc() const {
return ConceptRef->getTemplateKWLoc();
}
NamedDecl *getFoundDecl() const { return ConceptRef->getFoundDecl(); }
const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
return ConceptRef->getNestedNameSpecifierLoc();
}
const DeclarationNameInfo &getConceptNameInfo() const {
return ConceptRef->getConceptNameInfo();
}
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const {
ConceptRef->print(OS, Policy);
}
};
} // clang

View file

@ -21,18 +21,12 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RawCommentList.h"
#include "clang/AST/TemplateName.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/ProfileList.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/XRayLists.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FoldingSet.h"
@ -63,6 +57,7 @@ class ASTMutationListener;
class ASTRecordLayout;
class AtomicExpr;
class BlockExpr;
struct BlockVarCopyInit;
class BuiltinTemplateDecl;
class CharUnits;
class ConceptDecl;
@ -71,16 +66,19 @@ class CXXConstructorDecl;
class CXXMethodDecl;
class CXXRecordDecl;
class DiagnosticsEngine;
class ParentMapContext;
class DynTypedNodeList;
class Expr;
enum class FloatModeKind;
class GlobalDecl;
class IdentifierTable;
class LangOptions;
class MangleContext;
class MangleNumberingContext;
class MemberSpecializationInfo;
class Module;
struct MSGuidDeclParts;
class NestedNameSpecifier;
class NoSanitizeList;
class ObjCCategoryDecl;
class ObjCCategoryImplDecl;
class ObjCContainerDecl;
@ -94,8 +92,10 @@ class ObjCPropertyImplDecl;
class ObjCProtocolDecl;
class ObjCTypeParamDecl;
class OMPTraitInfo;
class ParentMapContext;
struct ParsedTargetAttr;
class Preprocessor;
class ProfileList;
class StoredDeclsMap;
class TargetAttr;
class TargetInfo;
@ -108,7 +108,7 @@ class UnresolvedSetIterator;
class UsingShadowDecl;
class VarTemplateDecl;
class VTableContextBase;
struct BlockVarCopyInit;
class XRayFunctionFilter;
namespace Builtin {
@ -195,20 +195,25 @@ class ASTContext : public RefCountedBase<ASTContext> {
ConstantArrayTypes;
mutable llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes;
mutable std::vector<VariableArrayType*> VariableArrayTypes;
mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes;
mutable llvm::FoldingSet<DependentSizedExtVectorType>
DependentSizedExtVectorTypes;
mutable llvm::FoldingSet<DependentAddressSpaceType>
mutable llvm::ContextualFoldingSet<DependentSizedArrayType, ASTContext &>
DependentSizedArrayTypes;
mutable llvm::ContextualFoldingSet<DependentSizedExtVectorType, ASTContext &>
DependentSizedExtVectorTypes;
mutable llvm::ContextualFoldingSet<DependentAddressSpaceType, ASTContext &>
DependentAddressSpaceTypes;
mutable llvm::FoldingSet<VectorType> VectorTypes;
mutable llvm::FoldingSet<DependentVectorType> DependentVectorTypes;
mutable llvm::ContextualFoldingSet<DependentVectorType, ASTContext &>
DependentVectorTypes;
mutable llvm::FoldingSet<ConstantMatrixType> MatrixTypes;
mutable llvm::FoldingSet<DependentSizedMatrixType> DependentSizedMatrixTypes;
mutable llvm::ContextualFoldingSet<DependentSizedMatrixType, ASTContext &>
DependentSizedMatrixTypes;
mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
FunctionProtoTypes;
mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
mutable llvm::ContextualFoldingSet<DependentTypeOfExprType, ASTContext &>
DependentTypeOfExprTypes;
mutable llvm::ContextualFoldingSet<DependentDecltypeType, ASTContext &>
DependentDecltypeTypes;
mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
mutable llvm::FoldingSet<ObjCTypeParamType> ObjCTypeParamTypes;
mutable llvm::FoldingSet<SubstTemplateTypeParmType>
@ -238,7 +243,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
mutable llvm::FoldingSet<AttributedType> AttributedTypes;
mutable llvm::FoldingSet<PipeType> PipeTypes;
mutable llvm::FoldingSet<BitIntType> BitIntTypes;
mutable llvm::FoldingSet<DependentBitIntType> DependentBitIntTypes;
mutable llvm::ContextualFoldingSet<DependentBitIntType, ASTContext &>
DependentBitIntTypes;
llvm::FoldingSet<BTFTagAttributedType> BTFTagAttributedTypes;
mutable llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
@ -1141,12 +1147,19 @@ public:
mutable TagDecl *MSGuidTagDecl = nullptr;
/// Keep track of CUDA/HIP device-side variables ODR-used by host code.
/// This does not include extern shared variables used by device host
/// functions as addresses of shared variables are per warp, therefore
/// cannot be accessed by host code.
llvm::DenseSet<const VarDecl *> CUDADeviceVarODRUsedByHost;
/// Keep track of CUDA/HIP external kernels or device variables ODR-used by
/// host code.
llvm::DenseSet<const ValueDecl *> CUDAExternalDeviceDeclODRUsedByHost;
/// Keep track of CUDA/HIP implicit host device functions used on device side
/// in device compilation.
llvm::DenseSet<const FunctionDecl *> CUDAImplicitHostDeviceFunUsedByDevice;
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents,
SelectorTable &sels, Builtin::Context &builtins,
TranslationUnitKind TUKind);
@ -1188,8 +1201,9 @@ public:
/// Create a new implicit TU-level CXXRecordDecl or RecordDecl
/// declaration.
RecordDecl *buildImplicitRecord(StringRef Name,
RecordDecl::TagKind TK = TTK_Struct) const;
RecordDecl *buildImplicitRecord(
StringRef Name,
RecordDecl::TagKind TK = RecordDecl::TagKind::Struct) const;
/// Create a new implicit TU-level typedef declaration.
TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;
@ -1421,8 +1435,7 @@ public:
/// Return a non-unique reference to the type for a variable array of
/// the specified element type.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts,
ArrayType::ArraySizeModifier ASM,
unsigned IndexTypeQuals,
ArraySizeModifier ASM, unsigned IndexTypeQuals,
SourceRange Brackets) const;
/// Return a non-unique reference to the type for a dependently-sized
@ -1431,21 +1444,19 @@ public:
/// FIXME: We will need these to be uniqued, or at least comparable, at some
/// point.
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts,
ArrayType::ArraySizeModifier ASM,
ArraySizeModifier ASM,
unsigned IndexTypeQuals,
SourceRange Brackets) const;
/// Return a unique reference to the type for an incomplete array of
/// the specified element type.
QualType getIncompleteArrayType(QualType EltTy,
ArrayType::ArraySizeModifier ASM,
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM,
unsigned IndexTypeQuals) const;
/// Return the unique reference to the type for a constant array of
/// the specified element type.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize,
const Expr *SizeExpr,
ArrayType::ArraySizeModifier ASM,
const Expr *SizeExpr, ArraySizeModifier ASM,
unsigned IndexTypeQuals) const;
/// Return a type for a constant array for a string literal of the
@ -1487,12 +1498,12 @@ public:
///
/// \pre \p VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts,
VectorType::VectorKind VecKind) const;
VectorKind VecKind) const;
/// Return the unique reference to the type for a dependently sized vector of
/// the specified element type.
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr,
SourceLocation AttrLoc,
VectorType::VectorKind VecKind) const;
VectorKind VecKind) const;
/// Return the unique reference to an extended vector type
/// of the specified element type and size.
@ -1693,7 +1704,7 @@ public:
/// Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectPointerType(QualType OIT) const;
/// C2x feature and GCC extension.
/// C23 feature and GCC extension.
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const;
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const;

View file

@ -34,6 +34,7 @@ class Attr;
#define ATTR(A) class A##Attr;
#include "clang/Basic/AttrList.inc"
class ObjCProtocolLoc;
class ConceptReference;
} // end namespace clang

View file

@ -35,6 +35,21 @@ inline bool isLambdaCallOperator(const DeclContext *DC) {
return isLambdaCallOperator(cast<CXXMethodDecl>(DC));
}
inline bool isLambdaCallWithExplicitObjectParameter(const DeclContext *DC) {
return isLambdaCallOperator(DC) &&
cast<CXXMethodDecl>(DC)->isExplicitObjectMemberFunction();
}
inline bool isLambdaCallWithImplicitObjectParameter(const DeclContext *DC) {
return isLambdaCallOperator(DC) &&
// FIXME: Checking for a null type is not great
// but lambdas with invalid captures or whose closure parameter list
// have not fully been parsed may have a call operator whose type is
// null.
!cast<CXXMethodDecl>(DC)->getType().isNull() &&
!cast<CXXMethodDecl>(DC)->isExplicitObjectMemberFunction();
}
inline bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD) {
if (!MD) return false;
const CXXRecordDecl *LambdaClass = MD->getParent();

View file

@ -104,8 +104,7 @@ public:
Visit(Comment, Comment);
// Decls within functions are visited by the body.
if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
!isa<BlockDecl>(*D)) {
if (!isa<FunctionDecl, ObjCMethodDecl, BlockDecl>(*D)) {
if (Traversal != TK_AsIs) {
if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
auto SK = CTSD->getSpecializationKind();
@ -253,6 +252,10 @@ public:
});
}
void Visit(const ConceptReference *R) {
getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(R); });
}
void Visit(const APValue &Value, QualType Ty) {
getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(Value, Ty); });
}
@ -289,6 +292,8 @@ public:
Visit(C);
else if (const auto *T = N.get<TemplateArgument>())
Visit(*T);
else if (const auto *CR = N.get<ConceptReference>())
Visit(CR);
}
void dumpDeclContext(const DeclContext *DC) {
@ -421,8 +426,12 @@ public:
}
void VisitFunctionDecl(const FunctionDecl *D) {
if (const auto *FTSI = D->getTemplateSpecializationInfo())
if (FunctionTemplateSpecializationInfo *FTSI =
D->getTemplateSpecializationInfo())
dumpTemplateArgumentList(*FTSI->TemplateArguments);
else if (DependentFunctionTemplateSpecializationInfo *DFTSI =
D->getDependentSpecializationInfo())
dumpASTTemplateArgumentListInfo(DFTSI->TemplateArgumentsAsWritten);
if (D->param_begin())
for (const auto *Parameter : D->parameters())
@ -573,11 +582,6 @@ public:
dumpTemplateParameters(D->getTemplateParameters());
}
void VisitClassScopeFunctionSpecializationDecl(
const ClassScopeFunctionSpecializationDecl *D) {
Visit(D->getSpecialization());
dumpASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
}
void VisitVarTemplateDecl(const VarTemplateDecl *D) { dumpTemplateDecl(D); }
void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {

View file

@ -69,15 +69,19 @@ struct StructuralEquivalenceContext {
/// \c true if the last diagnostic came from ToCtx.
bool LastDiagFromC2 = false;
/// Whether to ignore comparing the depth of template param(TemplateTypeParm)
bool IgnoreTemplateParmDepth;
StructuralEquivalenceContext(
ASTContext &FromCtx, ASTContext &ToCtx,
llvm::DenseSet<std::pair<Decl *, Decl *>> &NonEquivalentDecls,
StructuralEquivalenceKind EqKind,
bool StrictTypeSpelling = false, bool Complain = true,
bool ErrorOnTagTypeMismatch = false)
StructuralEquivalenceKind EqKind, bool StrictTypeSpelling = false,
bool Complain = true, bool ErrorOnTagTypeMismatch = false,
bool IgnoreTemplateParmDepth = false)
: FromCtx(FromCtx), ToCtx(ToCtx), NonEquivalentDecls(NonEquivalentDecls),
EqKind(EqKind), StrictTypeSpelling(StrictTypeSpelling),
ErrorOnTagTypeMismatch(ErrorOnTagTypeMismatch), Complain(Complain) {}
ErrorOnTagTypeMismatch(ErrorOnTagTypeMismatch), Complain(Complain),
IgnoreTemplateParmDepth(IgnoreTemplateParmDepth) {}
DiagnosticBuilder Diag1(SourceLocation Loc, unsigned DiagID);
DiagnosticBuilder Diag2(SourceLocation Loc, unsigned DiagID);

View file

@ -163,6 +163,7 @@ private:
#define ATTR(A) NKI_##A##Attr,
#include "clang/Basic/AttrList.inc"
NKI_ObjCProtocolLoc,
NKI_ConceptReference,
NKI_NumberOfKinds
};
@ -222,6 +223,7 @@ KIND_TO_KIND_ID(OMPClause)
KIND_TO_KIND_ID(Attr)
KIND_TO_KIND_ID(ObjCProtocolLoc)
KIND_TO_KIND_ID(CXXBaseSpecifier)
KIND_TO_KIND_ID(ConceptReference)
#define DECL(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Decl)
#include "clang/AST/DeclNodes.inc"
#define STMT(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED)
@ -582,6 +584,10 @@ template <>
struct DynTypedNode::BaseConverter<ObjCProtocolLoc, void>
: public ValueConverter<ObjCProtocolLoc> {};
template <>
struct DynTypedNode::BaseConverter<ConceptReference, void>
: public PtrConverter<ConceptReference> {};
// The only operation we allow on unsupported types is \c get.
// This allows to conveniently use \c DynTypedNode when having an arbitrary
// AST node that is not supported, but prevents misuse - a user cannot create

View file

@ -19,11 +19,12 @@
#include "clang/AST/Type.h"
#include "clang/Basic/AttrKinds.h"
#include "clang/Basic/AttributeCommonInfo.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/Frontend/HLSL/HLSLResource.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
@ -39,17 +40,23 @@ class OMPTraitInfo;
/// Attr - This represents one attribute.
class Attr : public AttributeCommonInfo {
private:
LLVM_PREFERRED_TYPE(attr::Kind)
unsigned AttrKind : 16;
protected:
/// An index into the spelling list of an
/// attribute defined in Attr.td file.
LLVM_PREFERRED_TYPE(bool)
unsigned Inherited : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IsPackExpansion : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned Implicit : 1;
// FIXME: These are properties of the attribute kind, not state for this
// instance of the attribute.
LLVM_PREFERRED_TYPE(bool)
unsigned IsLateParsed : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned InheritEvenIfAlreadyPresent : 1;
void *operator new(size_t bytes) noexcept {
@ -242,7 +249,9 @@ public:
class ParamIdx {
// Idx is exposed only via accessors that specify specific encodings.
unsigned Idx : 30;
LLVM_PREFERRED_TYPE(bool)
unsigned HasThis : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IsValid : 1;
void assertComparable(const ParamIdx &I) const {

View file

@ -20,7 +20,6 @@
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
@ -131,6 +130,7 @@ class CXXBasePaths {
/// class subobjects for that class type. The key of the map is
/// the cv-unqualified canonical type of the base class subobject.
struct IsVirtBaseAndNumberNonVirtBases {
LLVM_PREFERRED_TYPE(bool)
unsigned IsVirtBase : 1;
unsigned NumberOfNonVirtBases : 31;
};

View file

@ -27,6 +27,8 @@ class TemplateParameterList;
namespace comments {
class FullComment;
enum class InlineCommandRenderKind;
enum class ParamCommandPassDirection;
/// Describes the syntax that was used in a documentation command.
///
@ -47,6 +49,17 @@ enum CommandMarkerKind {
CMK_At = 1
};
enum class CommentKind {
None = 0,
#define COMMENT(CLASS, PARENT) CLASS,
#define COMMENT_RANGE(BASE, FIRST, LAST) \
First##BASE##Constant = FIRST, Last##BASE##Constant = LAST,
#define LAST_COMMENT_RANGE(BASE, FIRST, LAST) \
First##BASE##Constant = FIRST, Last##BASE##Constant = LAST
#define ABSTRACT_COMMENT(COMMENT)
#include "clang/AST/CommentNodes.inc"
};
/// Any part of the comment.
/// Abstract class.
class Comment {
@ -61,6 +74,7 @@ protected:
friend class Comment;
/// Type of this AST node.
LLVM_PREFERRED_TYPE(CommentKind)
unsigned Kind : 8;
};
enum { NumCommentBits = 8 };
@ -68,10 +82,12 @@ protected:
class InlineContentCommentBitfields {
friend class InlineContentComment;
LLVM_PREFERRED_TYPE(CommentBitfields)
unsigned : NumCommentBits;
/// True if there is a newline after this inline content node.
/// (There is no separate AST node for a newline.)
LLVM_PREFERRED_TYPE(bool)
unsigned HasTrailingNewline : 1;
};
enum { NumInlineContentCommentBits = NumCommentBits + 1 };
@ -79,12 +95,15 @@ protected:
class TextCommentBitfields {
friend class TextComment;
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
unsigned : NumInlineContentCommentBits;
/// True if \c IsWhitespace field contains a valid value.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned IsWhitespaceValid : 1;
/// True if this comment AST node contains only whitespace.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned IsWhitespace : 1;
};
enum { NumTextCommentBits = NumInlineContentCommentBits + 2 };
@ -92,10 +111,13 @@ protected:
class InlineCommandCommentBitfields {
friend class InlineCommandComment;
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
unsigned : NumInlineContentCommentBits;
LLVM_PREFERRED_TYPE(InlineCommandRenderKind)
unsigned RenderKind : 3;
LLVM_PREFERRED_TYPE(CommandTraits::KnownCommandIDs)
unsigned CommandID : CommandInfo::NumCommandIDBits;
};
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 3 +
@ -104,9 +126,11 @@ protected:
class HTMLTagCommentBitfields {
friend class HTMLTagComment;
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
unsigned : NumInlineContentCommentBits;
/// True if we found that this tag is malformed in some way.
LLVM_PREFERRED_TYPE(bool)
unsigned IsMalformed : 1;
};
enum { NumHTMLTagCommentBits = NumInlineContentCommentBits + 1 };
@ -114,10 +138,12 @@ protected:
class HTMLStartTagCommentBitfields {
friend class HTMLStartTagComment;
LLVM_PREFERRED_TYPE(HTMLTagCommentBitfields)
unsigned : NumHTMLTagCommentBits;
/// True if this tag is self-closing (e. g., <br />). This is based on tag
/// spelling in comment (plain <br> would not set this flag).
LLVM_PREFERRED_TYPE(bool)
unsigned IsSelfClosing : 1;
};
enum { NumHTMLStartTagCommentBits = NumHTMLTagCommentBits + 1 };
@ -125,12 +151,15 @@ protected:
class ParagraphCommentBitfields {
friend class ParagraphComment;
LLVM_PREFERRED_TYPE(CommentBitfields)
unsigned : NumCommentBits;
/// True if \c IsWhitespace field contains a valid value.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned IsWhitespaceValid : 1;
/// True if this comment AST node contains only whitespace.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned IsWhitespace : 1;
};
enum { NumParagraphCommentBits = NumCommentBits + 2 };
@ -138,12 +167,15 @@ protected:
class BlockCommandCommentBitfields {
friend class BlockCommandComment;
LLVM_PREFERRED_TYPE(CommentBitfields)
unsigned : NumCommentBits;
LLVM_PREFERRED_TYPE(CommandTraits::KnownCommandIDs)
unsigned CommandID : CommandInfo::NumCommandIDBits;
/// Describes the syntax that was used in a documentation command.
/// Contains values from CommandMarkerKind enum.
LLVM_PREFERRED_TYPE(CommandMarkerKind)
unsigned CommandMarker : 1;
};
enum { NumBlockCommandCommentBits = NumCommentBits +
@ -152,12 +184,15 @@ protected:
class ParamCommandCommentBitfields {
friend class ParamCommandComment;
LLVM_PREFERRED_TYPE(BlockCommandCommentBitfields)
unsigned : NumBlockCommandCommentBits;
/// Parameter passing direction, see ParamCommandComment::PassDirection.
/// Parameter passing direction.
LLVM_PREFERRED_TYPE(ParamCommandPassDirection)
unsigned Direction : 2;
/// True if direction was specified explicitly in the comment.
LLVM_PREFERRED_TYPE(bool)
unsigned IsDirectionExplicit : 1;
};
enum { NumParamCommandCommentBits = NumBlockCommandCommentBits + 3 };
@ -183,17 +218,6 @@ protected:
}
public:
enum CommentKind {
NoCommentKind = 0,
#define COMMENT(CLASS, PARENT) CLASS##Kind,
#define COMMENT_RANGE(BASE, FIRST, LAST) \
First##BASE##Constant=FIRST##Kind, Last##BASE##Constant=LAST##Kind,
#define LAST_COMMENT_RANGE(BASE, FIRST, LAST) \
First##BASE##Constant=FIRST##Kind, Last##BASE##Constant=LAST##Kind
#define ABSTRACT_COMMENT(COMMENT)
#include "clang/AST/CommentNodes.inc"
};
struct Argument {
SourceRange Range;
StringRef Text;
@ -203,7 +227,7 @@ public:
SourceLocation LocBegin,
SourceLocation LocEnd) :
Loc(LocBegin), Range(SourceRange(LocBegin, LocEnd)) {
CommentBits.Kind = K;
CommentBits.Kind = llvm::to_underlying(K);
}
CommentKind getCommentKind() const {
@ -249,8 +273,9 @@ protected:
public:
static bool classof(const Comment *C) {
return C->getCommentKind() >= FirstInlineContentCommentConstant &&
C->getCommentKind() <= LastInlineContentCommentConstant;
return C->getCommentKind() >=
CommentKind::FirstInlineContentCommentConstant &&
C->getCommentKind() <= CommentKind::LastInlineContentCommentConstant;
}
void addTrailingNewline() {
@ -267,16 +292,14 @@ class TextComment : public InlineContentComment {
StringRef Text;
public:
TextComment(SourceLocation LocBegin,
SourceLocation LocEnd,
StringRef Text) :
InlineContentComment(TextCommentKind, LocBegin, LocEnd),
Text(Text) {
TextComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef Text)
: InlineContentComment(CommentKind::TextComment, LocBegin, LocEnd),
Text(Text) {
TextCommentBits.IsWhitespaceValid = false;
}
static bool classof(const Comment *C) {
return C->getCommentKind() == TextCommentKind;
return C->getCommentKind() == CommentKind::TextComment;
}
child_iterator child_begin() const { return nullptr; }
@ -298,37 +321,35 @@ private:
bool isWhitespaceNoCache() const;
};
/// The most appropriate rendering mode for this command, chosen on command
/// semantics in Doxygen.
enum class InlineCommandRenderKind {
Normal,
Bold,
Monospaced,
Emphasized,
Anchor
};
/// A command with word-like arguments that is considered inline content.
class InlineCommandComment : public InlineContentComment {
public:
/// The most appropriate rendering mode for this command, chosen on command
/// semantics in Doxygen.
enum RenderKind {
RenderNormal,
RenderBold,
RenderMonospaced,
RenderEmphasized,
RenderAnchor
};
protected:
/// Command arguments.
ArrayRef<Argument> Args;
public:
InlineCommandComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID,
RenderKind RK,
ArrayRef<Argument> Args) :
InlineContentComment(InlineCommandCommentKind, LocBegin, LocEnd),
Args(Args) {
InlineCommandCommentBits.RenderKind = RK;
InlineCommandComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID, InlineCommandRenderKind RK,
ArrayRef<Argument> Args)
: InlineContentComment(CommentKind::InlineCommandComment, LocBegin,
LocEnd),
Args(Args) {
InlineCommandCommentBits.RenderKind = llvm::to_underlying(RK);
InlineCommandCommentBits.CommandID = CommandID;
}
static bool classof(const Comment *C) {
return C->getCommentKind() == InlineCommandCommentKind;
return C->getCommentKind() == CommentKind::InlineCommandComment;
}
child_iterator child_begin() const { return nullptr; }
@ -347,8 +368,9 @@ public:
return SourceRange(getBeginLoc().getLocWithOffset(-1), getEndLoc());
}
RenderKind getRenderKind() const {
return static_cast<RenderKind>(InlineCommandCommentBits.RenderKind);
InlineCommandRenderKind getRenderKind() const {
return static_cast<InlineCommandRenderKind>(
InlineCommandCommentBits.RenderKind);
}
unsigned getNumArgs() const {
@ -386,8 +408,8 @@ protected:
public:
static bool classof(const Comment *C) {
return C->getCommentKind() >= FirstHTMLTagCommentConstant &&
C->getCommentKind() <= LastHTMLTagCommentConstant;
return C->getCommentKind() >= CommentKind::FirstHTMLTagCommentConstant &&
C->getCommentKind() <= CommentKind::LastHTMLTagCommentConstant;
}
StringRef getTagName() const LLVM_READONLY { return TagName; }
@ -443,18 +465,16 @@ private:
ArrayRef<Attribute> Attributes;
public:
HTMLStartTagComment(SourceLocation LocBegin,
StringRef TagName) :
HTMLTagComment(HTMLStartTagCommentKind,
LocBegin, LocBegin.getLocWithOffset(1 + TagName.size()),
TagName,
LocBegin.getLocWithOffset(1),
LocBegin.getLocWithOffset(1 + TagName.size())) {
HTMLStartTagComment(SourceLocation LocBegin, StringRef TagName)
: HTMLTagComment(CommentKind::HTMLStartTagComment, LocBegin,
LocBegin.getLocWithOffset(1 + TagName.size()), TagName,
LocBegin.getLocWithOffset(1),
LocBegin.getLocWithOffset(1 + TagName.size())) {
HTMLStartTagCommentBits.IsSelfClosing = false;
}
static bool classof(const Comment *C) {
return C->getCommentKind() == HTMLStartTagCommentKind;
return C->getCommentKind() == CommentKind::HTMLStartTagComment;
}
child_iterator child_begin() const { return nullptr; }
@ -498,18 +518,14 @@ public:
/// A closing HTML tag.
class HTMLEndTagComment : public HTMLTagComment {
public:
HTMLEndTagComment(SourceLocation LocBegin,
SourceLocation LocEnd,
StringRef TagName) :
HTMLTagComment(HTMLEndTagCommentKind,
LocBegin, LocEnd,
TagName,
LocBegin.getLocWithOffset(2),
LocBegin.getLocWithOffset(2 + TagName.size()))
{ }
HTMLEndTagComment(SourceLocation LocBegin, SourceLocation LocEnd,
StringRef TagName)
: HTMLTagComment(CommentKind::HTMLEndTagComment, LocBegin, LocEnd,
TagName, LocBegin.getLocWithOffset(2),
LocBegin.getLocWithOffset(2 + TagName.size())) {}
static bool classof(const Comment *C) {
return C->getCommentKind() == HTMLEndTagCommentKind;
return C->getCommentKind() == CommentKind::HTMLEndTagComment;
}
child_iterator child_begin() const { return nullptr; }
@ -529,8 +545,9 @@ protected:
public:
static bool classof(const Comment *C) {
return C->getCommentKind() >= FirstBlockContentCommentConstant &&
C->getCommentKind() <= LastBlockContentCommentConstant;
return C->getCommentKind() >=
CommentKind::FirstBlockContentCommentConstant &&
C->getCommentKind() <= CommentKind::LastBlockContentCommentConstant;
}
};
@ -539,11 +556,10 @@ class ParagraphComment : public BlockContentComment {
ArrayRef<InlineContentComment *> Content;
public:
ParagraphComment(ArrayRef<InlineContentComment *> Content) :
BlockContentComment(ParagraphCommentKind,
SourceLocation(),
SourceLocation()),
Content(Content) {
ParagraphComment(ArrayRef<InlineContentComment *> Content)
: BlockContentComment(CommentKind::ParagraphComment, SourceLocation(),
SourceLocation()),
Content(Content) {
if (Content.empty()) {
ParagraphCommentBits.IsWhitespace = true;
ParagraphCommentBits.IsWhitespaceValid = true;
@ -558,7 +574,7 @@ public:
}
static bool classof(const Comment *C) {
return C->getCommentKind() == ParagraphCommentKind;
return C->getCommentKind() == CommentKind::ParagraphComment;
}
child_iterator child_begin() const {
@ -606,20 +622,19 @@ protected:
}
public:
BlockCommandComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID,
CommandMarkerKind CommandMarker) :
BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
Paragraph(nullptr) {
BlockCommandComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID, CommandMarkerKind CommandMarker)
: BlockContentComment(CommentKind::BlockCommandComment, LocBegin, LocEnd),
Paragraph(nullptr) {
setLocation(getCommandNameBeginLoc());
BlockCommandCommentBits.CommandID = CommandID;
BlockCommandCommentBits.CommandMarker = CommandMarker;
}
static bool classof(const Comment *C) {
return C->getCommentKind() >= FirstBlockCommandCommentConstant &&
C->getCommentKind() <= LastBlockCommandCommentConstant;
return C->getCommentKind() >=
CommentKind::FirstBlockCommandCommentConstant &&
C->getCommentKind() <= CommentKind::LastBlockCommandCommentConstant;
}
child_iterator child_begin() const {
@ -690,6 +705,8 @@ public:
}
};
enum class ParamCommandPassDirection { In, Out, InOut };
/// Doxygen \\param command.
class ParamCommandComment : public BlockCommandComment {
private:
@ -702,39 +719,33 @@ public:
VarArgParamIndex = ~0U/*InvalidParamIndex*/ - 1U
};
ParamCommandComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID,
CommandMarkerKind CommandMarker) :
BlockCommandComment(ParamCommandCommentKind, LocBegin, LocEnd,
CommandID, CommandMarker),
ParamIndex(InvalidParamIndex) {
ParamCommandCommentBits.Direction = In;
ParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID, CommandMarkerKind CommandMarker)
: BlockCommandComment(CommentKind::ParamCommandComment, LocBegin, LocEnd,
CommandID, CommandMarker),
ParamIndex(InvalidParamIndex) {
ParamCommandCommentBits.Direction =
llvm::to_underlying(ParamCommandPassDirection::In);
ParamCommandCommentBits.IsDirectionExplicit = false;
}
static bool classof(const Comment *C) {
return C->getCommentKind() == ParamCommandCommentKind;
return C->getCommentKind() == CommentKind::ParamCommandComment;
}
enum PassDirection {
In,
Out,
InOut
};
static const char *getDirectionAsString(ParamCommandPassDirection D);
static const char *getDirectionAsString(PassDirection D);
PassDirection getDirection() const LLVM_READONLY {
return static_cast<PassDirection>(ParamCommandCommentBits.Direction);
ParamCommandPassDirection getDirection() const LLVM_READONLY {
return static_cast<ParamCommandPassDirection>(
ParamCommandCommentBits.Direction);
}
bool isDirectionExplicit() const LLVM_READONLY {
return ParamCommandCommentBits.IsDirectionExplicit;
}
void setDirection(PassDirection Direction, bool Explicit) {
ParamCommandCommentBits.Direction = Direction;
void setDirection(ParamCommandPassDirection Direction, bool Explicit) {
ParamCommandCommentBits.Direction = llvm::to_underlying(Direction);
ParamCommandCommentBits.IsDirectionExplicit = Explicit;
}
@ -796,16 +807,13 @@ private:
ArrayRef<unsigned> Position;
public:
TParamCommandComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID,
CommandMarkerKind CommandMarker) :
BlockCommandComment(TParamCommandCommentKind, LocBegin, LocEnd, CommandID,
CommandMarker)
{ }
TParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID, CommandMarkerKind CommandMarker)
: BlockCommandComment(CommentKind::TParamCommandComment, LocBegin, LocEnd,
CommandID, CommandMarker) {}
static bool classof(const Comment *C) {
return C->getCommentKind() == TParamCommandCommentKind;
return C->getCommentKind() == CommentKind::TParamCommandComment;
}
bool hasParamName() const {
@ -847,16 +855,13 @@ class VerbatimBlockLineComment : public Comment {
StringRef Text;
public:
VerbatimBlockLineComment(SourceLocation LocBegin,
StringRef Text) :
Comment(VerbatimBlockLineCommentKind,
LocBegin,
LocBegin.getLocWithOffset(Text.size())),
Text(Text)
{ }
VerbatimBlockLineComment(SourceLocation LocBegin, StringRef Text)
: Comment(CommentKind::VerbatimBlockLineComment, LocBegin,
LocBegin.getLocWithOffset(Text.size())),
Text(Text) {}
static bool classof(const Comment *C) {
return C->getCommentKind() == VerbatimBlockLineCommentKind;
return C->getCommentKind() == CommentKind::VerbatimBlockLineComment;
}
child_iterator child_begin() const { return nullptr; }
@ -878,16 +883,15 @@ protected:
ArrayRef<VerbatimBlockLineComment *> Lines;
public:
VerbatimBlockComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID) :
BlockCommandComment(VerbatimBlockCommentKind,
LocBegin, LocEnd, CommandID,
CMK_At) // FIXME: improve source fidelity.
{ }
VerbatimBlockComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID)
: BlockCommandComment(CommentKind::VerbatimBlockComment, LocBegin, LocEnd,
CommandID,
CMK_At) // FIXME: improve source fidelity.
{}
static bool classof(const Comment *C) {
return C->getCommentKind() == VerbatimBlockCommentKind;
return C->getCommentKind() == CommentKind::VerbatimBlockComment;
}
child_iterator child_begin() const {
@ -929,21 +933,16 @@ protected:
SourceLocation TextBegin;
public:
VerbatimLineComment(SourceLocation LocBegin,
SourceLocation LocEnd,
unsigned CommandID,
SourceLocation TextBegin,
StringRef Text) :
BlockCommandComment(VerbatimLineCommentKind,
LocBegin, LocEnd,
CommandID,
CMK_At), // FIXME: improve source fidelity.
Text(Text),
TextBegin(TextBegin)
{ }
VerbatimLineComment(SourceLocation LocBegin, SourceLocation LocEnd,
unsigned CommandID, SourceLocation TextBegin,
StringRef Text)
: BlockCommandComment(CommentKind::VerbatimLineComment, LocBegin, LocEnd,
CommandID,
CMK_At), // FIXME: improve source fidelity.
Text(Text), TextBegin(TextBegin) {}
static bool classof(const Comment *C) {
return C->getCommentKind() == VerbatimLineCommentKind;
return C->getCommentKind() == CommentKind::VerbatimLineComment;
}
child_iterator child_begin() const { return nullptr; }
@ -1036,28 +1035,35 @@ struct DeclInfo {
};
/// If false, only \c CommentDecl is valid.
LLVM_PREFERRED_TYPE(bool)
unsigned IsFilled : 1;
/// Simplified kind of \c CommentDecl, see \c DeclKind enum.
LLVM_PREFERRED_TYPE(DeclKind)
unsigned Kind : 3;
/// Is \c CommentDecl a template declaration.
LLVM_PREFERRED_TYPE(TemplateDeclKind)
unsigned TemplateKind : 2;
/// Is \c CommentDecl an ObjCMethodDecl.
LLVM_PREFERRED_TYPE(bool)
unsigned IsObjCMethod : 1;
/// Is \c CommentDecl a non-static member function of C++ class or
/// instance method of ObjC class.
/// Can be true only if \c IsFunctionDecl is true.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInstanceMethod : 1;
/// Is \c CommentDecl a static member function of C++ class or
/// class method of ObjC class.
/// Can be true only if \c IsFunctionDecl is true.
LLVM_PREFERRED_TYPE(bool)
unsigned IsClassMethod : 1;
/// Is \c CommentDecl something we consider a "function" that's variadic.
LLVM_PREFERRED_TYPE(bool)
unsigned IsVariadic : 1;
void fill();
@ -1079,9 +1085,9 @@ class FullComment : public Comment {
DeclInfo *ThisDeclInfo;
public:
FullComment(ArrayRef<BlockContentComment *> Blocks, DeclInfo *D) :
Comment(FullCommentKind, SourceLocation(), SourceLocation()),
Blocks(Blocks), ThisDeclInfo(D) {
FullComment(ArrayRef<BlockContentComment *> Blocks, DeclInfo *D)
: Comment(CommentKind::FullComment, SourceLocation(), SourceLocation()),
Blocks(Blocks), ThisDeclInfo(D) {
if (Blocks.empty())
return;
@ -1091,7 +1097,7 @@ public:
}
static bool classof(const Comment *C) {
return C->getCommentKind() == FullCommentKind;
return C->getCommentKind() == CommentKind::FullComment;
}
child_iterator child_begin() const {

View file

@ -244,8 +244,7 @@ private:
StringRef Typo,
const TemplateParameterList *TemplateParameters);
InlineCommandComment::RenderKind
getInlineCommandRenderKind(StringRef Name) const;
InlineCommandRenderKind getInlineCommandRenderKind(StringRef Name) const;
};
} // end namespace comments

View file

@ -31,8 +31,9 @@ public:
switch (C->getCommentKind()) {
default: llvm_unreachable("Unknown comment kind!");
#define ABSTRACT_COMMENT(COMMENT)
#define COMMENT(CLASS, PARENT) \
case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
#define COMMENT(CLASS, PARENT) \
case CommentKind::CLASS: \
DISPATCH(CLASS, CLASS);
#include "clang/AST/CommentNodes.inc"
#undef ABSTRACT_COMMENT
#undef COMMENT

View file

@ -75,6 +75,7 @@ class TemplateParameterList;
class TypeAliasTemplateDecl;
class UnresolvedSetImpl;
class VarTemplateDecl;
enum class ImplicitParamKind;
/// The top declaration context.
class TranslationUnitDecl : public Decl,
@ -452,6 +453,8 @@ public:
return hasCachedLinkage();
}
bool isPlaceholderVar(const LangOptions &LangOpts) const;
/// Looks through UsingDecls and ObjCCompatibleAliasDecls for
/// the underlying named decl.
NamedDecl *getUnderlyingDecl() {
@ -967,12 +970,16 @@ private:
friend class ASTDeclReader;
friend class VarDecl;
LLVM_PREFERRED_TYPE(StorageClass)
unsigned SClass : 3;
LLVM_PREFERRED_TYPE(ThreadStorageClassSpecifier)
unsigned TSCSpec : 2;
LLVM_PREFERRED_TYPE(InitializationStyle)
unsigned InitStyle : 2;
/// Whether this variable is an ARC pseudo-__strong variable; see
/// isARCPseudoStrong() for details.
LLVM_PREFERRED_TYPE(bool)
unsigned ARCPseudoStrong : 1;
};
enum { NumVarDeclBits = 8 };
@ -993,22 +1000,27 @@ protected:
friend class ASTDeclReader;
friend class ParmVarDecl;
LLVM_PREFERRED_TYPE(VarDeclBitfields)
unsigned : NumVarDeclBits;
/// Whether this parameter inherits a default argument from a
/// prior declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned HasInheritedDefaultArg : 1;
/// Describes the kind of default argument for this parameter. By default
/// this is none. If this is normal, then the default argument is stored in
/// the \c VarDecl initializer expression unless we were unable to parse
/// (even an invalid) expression for the default argument.
LLVM_PREFERRED_TYPE(DefaultArgKind)
unsigned DefaultArgKind : 2;
/// Whether this parameter undergoes K&R argument promotion.
LLVM_PREFERRED_TYPE(bool)
unsigned IsKNRPromoted : 1;
/// Whether this parameter is an ObjC method parameter or not.
LLVM_PREFERRED_TYPE(bool)
unsigned IsObjCMethodParam : 1;
/// If IsObjCMethodParam, a Decl::ObjCDeclQualifier.
@ -1027,51 +1039,64 @@ protected:
friend class ImplicitParamDecl;
friend class VarDecl;
LLVM_PREFERRED_TYPE(VarDeclBitfields)
unsigned : NumVarDeclBits;
// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
/// Whether this variable is a definition which was demoted due to
/// module merge.
LLVM_PREFERRED_TYPE(bool)
unsigned IsThisDeclarationADemotedDefinition : 1;
/// Whether this variable is the exception variable in a C++ catch
/// or an Objective-C @catch statement.
LLVM_PREFERRED_TYPE(bool)
unsigned ExceptionVar : 1;
/// Whether this local variable could be allocated in the return
/// slot of its function, enabling the named return value optimization
/// (NRVO).
LLVM_PREFERRED_TYPE(bool)
unsigned NRVOVariable : 1;
/// Whether this variable is the for-range-declaration in a C++0x
/// for-range statement.
LLVM_PREFERRED_TYPE(bool)
unsigned CXXForRangeDecl : 1;
/// Whether this variable is the for-in loop declaration in Objective-C.
LLVM_PREFERRED_TYPE(bool)
unsigned ObjCForDecl : 1;
/// Whether this variable is (C++1z) inline.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInline : 1;
/// Whether this variable has (C++1z) inline explicitly specified.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInlineSpecified : 1;
/// Whether this variable is (C++0x) constexpr.
LLVM_PREFERRED_TYPE(bool)
unsigned IsConstexpr : 1;
/// Whether this variable is the implicit variable for a lambda
/// init-capture.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInitCapture : 1;
/// Whether this local extern variable's previous declaration was
/// declared in the same block scope. This controls whether we should merge
/// the type of this declaration with its previous declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned PreviousDeclInSameBlockScope : 1;
/// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or
/// something else.
LLVM_PREFERRED_TYPE(ImplicitParamKind)
unsigned ImplicitParamKind : 3;
LLVM_PREFERRED_TYPE(bool)
unsigned EscapingByref : 1;
};
@ -1652,36 +1677,36 @@ public:
static bool classofKind(Kind K) { return K >= firstVar && K <= lastVar; }
};
/// Defines the kind of the implicit parameter: is this an implicit parameter
/// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured
/// context or something else.
enum class ImplicitParamKind {
/// Parameter for Objective-C 'self' argument
ObjCSelf,
/// Parameter for Objective-C '_cmd' argument
ObjCCmd,
/// Parameter for C++ 'this' argument
CXXThis,
/// Parameter for C++ virtual table pointers
CXXVTT,
/// Parameter for captured context
CapturedContext,
/// Parameter for Thread private variable
ThreadPrivateVar,
/// Other implicit parameter
Other,
};
class ImplicitParamDecl : public VarDecl {
void anchor() override;
public:
/// Defines the kind of the implicit parameter: is this an implicit parameter
/// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured
/// context or something else.
enum ImplicitParamKind : unsigned {
/// Parameter for Objective-C 'self' argument
ObjCSelf,
/// Parameter for Objective-C '_cmd' argument
ObjCCmd,
/// Parameter for C++ 'this' argument
CXXThis,
/// Parameter for C++ virtual table pointers
CXXVTT,
/// Parameter for captured context
CapturedContext,
/// Parameter for Thread private variable
ThreadPrivateVar,
/// Other implicit parameter
Other,
};
/// Create implicit parameter.
static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation IdLoc, IdentifierInfo *Id,
@ -1696,7 +1721,7 @@ public:
ImplicitParamKind ParamKind)
: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
/*TInfo=*/nullptr, SC_None) {
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
NonParmVarDeclBits.ImplicitParamKind = llvm::to_underlying(ParamKind);
setImplicit();
}
@ -1704,7 +1729,7 @@ public:
: VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
SourceLocation(), /*Id=*/nullptr, Type,
/*TInfo=*/nullptr, SC_None) {
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
NonParmVarDeclBits.ImplicitParamKind = llvm::to_underlying(ParamKind);
setImplicit();
}
@ -1807,6 +1832,18 @@ public:
ParmVarDeclBits.IsKNRPromoted = promoted;
}
bool isExplicitObjectParameter() const {
return ExplicitObjectParameterIntroducerLoc.isValid();
}
void setExplicitObjectParameterLoc(SourceLocation Loc) {
ExplicitObjectParameterIntroducerLoc = Loc;
}
SourceLocation getExplicitObjectParamThisLoc() const {
return ExplicitObjectParameterIntroducerLoc;
}
Expr *getDefaultArg();
const Expr *getDefaultArg() const {
return const_cast<ParmVarDecl *>(this)->getDefaultArg();
@ -1873,7 +1910,10 @@ public:
static bool classofKind(Kind K) { return K == ParmVar; }
private:
friend class ASTDeclReader;
enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
SourceLocation ExplicitObjectParameterIntroducerLoc;
void setParameterIndex(unsigned parameterIndex) {
if (parameterIndex >= ParameterIndexSentinel) {
@ -2638,6 +2678,23 @@ public:
/// parameters have default arguments (in C++).
unsigned getMinRequiredArguments() const;
/// Returns the minimum number of non-object arguments needed to call this
/// function. This produces the same value as getMinRequiredArguments except
/// it does not count the explicit object argument, if any.
unsigned getMinRequiredExplicitArguments() const;
bool hasCXXExplicitFunctionObjectParameter() const;
unsigned getNumNonObjectParams() const;
const ParmVarDecl *getNonObjectParameter(unsigned I) const {
return getParamDecl(hasCXXExplicitFunctionObjectParameter() ? I + 1 : I);
}
ParmVarDecl *getNonObjectParameter(unsigned I) {
return getParamDecl(hasCXXExplicitFunctionObjectParameter() ? I + 1 : I);
}
/// Determine whether this function has a single parameter, or multiple
/// parameters where all but the first have default arguments.
///
@ -2811,9 +2868,7 @@ public:
/// Determine whether this function is a function template
/// specialization.
bool isFunctionTemplateSpecialization() const {
return getPrimaryTemplate() != nullptr;
}
bool isFunctionTemplateSpecialization() const;
/// If this function is actually a function template specialization,
/// retrieve information about this function template specialization.
@ -2896,9 +2951,9 @@ public:
/// Specifies that this function declaration is actually a
/// dependent function template specialization.
void setDependentTemplateSpecialization(ASTContext &Context,
const UnresolvedSetImpl &Templates,
const TemplateArgumentListInfo &TemplateArgs);
void setDependentTemplateSpecialization(
ASTContext &Context, const UnresolvedSetImpl &Templates,
const TemplateArgumentListInfo *TemplateArgs);
DependentFunctionTemplateSpecializationInfo *
getDependentSpecializationInfo() const;
@ -2981,8 +3036,11 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
ISK_CapturedVLAType,
};
LLVM_PREFERRED_TYPE(bool)
unsigned BitField : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned Mutable : 1;
LLVM_PREFERRED_TYPE(InitStorageKind)
unsigned StorageKind : 2;
mutable unsigned CachedFieldIndex : 28;
@ -3056,12 +3114,16 @@ public:
/// store the data for the anonymous union or struct.
bool isAnonymousStructOrUnion() const;
/// Returns the expression that represents the bit width, if this field
/// is a bit field. For non-bitfields, this returns \c nullptr.
Expr *getBitWidth() const {
if (!BitField)
return nullptr;
return hasInClassInitializer() ? InitAndBitWidth->BitWidth : BitWidth;
}
/// Computes the bit width of this field, if this is a bit field.
/// May not be called on non-bitfields.
unsigned getBitWidthValue(const ASTContext &Ctx) const;
/// Set the bit-field width for this member.
@ -3180,6 +3242,8 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) { return K >= firstField && K <= lastField; }
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override;
};
/// An instance of this object exists for each enum constant
@ -3665,13 +3729,15 @@ public:
return static_cast<TagKind>(TagDeclBits.TagDeclKind);
}
void setTagKind(TagKind TK) { TagDeclBits.TagDeclKind = TK; }
void setTagKind(TagKind TK) {
TagDeclBits.TagDeclKind = llvm::to_underlying(TK);
}
bool isStruct() const { return getTagKind() == TTK_Struct; }
bool isInterface() const { return getTagKind() == TTK_Interface; }
bool isClass() const { return getTagKind() == TTK_Class; }
bool isUnion() const { return getTagKind() == TTK_Union; }
bool isEnum() const { return getTagKind() == TTK_Enum; }
bool isStruct() const { return getTagKind() == TagTypeKind::Struct; }
bool isInterface() const { return getTagKind() == TagTypeKind::Interface; }
bool isClass() const { return getTagKind() == TagTypeKind::Class; }
bool isUnion() const { return getTagKind() == TagTypeKind::Union; }
bool isEnum() const { return getTagKind() == TagTypeKind::Enum; }
/// Is this tag type named, either directly or via being defined in
/// a typedef of this type?
@ -4021,6 +4087,29 @@ public:
static bool classofKind(Kind K) { return K == Enum; }
};
/// Enum that represents the different ways arguments are passed to and
/// returned from function calls. This takes into account the target-specific
/// and version-specific rules along with the rules determined by the
/// language.
enum class RecordArgPassingKind {
/// The argument of this type can be passed directly in registers.
CanPassInRegs,
/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are not forced to be passed
/// indirectly. This value is used only in C++. This value is required by
/// C++ because, in uncommon situations, it is possible for a class to have
/// only trivial copy/move constructors even when one of its subobjects has
/// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
/// constructor in the derived class is deleted).
CannotPassInRegs,
/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are forced to be passed
/// indirectly.
CanNeverPassInRegs
};
/// Represents a struct/union/class. For example:
/// struct X; // Forward declaration, no "body".
/// union Y { int A, B; }; // Has body with members A and B (FieldDecls).
@ -4031,28 +4120,6 @@ class RecordDecl : public TagDecl {
public:
friend class DeclContext;
friend class ASTDeclReader;
/// Enum that represents the different ways arguments are passed to and
/// returned from function calls. This takes into account the target-specific
/// and version-specific rules along with the rules determined by the
/// language.
enum ArgPassingKind : unsigned {
/// The argument of this type can be passed directly in registers.
APK_CanPassInRegs,
/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are not forced to be passed
/// indirectly. This value is used only in C++. This value is required by
/// C++ because, in uncommon situations, it is possible for a class to have
/// only trivial copy/move constructors even when one of its subobjects has
/// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
/// constructor in the derived class is deleted).
APK_CannotPassInRegs,
/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are forced to be passed
/// indirectly.
APK_CanNeverPassInRegs
};
protected:
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
@ -4177,15 +4244,16 @@ public:
/// it must have at least one trivial, non-deleted copy or move constructor.
/// FIXME: This should be set as part of completeDefinition.
bool canPassInRegisters() const {
return getArgPassingRestrictions() == APK_CanPassInRegs;
return getArgPassingRestrictions() == RecordArgPassingKind::CanPassInRegs;
}
ArgPassingKind getArgPassingRestrictions() const {
return static_cast<ArgPassingKind>(RecordDeclBits.ArgPassingRestrictions);
RecordArgPassingKind getArgPassingRestrictions() const {
return static_cast<RecordArgPassingKind>(
RecordDeclBits.ArgPassingRestrictions);
}
void setArgPassingRestrictions(ArgPassingKind Kind) {
RecordDeclBits.ArgPassingRestrictions = Kind;
void setArgPassingRestrictions(RecordArgPassingKind Kind) {
RecordDeclBits.ArgPassingRestrictions = llvm::to_underlying(Kind);
}
bool isParamDestroyedInCallee() const {
@ -4264,6 +4332,30 @@ public:
return field_begin() == field_end();
}
FieldDecl *getLastField() {
FieldDecl *FD = nullptr;
for (FieldDecl *Field : fields())
FD = Field;
return FD;
}
const FieldDecl *getLastField() const {
return const_cast<RecordDecl *>(this)->getLastField();
}
template <typename Functor>
const FieldDecl *findFieldIf(Functor &Pred) const {
for (const Decl *D : decls()) {
if (const auto *FD = dyn_cast<FieldDecl>(D); FD && Pred(FD))
return FD;
if (const auto *RD = dyn_cast<RecordDecl>(D))
if (const FieldDecl *FD = RD->findFieldIf(Pred))
return FD;
}
return nullptr;
}
/// Note that the definition of this type is now complete.
virtual void completeDefinition();

View file

@ -16,8 +16,10 @@
#include "clang/AST/ASTDumperUtils.h"
#include "clang/AST/AttrIterator.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/SelectorLocationsKind.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/ArrayRef.h"
@ -48,7 +50,7 @@ class ExternalSourceSymbolAttr;
class FunctionDecl;
class FunctionType;
class IdentifierInfo;
enum Linkage : unsigned char;
enum class Linkage : unsigned char;
class LinkageSpecDecl;
class Module;
class NamedDecl;
@ -210,7 +212,7 @@ public:
/// The kind of ownership a declaration has, for visibility purposes.
/// This enumeration is designed such that higher values represent higher
/// levels of name hiding.
enum class ModuleOwnershipKind : unsigned {
enum class ModuleOwnershipKind : unsigned char {
/// This declaration is not owned by a module.
Unowned,
@ -283,31 +285,38 @@ private:
SourceLocation Loc;
/// DeclKind - This indicates which class this is.
LLVM_PREFERRED_TYPE(Kind)
unsigned DeclKind : 7;
/// InvalidDecl - This indicates a semantic error occurred.
LLVM_PREFERRED_TYPE(bool)
unsigned InvalidDecl : 1;
/// HasAttrs - This indicates whether the decl has attributes or not.
LLVM_PREFERRED_TYPE(bool)
unsigned HasAttrs : 1;
/// Implicit - Whether this declaration was implicitly generated by
/// the implementation rather than explicitly written by the user.
LLVM_PREFERRED_TYPE(bool)
unsigned Implicit : 1;
/// Whether this declaration was "used", meaning that a definition is
/// required.
LLVM_PREFERRED_TYPE(bool)
unsigned Used : 1;
/// Whether this declaration was "referenced".
/// The difference with 'Used' is whether the reference appears in a
/// evaluated context or not, e.g. functions used in uninstantiated templates
/// are regarded as "referenced" but not "used".
LLVM_PREFERRED_TYPE(bool)
unsigned Referenced : 1;
/// Whether this declaration is a top-level declaration (function,
/// global variable, etc.) that is lexically inside an objc container
/// definition.
LLVM_PREFERRED_TYPE(bool)
unsigned TopLevelDeclInObjCContainer : 1;
/// Whether statistic collection is enabled.
@ -325,16 +334,19 @@ protected:
/// Access - Used by C++ decls for the access specifier.
// NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
LLVM_PREFERRED_TYPE(AccessSpecifier)
unsigned Access : 2;
/// Whether this declaration was loaded from an AST file.
LLVM_PREFERRED_TYPE(bool)
unsigned FromASTFile : 1;
/// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
LLVM_PREFERRED_TYPE(IdentifierNamespace)
unsigned IdentifierNamespace : 14;
/// If 0, we have not computed the linkage of this declaration.
/// Otherwise, it is the linkage + 1.
LLVM_PREFERRED_TYPE(Linkage)
mutable unsigned CacheValidAndLinkage : 3;
/// Allocate memory for a deserialized declaration.
@ -385,7 +397,7 @@ protected:
Implicit(false), Used(false), Referenced(false),
TopLevelDeclInObjCContainer(false), Access(AS_none), FromASTFile(0),
IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
CacheValidAndLinkage(0) {
CacheValidAndLinkage(llvm::to_underlying(Linkage::Invalid)) {
if (StatisticsEnabled) add(DK);
}
@ -394,7 +406,7 @@ protected:
Used(false), Referenced(false), TopLevelDeclInObjCContainer(false),
Access(AS_none), FromASTFile(0),
IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
CacheValidAndLinkage(0) {
CacheValidAndLinkage(llvm::to_underlying(Linkage::Invalid)) {
if (StatisticsEnabled) add(DK);
}
@ -404,11 +416,11 @@ protected:
void updateOutOfDate(IdentifierInfo &II) const;
Linkage getCachedLinkage() const {
return Linkage(CacheValidAndLinkage - 1);
return static_cast<Linkage>(CacheValidAndLinkage);
}
void setCachedLinkage(Linkage L) const {
CacheValidAndLinkage = L + 1;
CacheValidAndLinkage = llvm::to_underlying(L);
}
bool hasCachedLinkage() const {
@ -477,6 +489,15 @@ public:
// Return true if this is a FileContext Decl.
bool isFileContextDecl() const;
/// Whether it resembles a flexible array member. This is a static member
/// because we want to be able to call it with a nullptr. That allows us to
/// perform non-Decl specific checks based on the object's type and strict
/// flex array level.
static bool isFlexibleArrayMemberLike(
ASTContext &Context, const Decl *D, QualType Ty,
LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
bool IgnoreTemplateOrMacroSubstitution);
ASTContext &getASTContext() const LLVM_READONLY;
/// Helper to get the language options from the ASTContext.
@ -1389,6 +1410,11 @@ enum class DeductionCandidate : unsigned char {
Aggregate,
};
enum class RecordArgPassingKind;
enum class OMPDeclareReductionInitKind;
enum class ObjCImplementationControl;
enum class LinkageSpecLanguageIDs;
/// DeclContext - This is used only as base class of specific decl types that
/// can act as declaration contexts. These decls are (only the top classes
/// that directly derive from DeclContext are mentioned, not their subclasses):
@ -1429,35 +1455,42 @@ class DeclContext {
class DeclContextBitfields {
friend class DeclContext;
/// DeclKind - This indicates which class this is.
LLVM_PREFERRED_TYPE(Decl::Kind)
uint64_t DeclKind : 7;
/// Whether this declaration context also has some external
/// storage that contains additional declarations that are lexically
/// part of this context.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t ExternalLexicalStorage : 1;
/// Whether this declaration context also has some external
/// storage that contains additional declarations that are visible
/// in this context.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t ExternalVisibleStorage : 1;
/// Whether this declaration context has had externally visible
/// storage added since the last lookup. In this case, \c LookupPtr's
/// invariant may not hold and needs to be fixed before we perform
/// another lookup.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t NeedToReconcileExternalVisibleStorage : 1;
/// If \c true, this context may have local lexical declarations
/// that are missing from the lookup table.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t HasLazyLocalLexicalLookups : 1;
/// If \c true, the external source may have lexical declarations
/// that are missing from the lookup table.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t HasLazyExternalLexicalLookups : 1;
/// If \c true, lookups should only return identifier from
/// DeclContext scope (for example TranslationUnit). Used in
/// LookupQualifiedName()
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t UseQualifiedLookup : 1;
};
@ -1470,52 +1503,60 @@ class DeclContext {
class TagDeclBitfields {
friend class TagDecl;
/// For the bits in DeclContextBitfields
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
/// The TagKind enum.
LLVM_PREFERRED_TYPE(TagTypeKind)
uint64_t TagDeclKind : 3;
/// True if this is a definition ("struct foo {};"), false if it is a
/// declaration ("struct foo;"). It is not considered a definition
/// until the definition has been fully processed.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsCompleteDefinition : 1;
/// True if this is currently being defined.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsBeingDefined : 1;
/// True if this tag declaration is "embedded" (i.e., defined or declared
/// for the very first time) in the syntax of a declarator.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsEmbeddedInDeclarator : 1;
/// True if this tag is free standing, e.g. "struct foo;".
LLVM_PREFERRED_TYPE(bool)
uint64_t IsFreeStanding : 1;
/// Indicates whether it is possible for declarations of this kind
/// to have an out-of-date definition.
///
/// This option is only enabled when modules are enabled.
LLVM_PREFERRED_TYPE(bool)
uint64_t MayHaveOutOfDateDef : 1;
/// Has the full definition of this type been required by a use somewhere in
/// the TU.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsCompleteDefinitionRequired : 1;
/// Whether this tag is a definition which was demoted due to
/// a module merge.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsThisDeclarationADemotedDefinition : 1;
};
/// Number of non-inherited bits in TagDeclBitfields.
enum { NumTagDeclBits = 10 };
/// Number of inherited and non-inherited bits in TagDeclBitfields.
enum { NumTagDeclBits = NumDeclContextBits + 10 };
/// Stores the bits used by EnumDecl.
/// If modified NumEnumDeclBit and the accessor
/// methods in EnumDecl should be updated appropriately.
class EnumDeclBitfields {
friend class EnumDecl;
/// For the bits in DeclContextBitfields.
uint64_t : NumDeclContextBits;
/// For the bits in TagDeclBitfields.
LLVM_PREFERRED_TYPE(TagDeclBitfields)
uint64_t : NumTagDeclBits;
/// Width in bits required to store all the non-negative
@ -1528,76 +1569,93 @@ class DeclContext {
/// True if this tag declaration is a scoped enumeration. Only
/// possible in C++11 mode.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsScoped : 1;
/// If this tag declaration is a scoped enum,
/// then this is true if the scoped enum was declared using the class
/// tag, false if it was declared with the struct tag. No meaning is
/// associated if this tag declaration is not a scoped enum.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsScopedUsingClassTag : 1;
/// True if this is an enumeration with fixed underlying type. Only
/// possible in C++11, Microsoft extensions, or Objective C mode.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsFixed : 1;
/// True if a valid hash is stored in ODRHash.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasODRHash : 1;
};
/// Number of non-inherited bits in EnumDeclBitfields.
enum { NumEnumDeclBits = 20 };
/// Number of inherited and non-inherited bits in EnumDeclBitfields.
enum { NumEnumDeclBits = NumTagDeclBits + 20 };
/// Stores the bits used by RecordDecl.
/// If modified NumRecordDeclBits and the accessor
/// methods in RecordDecl should be updated appropriately.
class RecordDeclBitfields {
friend class RecordDecl;
/// For the bits in DeclContextBitfields.
uint64_t : NumDeclContextBits;
/// For the bits in TagDeclBitfields.
LLVM_PREFERRED_TYPE(TagDeclBitfields)
uint64_t : NumTagDeclBits;
/// This is true if this struct ends with a flexible
/// array member (e.g. int X[]) or if this union contains a struct that does.
/// If so, this cannot be contained in arrays or other structs as a member.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasFlexibleArrayMember : 1;
/// Whether this is the type of an anonymous struct or union.
LLVM_PREFERRED_TYPE(bool)
uint64_t AnonymousStructOrUnion : 1;
/// This is true if this struct has at least one member
/// containing an Objective-C object pointer type.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasObjectMember : 1;
/// This is true if struct has at least one member of
/// 'volatile' type.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasVolatileMember : 1;
/// Whether the field declarations of this record have been loaded
/// from external storage. To avoid unnecessary deserialization of
/// methods/nested types we allow deserialization of just the fields
/// when needed.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t LoadedFieldsFromExternalStorage : 1;
/// Basic properties of non-trivial C structs.
LLVM_PREFERRED_TYPE(bool)
uint64_t NonTrivialToPrimitiveDefaultInitialize : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t NonTrivialToPrimitiveCopy : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t NonTrivialToPrimitiveDestroy : 1;
/// The following bits indicate whether this is or contains a C union that
/// is non-trivial to default-initialize, destruct, or copy. These bits
/// imply the associated basic non-triviality predicates declared above.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasNonTrivialToPrimitiveDefaultInitializeCUnion : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasNonTrivialToPrimitiveDestructCUnion : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasNonTrivialToPrimitiveCopyCUnion : 1;
/// Indicates whether this struct is destroyed in the callee.
LLVM_PREFERRED_TYPE(bool)
uint64_t ParamDestroyedInCallee : 1;
/// Represents the way this type is passed to a function.
LLVM_PREFERRED_TYPE(RecordArgPassingKind)
uint64_t ArgPassingRestrictions : 2;
/// Indicates whether this struct has had its field layout randomized.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsRandomized : 1;
/// True if a valid hash is stored in ODRHash. This should shave off some
@ -1605,8 +1663,8 @@ class DeclContext {
uint64_t ODRHash : 26;
};
/// Number of non-inherited bits in RecordDeclBitfields.
enum { NumRecordDeclBits = 41 };
/// Number of inherited and non-inherited bits in RecordDeclBitfields.
enum { NumRecordDeclBits = NumTagDeclBits + 41 };
/// Stores the bits used by OMPDeclareReductionDecl.
/// If modified NumOMPDeclareReductionDeclBits and the accessor
@ -1614,15 +1672,18 @@ class DeclContext {
class OMPDeclareReductionDeclBitfields {
friend class OMPDeclareReductionDecl;
/// For the bits in DeclContextBitfields
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
/// Kind of initializer,
/// function call or omp_priv<init_expr> initialization.
LLVM_PREFERRED_TYPE(OMPDeclareReductionInitKind)
uint64_t InitializerKind : 2;
};
/// Number of non-inherited bits in OMPDeclareReductionDeclBitfields.
enum { NumOMPDeclareReductionDeclBits = 2 };
/// Number of inherited and non-inherited bits in
/// OMPDeclareReductionDeclBitfields.
enum { NumOMPDeclareReductionDeclBits = NumDeclContextBits + 2 };
/// Stores the bits used by FunctionDecl.
/// If modified NumFunctionDeclBits and the accessor
@ -1633,85 +1694,112 @@ class DeclContext {
/// For DeductionCandidateKind
friend class CXXDeductionGuideDecl;
/// For the bits in DeclContextBitfields.
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
LLVM_PREFERRED_TYPE(StorageClass)
uint64_t SClass : 3;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsInline : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsInlineSpecified : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsVirtualAsWritten : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsPure : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasInheritedPrototype : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasWrittenPrototype : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsDeleted : 1;
/// Used by CXXMethodDecl
LLVM_PREFERRED_TYPE(bool)
uint64_t IsTrivial : 1;
/// This flag indicates whether this function is trivial for the purpose of
/// calls. This is meaningful only when this function is a copy/move
/// constructor or a destructor.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsTrivialForCall : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsDefaulted : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsExplicitlyDefaulted : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasDefaultedFunctionInfo : 1;
/// For member functions of complete types, whether this is an ineligible
/// special member function or an unselected destructor. See
/// [class.mem.special].
LLVM_PREFERRED_TYPE(bool)
uint64_t IsIneligibleOrNotSelected : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t HasImplicitReturnZero : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsLateTemplateParsed : 1;
/// Kind of contexpr specifier as defined by ConstexprSpecKind.
LLVM_PREFERRED_TYPE(ConstexprSpecKind)
uint64_t ConstexprKind : 2;
LLVM_PREFERRED_TYPE(bool)
uint64_t BodyContainsImmediateEscalatingExpression : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t InstantiationIsPending : 1;
/// Indicates if the function uses __try.
LLVM_PREFERRED_TYPE(bool)
uint64_t UsesSEHTry : 1;
/// Indicates if the function was a definition
/// but its body was skipped.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasSkippedBody : 1;
/// Indicates if the function declaration will
/// have a body, once we're done parsing it.
LLVM_PREFERRED_TYPE(bool)
uint64_t WillHaveBody : 1;
/// Indicates that this function is a multiversioned
/// function using attribute 'target'.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsMultiVersion : 1;
/// Only used by CXXDeductionGuideDecl. Indicates the kind
/// of the Deduction Guide that is implicitly generated
/// (used during overload resolution).
LLVM_PREFERRED_TYPE(DeductionCandidate)
uint64_t DeductionCandidateKind : 2;
/// Store the ODRHash after first calculation.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasODRHash : 1;
/// Indicates if the function uses Floating Point Constrained Intrinsics
LLVM_PREFERRED_TYPE(bool)
uint64_t UsesFPIntrin : 1;
// Indicates this function is a constrained friend, where the constraint
// refers to an enclosing template for hte purposes of [temp.friend]p9.
LLVM_PREFERRED_TYPE(bool)
uint64_t FriendConstraintRefersToEnclosingTemplate : 1;
};
/// Number of non-inherited bits in FunctionDeclBitfields.
enum { NumFunctionDeclBits = 31 };
/// Number of inherited and non-inherited bits in FunctionDeclBitfields.
enum { NumFunctionDeclBits = NumDeclContextBits + 31 };
/// Stores the bits used by CXXConstructorDecl. If modified
/// NumCXXConstructorDeclBits and the accessor
/// methods in CXXConstructorDecl should be updated appropriately.
class CXXConstructorDeclBitfields {
friend class CXXConstructorDecl;
/// For the bits in DeclContextBitfields.
uint64_t : NumDeclContextBits;
/// For the bits in FunctionDeclBitfields.
LLVM_PREFERRED_TYPE(FunctionDeclBitfields)
uint64_t : NumFunctionDeclBits;
/// 20 bits to fit in the remaining available space.
@ -1720,19 +1808,20 @@ class DeclContext {
/// will need to be shrunk if some bit is added to NumDeclContextBitfields,
/// NumFunctionDeclBitfields or CXXConstructorDeclBitfields.
uint64_t NumCtorInitializers : 17;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsInheritingConstructor : 1;
/// Whether this constructor has a trail-allocated explicit specifier.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasTrailingExplicitSpecifier : 1;
/// If this constructor does't have a trail-allocated explicit specifier.
/// Whether this constructor is explicit specified.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsSimpleExplicit : 1;
};
/// Number of non-inherited bits in CXXConstructorDeclBitfields.
enum {
NumCXXConstructorDeclBits = 64 - NumDeclContextBits - NumFunctionDeclBits
};
/// Number of inherited and non-inherited bits in CXXConstructorDeclBitfields.
enum { NumCXXConstructorDeclBits = NumFunctionDeclBits + 20 };
/// Stores the bits used by ObjCMethodDecl.
/// If modified NumObjCMethodDeclBits and the accessor
@ -1741,43 +1830,56 @@ class DeclContext {
friend class ObjCMethodDecl;
/// For the bits in DeclContextBitfields.
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
/// The conventional meaning of this method; an ObjCMethodFamily.
/// This is not serialized; instead, it is computed on demand and
/// cached.
LLVM_PREFERRED_TYPE(ObjCMethodFamily)
mutable uint64_t Family : ObjCMethodFamilyBitWidth;
/// instance (true) or class (false) method.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsInstance : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsVariadic : 1;
/// True if this method is the getter or setter for an explicit property.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsPropertyAccessor : 1;
/// True if this method is a synthesized property accessor stub.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsSynthesizedAccessorStub : 1;
/// Method has a definition.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsDefined : 1;
/// Method redeclaration in the same interface.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsRedeclaration : 1;
/// Is redeclared in the same interface.
LLVM_PREFERRED_TYPE(bool)
mutable uint64_t HasRedeclaration : 1;
/// \@required/\@optional
LLVM_PREFERRED_TYPE(ObjCImplementationControl)
uint64_t DeclImplementation : 2;
/// in, inout, etc.
LLVM_PREFERRED_TYPE(Decl::ObjCDeclQualifier)
uint64_t objcDeclQualifier : 7;
/// Indicates whether this method has a related result type.
LLVM_PREFERRED_TYPE(bool)
uint64_t RelatedResultType : 1;
/// Whether the locations of the selector identifiers are in a
/// "standard" position, a enum SelectorLocationsKind.
LLVM_PREFERRED_TYPE(SelectorLocationsKind)
uint64_t SelLocsKind : 2;
/// Whether this method overrides any other in the class hierarchy.
@ -1787,14 +1889,16 @@ class DeclContext {
/// the same selector and is of the same kind (class or instance).
/// A method in an implementation is not considered as overriding the same
/// method in the interface or its categories.
LLVM_PREFERRED_TYPE(bool)
uint64_t IsOverriding : 1;
/// Indicates if the method was a definition but its body was skipped.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasSkippedBody : 1;
};
/// Number of non-inherited bits in ObjCMethodDeclBitfields.
enum { NumObjCMethodDeclBits = 24 };
/// Number of inherited and non-inherited bits in ObjCMethodDeclBitfields.
enum { NumObjCMethodDeclBits = NumDeclContextBits + 24 };
/// Stores the bits used by ObjCContainerDecl.
/// If modified NumObjCContainerDeclBits and the accessor
@ -1802,6 +1906,7 @@ class DeclContext {
class ObjCContainerDeclBitfields {
friend class ObjCContainerDecl;
/// For the bits in DeclContextBitfields
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint32_t : NumDeclContextBits;
// Not a bitfield but this saves space.
@ -1809,10 +1914,10 @@ class DeclContext {
SourceLocation AtStart;
};
/// Number of non-inherited bits in ObjCContainerDeclBitfields.
/// Number of inherited and non-inherited bits in ObjCContainerDeclBitfields.
/// Note that here we rely on the fact that SourceLocation is 32 bits
/// wide. We check this with the static_assert in the ctor of DeclContext.
enum { NumObjCContainerDeclBits = 64 - NumDeclContextBits };
enum { NumObjCContainerDeclBits = 64 };
/// Stores the bits used by LinkageSpecDecl.
/// If modified NumLinkageSpecDeclBits and the accessor
@ -1820,21 +1925,23 @@ class DeclContext {
class LinkageSpecDeclBitfields {
friend class LinkageSpecDecl;
/// For the bits in DeclContextBitfields.
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
/// The language for this linkage specification with values
/// in the enum LinkageSpecDecl::LanguageIDs.
/// The language for this linkage specification.
LLVM_PREFERRED_TYPE(LinkageSpecLanguageIDs)
uint64_t Language : 3;
/// True if this linkage spec has braces.
/// This is needed so that hasBraces() returns the correct result while the
/// linkage spec body is being parsed. Once RBraceLoc has been set this is
/// not used, so it doesn't need to be serialized.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasBraces : 1;
};
/// Number of non-inherited bits in LinkageSpecDeclBitfields.
enum { NumLinkageSpecDeclBits = 4 };
/// Number of inherited and non-inherited bits in LinkageSpecDeclBitfields.
enum { NumLinkageSpecDeclBits = NumDeclContextBits + 4 };
/// Stores the bits used by BlockDecl.
/// If modified NumBlockDeclBits and the accessor
@ -1842,25 +1949,32 @@ class DeclContext {
class BlockDeclBitfields {
friend class BlockDecl;
/// For the bits in DeclContextBitfields.
LLVM_PREFERRED_TYPE(DeclContextBitfields)
uint64_t : NumDeclContextBits;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsVariadic : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t CapturesCXXThis : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t BlockMissingReturnType : 1;
LLVM_PREFERRED_TYPE(bool)
uint64_t IsConversionFromLambda : 1;
/// A bit that indicates this block is passed directly to a function as a
/// non-escaping parameter.
LLVM_PREFERRED_TYPE(bool)
uint64_t DoesNotEscape : 1;
/// A bit that indicates whether it's possible to avoid coying this block to
/// the heap when it initializes or is assigned to a local variable with
/// automatic storage.
LLVM_PREFERRED_TYPE(bool)
uint64_t CanAvoidCopyToHeap : 1;
};
/// Number of non-inherited bits in BlockDeclBitfields.
enum { NumBlockDeclBits = 5 };
/// Number of inherited and non-inherited bits in BlockDeclBitfields.
enum { NumBlockDeclBits = NumDeclContextBits + 5 };
/// Pointer to the data structure used to lookup declarations
/// within this context (or a DependentStoredDeclsMap if this is a

View file

@ -154,22 +154,26 @@ class CXXBaseSpecifier {
SourceLocation EllipsisLoc;
/// Whether this is a virtual base class or not.
LLVM_PREFERRED_TYPE(bool)
unsigned Virtual : 1;
/// Whether this is the base of a class (true) or of a struct (false).
///
/// This determines the mapping from the access specifier as written in the
/// source code to the access specifier used for semantic analysis.
LLVM_PREFERRED_TYPE(bool)
unsigned BaseOfClass : 1;
/// Access specifier as written in the source code (may be AS_none).
///
/// The actual type of data stored here is an AccessSpecifier, but we use
/// "unsigned" here to work around a VC++ bug.
/// "unsigned" here to work around Microsoft ABI.
LLVM_PREFERRED_TYPE(AccessSpecifier)
unsigned Access : 2;
/// Whether the class contains a using declaration
/// to inherit the named class's constructors.
LLVM_PREFERRED_TYPE(bool)
unsigned InheritConstructors : 1;
/// The type of the base class.
@ -290,15 +294,19 @@ private:
#include "CXXRecordDeclDefinitionBits.def"
/// Whether this class describes a C++ lambda.
LLVM_PREFERRED_TYPE(bool)
unsigned IsLambda : 1;
/// Whether we are currently parsing base specifiers.
LLVM_PREFERRED_TYPE(bool)
unsigned IsParsingBaseSpecifiers : 1;
/// True when visible conversion functions are already computed
/// and are available.
LLVM_PREFERRED_TYPE(bool)
unsigned ComputedVisibleConversions : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned HasODRHash : 1;
/// A hash of parts of the class to help in ODR checking.
@ -383,12 +391,15 @@ private:
/// lambda will have been created with the enclosing context as its
/// declaration context, rather than function. This is an unfortunate
/// artifact of having to parse the default arguments before.
LLVM_PREFERRED_TYPE(LambdaDependencyKind)
unsigned DependencyKind : 2;
/// Whether this lambda is a generic lambda.
LLVM_PREFERRED_TYPE(bool)
unsigned IsGenericLambda : 1;
/// The Default Capture.
LLVM_PREFERRED_TYPE(LambdaCaptureDefault)
unsigned CaptureDefault : 2;
/// The number of captures in this lambda is limited 2^NumCaptures.
@ -398,6 +409,7 @@ private:
unsigned NumExplicitCaptures : 12;
/// Has known `internal` linkage.
LLVM_PREFERRED_TYPE(bool)
unsigned HasKnownInternalLinkage : 1;
/// The number used to indicate this lambda expression for name
@ -1052,6 +1064,12 @@ public:
return static_cast<LambdaCaptureDefault>(getLambdaData().CaptureDefault);
}
bool isCapturelessLambda() const {
if (!isLambda())
return false;
return getLambdaCaptureDefault() == LCD_None && capture_size() == 0;
}
/// Set the captures for this lambda closure type.
void setCaptures(ASTContext &Context, ArrayRef<LambdaCapture> Captures);
@ -2061,6 +2079,17 @@ public:
bool isStatic() const;
bool isInstance() const { return !isStatic(); }
/// [C++2b][dcl.fct]/p7
/// An explicit object member function is a non-static
/// member function with an explicit object parameter. e.g.,
/// void func(this SomeType);
bool isExplicitObjectMemberFunction() const;
/// [C++2b][dcl.fct]/p7
/// An implicit object member function is a non-static
/// member function without an explicit object parameter.
bool isImplicitObjectMemberFunction() const;
/// Returns true if the given operator is implicitly static in a record
/// context.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK) {
@ -2169,14 +2198,19 @@ public:
/// Return the type of the object pointed by \c this.
///
/// See getThisType() for usage restriction.
QualType getThisObjectType() const;
QualType getFunctionObjectParameterReferenceType() const;
QualType getFunctionObjectParameterType() const {
return getFunctionObjectParameterReferenceType().getNonReferenceType();
}
unsigned getNumExplicitParams() const {
return getNumParams() - (isExplicitObjectMemberFunction() ? 1 : 0);
}
static QualType getThisType(const FunctionProtoType *FPT,
const CXXRecordDecl *Decl);
static QualType getThisObjectType(const FunctionProtoType *FPT,
const CXXRecordDecl *Decl);
Qualifiers getMethodQualifiers() const {
return getType()->castAs<FunctionProtoType>()->getMethodQuals();
}
@ -2283,14 +2317,17 @@ class CXXCtorInitializer final {
/// If the initializee is a type, whether that type makes this
/// a delegating initialization.
LLVM_PREFERRED_TYPE(bool)
unsigned IsDelegating : 1;
/// If the initializer is a base initializer, this keeps track
/// of whether the base is virtual or not.
LLVM_PREFERRED_TYPE(bool)
unsigned IsVirtual : 1;
/// Whether or not the initializer is explicitly written
/// in the sources.
LLVM_PREFERRED_TYPE(bool)
unsigned IsWritten : 1;
/// If IsWritten is true, then this number keeps track of the textual order
@ -2875,6 +2912,12 @@ public:
static bool classofKind(Kind K) { return K == CXXConversion; }
};
/// Represents the language in a linkage specification.
///
/// The values are part of the serialization ABI for
/// ASTs and cannot be changed without altering that ABI.
enum class LinkageSpecLanguageIDs { C = 1, CXX = 2 };
/// Represents a linkage specification.
///
/// For example:
@ -2885,14 +2928,7 @@ class LinkageSpecDecl : public Decl, public DeclContext {
virtual void anchor();
// This class stores some data in DeclContext::LinkageSpecDeclBits to save
// some space. Use the provided accessors to access it.
public:
/// Represents the language in a linkage specification.
///
/// The values are part of the serialization ABI for
/// ASTs and cannot be changed without altering that ABI.
enum LanguageIDs { lang_c = 1, lang_cxx = 2 };
private:
/// The source location for the extern keyword.
SourceLocation ExternLoc;
@ -2900,22 +2936,25 @@ private:
SourceLocation RBraceLoc;
LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc,
SourceLocation LangLoc, LanguageIDs lang, bool HasBraces);
SourceLocation LangLoc, LinkageSpecLanguageIDs lang,
bool HasBraces);
public:
static LinkageSpecDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation ExternLoc,
SourceLocation LangLoc, LanguageIDs Lang,
bool HasBraces);
SourceLocation LangLoc,
LinkageSpecLanguageIDs Lang, bool HasBraces);
static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID);
/// Return the language specified by this linkage specification.
LanguageIDs getLanguage() const {
return static_cast<LanguageIDs>(LinkageSpecDeclBits.Language);
LinkageSpecLanguageIDs getLanguage() const {
return static_cast<LinkageSpecLanguageIDs>(LinkageSpecDeclBits.Language);
}
/// Set the language specified by this linkage specification.
void setLanguage(LanguageIDs L) { LinkageSpecDeclBits.Language = L; }
void setLanguage(LinkageSpecLanguageIDs L) {
LinkageSpecDeclBits.Language = llvm::to_underlying(L);
}
/// Determines whether this linkage specification had braces in
/// its syntactic form.
@ -3564,6 +3603,7 @@ class ConstructorUsingShadowDecl final : public UsingShadowDecl {
/// \c true if the constructor ultimately named by this using shadow
/// declaration is within a virtual base class subobject of the class that
/// contains this declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned IsVirtual : 1;
ConstructorUsingShadowDecl(ASTContext &C, DeclContext *DC, SourceLocation Loc,

View file

@ -73,6 +73,7 @@ private:
/// True if this 'friend' declaration is unsupported. Eventually we
/// will support every possible friend declaration, but for now we
/// silently ignore some and set this flag to authorize all access.
LLVM_PREFERRED_TYPE(bool)
unsigned UnsupportedFriend : 1;
// The number of "outer" template parameter lists in non-templatic

View file

@ -115,6 +115,8 @@ public:
const SourceLocation *Locs, ASTContext &Ctx);
};
enum class ObjCImplementationControl { None, Required, Optional };
/// ObjCMethodDecl - Represents an instance or class method declaration.
/// ObjC methods can be declared within 4 contexts: class interfaces,
/// categories, protocols, and class implementations. While C++ member
@ -139,10 +141,6 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
// This class stores some data in DeclContext::ObjCMethodDeclBits
// to save some space. Use the provided accessors to access it.
public:
enum ImplementationControl { None, Required, Optional };
private:
/// Return type of this method.
QualType MethodDeclType;
@ -168,14 +166,14 @@ private:
/// constructed by createImplicitParams.
ImplicitParamDecl *CmdDecl = nullptr;
ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc,
Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
DeclContext *contextDecl, bool isInstance = true,
bool isVariadic = false, bool isPropertyAccessor = false,
bool isSynthesizedAccessorStub = false,
bool isImplicitlyDeclared = false, bool isDefined = false,
ImplementationControl impControl = None,
bool HasRelatedResultType = false);
ObjCMethodDecl(
SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo,
QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl,
bool isInstance = true, bool isVariadic = false,
bool isPropertyAccessor = false, bool isSynthesizedAccessorStub = false,
bool isImplicitlyDeclared = false, bool isDefined = false,
ObjCImplementationControl impControl = ObjCImplementationControl::None,
bool HasRelatedResultType = false);
SelectorLocationsKind getSelLocsKind() const {
return static_cast<SelectorLocationsKind>(ObjCMethodDeclBits.SelLocsKind);
@ -235,7 +233,7 @@ public:
bool isVariadic = false, bool isPropertyAccessor = false,
bool isSynthesizedAccessorStub = false,
bool isImplicitlyDeclared = false, bool isDefined = false,
ImplementationControl impControl = None,
ObjCImplementationControl impControl = ObjCImplementationControl::None,
bool HasRelatedResultType = false);
static ObjCMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID);
@ -495,16 +493,17 @@ public:
const ObjCPropertyDecl *findPropertyDecl(bool CheckOverrides = true) const;
// Related to protocols declared in \@protocol
void setDeclImplementation(ImplementationControl ic) {
ObjCMethodDeclBits.DeclImplementation = ic;
void setDeclImplementation(ObjCImplementationControl ic) {
ObjCMethodDeclBits.DeclImplementation = llvm::to_underlying(ic);
}
ImplementationControl getImplementationControl() const {
return ImplementationControl(ObjCMethodDeclBits.DeclImplementation);
ObjCImplementationControl getImplementationControl() const {
return static_cast<ObjCImplementationControl>(
ObjCMethodDeclBits.DeclImplementation);
}
bool isOptional() const {
return getImplementationControl() == Optional;
return getImplementationControl() == ObjCImplementationControl::Optional;
}
/// Returns true if this specific method declaration is marked with the
@ -581,6 +580,7 @@ class ObjCTypeParamDecl : public TypedefNameDecl {
unsigned Index : 14;
/// The variance of the type parameter.
LLVM_PREFERRED_TYPE(ObjCTypeParamVariance)
unsigned Variance : 2;
/// The location of the variance, if any.
@ -742,10 +742,13 @@ private:
QualType DeclType;
TypeSourceInfo *DeclTypeSourceInfo;
LLVM_PREFERRED_TYPE(ObjCPropertyAttribute::Kind)
unsigned PropertyAttributes : NumObjCPropertyAttrsBits;
LLVM_PREFERRED_TYPE(ObjCPropertyAttribute::Kind)
unsigned PropertyAttributesAsWritten : NumObjCPropertyAttrsBits;
// \@required/\@optional
LLVM_PREFERRED_TYPE(PropertyControl)
unsigned PropertyImplementation : 2;
// getter name of NULL if no getter
@ -1179,14 +1182,17 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
/// Indicates that the contents of this Objective-C class will be
/// completed by the external AST source when required.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned ExternallyCompleted : 1;
/// Indicates that the ivar cache does not yet include ivars
/// declared in the implementation.
LLVM_PREFERRED_TYPE(bool)
mutable unsigned IvarListMissingImplementation : 1;
/// Indicates that this interface decl contains at least one initializer
/// marked with the 'objc_designated_initializer' attribute.
LLVM_PREFERRED_TYPE(bool)
unsigned HasDesignatedInitializers : 1;
enum InheritedDesignatedInitializersState {
@ -1202,9 +1208,11 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
};
/// One of the \c InheritedDesignatedInitializersState enumeratos.
LLVM_PREFERRED_TYPE(InheritedDesignatedInitializersState)
mutable unsigned InheritedDesignatedInitializers : 2;
/// Tracks whether a ODR hash has been computed for this interface.
LLVM_PREFERRED_TYPE(bool)
unsigned HasODRHash : 1;
/// A hash of parts of the class to help in ODR checking.
@ -2008,7 +2016,9 @@ private:
ObjCIvarDecl *NextIvar = nullptr;
// NOTE: VC++ treats enums as signed, avoid using the AccessControl enum
LLVM_PREFERRED_TYPE(AccessControl)
unsigned DeclAccess : 3;
LLVM_PREFERRED_TYPE(bool)
unsigned Synthesized : 1;
};
@ -2075,6 +2085,7 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
ObjCProtocolList ReferencedProtocols;
/// Tracks whether a ODR hash has been computed for this protocol.
LLVM_PREFERRED_TYPE(bool)
unsigned HasODRHash : 1;
/// A hash of parts of the class to help in ODR checking.
@ -2597,9 +2608,11 @@ class ObjCImplementationDecl : public ObjCImplDecl {
/// Do the ivars of this class require initialization other than
/// zero-initialization?
LLVM_PREFERRED_TYPE(bool)
bool HasNonZeroConstructors : 1;
/// Do the ivars of this class require non-trivial destruction?
LLVM_PREFERRED_TYPE(bool)
bool HasDestructors : 1;
ObjCImplementationDecl(DeclContext *DC,

View file

@ -158,6 +158,12 @@ public:
static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
};
enum class OMPDeclareReductionInitKind {
Call, // Initialized by function call.
Direct, // omp_priv(<expr>)
Copy // omp_priv = <expr>
};
/// This represents '#pragma omp declare reduction ...' directive.
/// For example, in the following, declared reduction 'foo' for types 'int' and
/// 'float':
@ -171,14 +177,7 @@ public:
class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
// This class stores some data in DeclContext::OMPDeclareReductionDeclBits
// to save some space. Use the provided accessors to access it.
public:
enum InitKind {
CallInit, // Initialized by function call.
DirectInit, // omp_priv(<expr>)
CopyInit // omp_priv = <expr>
};
private:
friend class ASTDeclReader;
/// Combiner for declare reduction construct.
Expr *Combiner = nullptr;
@ -239,8 +238,9 @@ public:
Expr *getInitializer() { return Initializer; }
const Expr *getInitializer() const { return Initializer; }
/// Get initializer kind.
InitKind getInitializerKind() const {
return static_cast<InitKind>(OMPDeclareReductionDeclBits.InitializerKind);
OMPDeclareReductionInitKind getInitializerKind() const {
return static_cast<OMPDeclareReductionInitKind>(
OMPDeclareReductionDeclBits.InitializerKind);
}
/// Get Orig variable of the initializer.
Expr *getInitOrig() { return Orig; }
@ -249,9 +249,9 @@ public:
Expr *getInitPriv() { return Priv; }
const Expr *getInitPriv() const { return Priv; }
/// Set initializer expression for the declare reduction construct.
void setInitializer(Expr *E, InitKind IK) {
void setInitializer(Expr *E, OMPDeclareReductionInitKind IK) {
Initializer = E;
OMPDeclareReductionDeclBits.InitializerKind = IK;
OMPDeclareReductionDeclBits.InitializerKind = llvm::to_underlying(IK);
}
/// Set initializer Orig and Priv vars.
void setInitializerData(Expr *OrigE, Expr *PrivE) {

View file

@ -83,13 +83,16 @@ class TemplateParameterList final
/// Whether this template parameter list contains an unexpanded parameter
/// pack.
LLVM_PREFERRED_TYPE(bool)
unsigned ContainsUnexpandedParameterPack : 1;
/// Whether this template parameter list has a requires clause.
LLVM_PREFERRED_TYPE(bool)
unsigned HasRequiresClause : 1;
/// Whether any of the template parameters has constrained-parameter
/// constraint-expression.
LLVM_PREFERRED_TYPE(bool)
unsigned HasConstrainedParameters : 1;
protected:
@ -377,7 +380,8 @@ public:
InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
if (!isSet())
ValueOrInherited = InheritedFrom;
else if (auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>()) {
else if ([[maybe_unused]] auto *D =
ValueOrInherited.template dyn_cast<ParmDecl *>()) {
assert(C.isSameDefaultTemplateArgument(D, InheritedFrom));
ValueOrInherited =
new (allocateDefaultArgStorageChain(C)) Chain{InheritedFrom, get()};
@ -582,7 +586,7 @@ public:
/// \code
/// template<typename> struct A {
/// template<typename> void f();
/// template<> void f<int>(); // ClassScopeFunctionSpecializationDecl
/// template<> void f<int>();
/// };
/// \endcode
///
@ -681,82 +685,48 @@ public:
/// Provides information about a dependent function-template
/// specialization declaration.
///
/// Since explicit function template specialization and instantiation
/// declarations can only appear in namespace scope, and you can only
/// specialize a member of a fully-specialized class, the only way to
/// get one of these is in a friend declaration like the following:
/// This is used for function templates explicit specializations declared
/// within class templates:
///
/// \code
/// template<typename> struct A {
/// template<typename> void f();
/// template<> void f<int>(); // DependentFunctionTemplateSpecializationInfo
/// };
/// \endcode
///
/// As well as dependent friend declarations naming function template
/// specializations declared within class templates:
///
/// \code
/// template \<class T> void foo(T);
/// template \<class T> class A {
/// friend void foo<>(T);
/// friend void foo<>(T); // DependentFunctionTemplateSpecializationInfo
/// };
/// \endcode
class DependentFunctionTemplateSpecializationInfo final
: private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,
TemplateArgumentLoc,
FunctionTemplateDecl *> {
/// The number of potential template candidates.
unsigned NumTemplates;
/// The number of template arguments.
unsigned NumArgs;
/// The locations of the left and right angle brackets.
SourceRange AngleLocs;
size_t numTrailingObjects(OverloadToken<TemplateArgumentLoc>) const {
return NumArgs;
}
size_t numTrailingObjects(OverloadToken<FunctionTemplateDecl *>) const {
return NumTemplates;
}
DependentFunctionTemplateSpecializationInfo(
const UnresolvedSetImpl &Templates,
const TemplateArgumentListInfo &TemplateArgs);
public:
friend TrailingObjects;
/// The number of candidates for the primary template.
unsigned NumCandidates;
DependentFunctionTemplateSpecializationInfo(
const UnresolvedSetImpl &Candidates,
const ASTTemplateArgumentListInfo *TemplateArgsWritten);
public:
/// The template arguments as written in the sources, if provided.
const ASTTemplateArgumentListInfo *TemplateArgumentsAsWritten;
static DependentFunctionTemplateSpecializationInfo *
Create(ASTContext &Context, const UnresolvedSetImpl &Templates,
const TemplateArgumentListInfo &TemplateArgs);
Create(ASTContext &Context, const UnresolvedSetImpl &Candidates,
const TemplateArgumentListInfo *TemplateArgs);
/// Returns the number of function templates that this might
/// be a specialization of.
unsigned getNumTemplates() const { return NumTemplates; }
/// Returns the i'th template candidate.
FunctionTemplateDecl *getTemplate(unsigned I) const {
assert(I < getNumTemplates() && "template index out of range");
return getTrailingObjects<FunctionTemplateDecl *>()[I];
}
/// Returns the explicit template arguments that were given.
const TemplateArgumentLoc *getTemplateArgs() const {
return getTrailingObjects<TemplateArgumentLoc>();
}
/// Returns the number of explicit template arguments that were given.
unsigned getNumTemplateArgs() const { return NumArgs; }
llvm::ArrayRef<TemplateArgumentLoc> arguments() const {
return llvm::ArrayRef(getTemplateArgs(), getNumTemplateArgs());
}
/// Returns the nth template argument.
const TemplateArgumentLoc &getTemplateArg(unsigned I) const {
assert(I < getNumTemplateArgs() && "template arg index out of range");
return getTemplateArgs()[I];
}
SourceLocation getLAngleLoc() const {
return AngleLocs.getBegin();
}
SourceLocation getRAngleLoc() const {
return AngleLocs.getEnd();
/// Returns the candidates for the primary function template.
ArrayRef<FunctionTemplateDecl *> getCandidates() const {
return {getTrailingObjects<FunctionTemplateDecl *>(), NumCandidates};
}
};
@ -1373,10 +1343,7 @@ public:
nullptr;
}
void setTypeConstraint(NestedNameSpecifierLoc NNS,
DeclarationNameInfo NameInfo, NamedDecl *FoundDecl,
ConceptDecl *CD,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
void setTypeConstraint(ConceptReference *CR,
Expr *ImmediatelyDeclaredConstraint);
/// Determine whether this template parameter has a type-constraint.
@ -1869,7 +1836,7 @@ class ClassTemplateSpecializationDecl
SourceLocation PointOfInstantiation;
/// The kind of specialization this declaration refers to.
/// Really a value of type TemplateSpecializationKind.
LLVM_PREFERRED_TYPE(TemplateSpecializationKind)
unsigned SpecializationKind : 3;
protected:
@ -2615,70 +2582,6 @@ public:
static bool classofKind(Kind K) { return K == TypeAliasTemplate; }
};
/// Declaration of a function specialization at template class scope.
///
/// For example:
/// \code
/// template <class T>
/// class A {
/// template <class U> void foo(U a) { }
/// template<> void foo(int a) { }
/// }
/// \endcode
///
/// "template<> foo(int a)" will be saved in Specialization as a normal
/// CXXMethodDecl. Then during an instantiation of class A, it will be
/// transformed into an actual function specialization.
///
/// FIXME: This is redundant; we could store the same information directly on
/// the CXXMethodDecl as a DependentFunctionTemplateSpecializationInfo.
class ClassScopeFunctionSpecializationDecl : public Decl {
CXXMethodDecl *Specialization;
const ASTTemplateArgumentListInfo *TemplateArgs;
ClassScopeFunctionSpecializationDecl(
DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD,
const ASTTemplateArgumentListInfo *TemplArgs)
: Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
Specialization(FD), TemplateArgs(TemplArgs) {}
ClassScopeFunctionSpecializationDecl(EmptyShell Empty)
: Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
virtual void anchor();
public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
CXXMethodDecl *getSpecialization() const { return Specialization; }
bool hasExplicitTemplateArgs() const { return TemplateArgs; }
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
return TemplateArgs;
}
static ClassScopeFunctionSpecializationDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD,
bool HasExplicitTemplateArgs,
const TemplateArgumentListInfo &TemplateArgs) {
return new (C, DC) ClassScopeFunctionSpecializationDecl(
DC, Loc, FD,
HasExplicitTemplateArgs
? ASTTemplateArgumentListInfo::Create(C, TemplateArgs)
: nullptr);
}
static ClassScopeFunctionSpecializationDecl *
CreateDeserialized(ASTContext &Context, unsigned ID);
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) {
return K == Decl::ClassScopeFunctionSpecialization;
}
};
/// Represents a variable template specialization, which refers to
/// a variable template with a given set of template arguments.
///
@ -2738,13 +2641,14 @@ class VarTemplateSpecializationDecl : public VarDecl,
SourceLocation PointOfInstantiation;
/// The kind of specialization this declaration refers to.
/// Really a value of type TemplateSpecializationKind.
LLVM_PREFERRED_TYPE(TemplateSpecializationKind)
unsigned SpecializationKind : 3;
/// Whether this declaration is a complete definition of the
/// variable template specialization. We can't otherwise tell apart
/// an instantiated declaration from an instantiated definition with
/// no initializer.
LLVM_PREFERRED_TYPE(bool)
unsigned IsCompleteDefinition : 1;
protected:

View file

@ -362,7 +362,8 @@ public:
}
/// Construct a declaration name from an Objective-C selector.
DeclarationName(Selector Sel) : Ptr(Sel.InfoPtr) {}
DeclarationName(Selector Sel)
: Ptr(reinterpret_cast<uintptr_t>(Sel.InfoPtr.getOpaqueValue())) {}
/// Returns the name for all C++ using-directives.
static DeclarationName getUsingDirectiveName() {

View file

@ -113,7 +113,9 @@ private:
struct {
SourceLocation Loc;
LLVM_PREFERRED_TYPE(AccessSpecifier)
unsigned Access : 2;
LLVM_PREFERRED_TYPE(bool)
unsigned IsMember : 1;
NamedDecl *TargetDecl;
CXXRecordDecl *NamingClass;

View file

@ -541,8 +541,8 @@ public:
/// Note: This does not perform the implicit conversions required by C++11
/// [expr.const]p5.
std::optional<llvm::APSInt>
getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc = nullptr,
bool isEvaluated = true) const;
getIntegerConstantExpr(const ASTContext &Ctx,
SourceLocation *Loc = nullptr) const;
bool isIntegerConstantExpr(const ASTContext &Ctx,
SourceLocation *Loc = nullptr) const;
@ -566,7 +566,7 @@ public:
SmallVectorImpl<
PartialDiagnosticAt> &Diags);
/// isPotentialConstantExprUnevaluted - Return true if this expression might
/// isPotentialConstantExprUnevaluated - Return true if this expression might
/// be usable in a constant expression in C++11 in an unevaluated context, if
/// it were in function FD marked constexpr. Return false if the function can
/// never produce a constant expression, along with diagnostics describing
@ -607,6 +607,13 @@ public:
/// foldable. If the expression is foldable, but not a constant expression,
/// the notes will describes why it isn't a constant expression. If the
/// expression *is* a constant expression, no notes will be produced.
///
/// FIXME: this causes significant performance concerns and should be
/// refactored at some point. Not all evaluations of the constant
/// expression interpreter will display the given diagnostics, this means
/// those kinds of uses are paying the expense of generating a diagnostic
/// (which may include expensive operations like converting APValue objects
/// to a string representation).
SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr;
EvalStatus() = default;
@ -1042,6 +1049,9 @@ public:
}
};
/// Describes the kind of result that can be tail-allocated.
enum class ConstantResultStorageKind { None, Int64, APValue };
/// ConstantExpr - An expression that occurs in a constant context and
/// optionally the result of evaluating the expression.
class ConstantExpr final
@ -1054,20 +1064,15 @@ class ConstantExpr final
friend class ASTStmtReader;
friend class ASTStmtWriter;
public:
/// Describes the kind of result that can be tail-allocated.
enum ResultStorageKind { RSK_None, RSK_Int64, RSK_APValue };
private:
size_t numTrailingObjects(OverloadToken<APValue>) const {
return ConstantExprBits.ResultKind == ConstantExpr::RSK_APValue;
return getResultStorageKind() == ConstantResultStorageKind::APValue;
}
size_t numTrailingObjects(OverloadToken<uint64_t>) const {
return ConstantExprBits.ResultKind == ConstantExpr::RSK_Int64;
return getResultStorageKind() == ConstantResultStorageKind::Int64;
}
uint64_t &Int64Result() {
assert(ConstantExprBits.ResultKind == ConstantExpr::RSK_Int64 &&
assert(getResultStorageKind() == ConstantResultStorageKind::Int64 &&
"invalid accessor");
return *getTrailingObjects<uint64_t>();
}
@ -1075,7 +1080,7 @@ private:
return const_cast<ConstantExpr *>(this)->Int64Result();
}
APValue &APValueResult() {
assert(ConstantExprBits.ResultKind == ConstantExpr::RSK_APValue &&
assert(getResultStorageKind() == ConstantResultStorageKind::APValue &&
"invalid accessor");
return *getTrailingObjects<APValue>();
}
@ -1083,22 +1088,23 @@ private:
return const_cast<ConstantExpr *>(this)->APValueResult();
}
ConstantExpr(Expr *SubExpr, ResultStorageKind StorageKind,
ConstantExpr(Expr *SubExpr, ConstantResultStorageKind StorageKind,
bool IsImmediateInvocation);
ConstantExpr(EmptyShell Empty, ResultStorageKind StorageKind);
ConstantExpr(EmptyShell Empty, ConstantResultStorageKind StorageKind);
public:
static ConstantExpr *Create(const ASTContext &Context, Expr *E,
const APValue &Result);
static ConstantExpr *Create(const ASTContext &Context, Expr *E,
ResultStorageKind Storage = RSK_None,
bool IsImmediateInvocation = false);
static ConstantExpr *
Create(const ASTContext &Context, Expr *E,
ConstantResultStorageKind Storage = ConstantResultStorageKind::None,
bool IsImmediateInvocation = false);
static ConstantExpr *CreateEmpty(const ASTContext &Context,
ResultStorageKind StorageKind);
ConstantResultStorageKind StorageKind);
static ResultStorageKind getStorageKind(const APValue &Value);
static ResultStorageKind getStorageKind(const Type *T,
const ASTContext &Context);
static ConstantResultStorageKind getStorageKind(const APValue &Value);
static ConstantResultStorageKind getStorageKind(const Type *T,
const ASTContext &Context);
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getBeginLoc();
@ -1119,8 +1125,8 @@ public:
APValue::ValueKind getResultAPValueKind() const {
return static_cast<APValue::ValueKind>(ConstantExprBits.APValueKind);
}
ResultStorageKind getResultStorageKind() const {
return static_cast<ResultStorageKind>(ConstantExprBits.ResultKind);
ConstantResultStorageKind getResultStorageKind() const {
return static_cast<ConstantResultStorageKind>(ConstantExprBits.ResultKind);
}
bool isImmediateInvocation() const {
return ConstantExprBits.IsImmediateInvocation;
@ -1449,6 +1455,16 @@ public:
DeclRefExprBits.IsImmediateEscalating = Set;
}
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const {
return DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter;
}
void setCapturedByCopyInLambdaWithExplicitObjectParameter(
bool Set, const ASTContext &Context) {
DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = Set;
setDependence(computeDependence(this, Context));
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == DeclRefExprClass;
}
@ -1604,26 +1620,18 @@ class FixedPointLiteral : public Expr, public APIntStorage {
}
};
class CharacterLiteral : public Expr {
public:
enum CharacterKind {
Ascii,
Wide,
UTF8,
UTF16,
UTF32
};
enum class CharacterLiteralKind { Ascii, Wide, UTF8, UTF16, UTF32 };
private:
class CharacterLiteral : public Expr {
unsigned Value;
SourceLocation Loc;
public:
// type should be IntTy
CharacterLiteral(unsigned value, CharacterKind kind, QualType type,
CharacterLiteral(unsigned value, CharacterLiteralKind kind, QualType type,
SourceLocation l)
: Expr(CharacterLiteralClass, type, VK_PRValue, OK_Ordinary),
Value(value), Loc(l) {
CharacterLiteralBits.Kind = kind;
CharacterLiteralBits.Kind = llvm::to_underlying(kind);
setDependence(ExprDependence::None);
}
@ -1631,8 +1639,8 @@ public:
CharacterLiteral(EmptyShell Empty) : Expr(CharacterLiteralClass, Empty) { }
SourceLocation getLocation() const { return Loc; }
CharacterKind getKind() const {
return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
CharacterLiteralKind getKind() const {
return static_cast<CharacterLiteralKind>(CharacterLiteralBits.Kind);
}
SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
@ -1641,14 +1649,16 @@ public:
unsigned getValue() const { return Value; }
void setLocation(SourceLocation Location) { Loc = Location; }
void setKind(CharacterKind kind) { CharacterLiteralBits.Kind = kind; }
void setKind(CharacterLiteralKind kind) {
CharacterLiteralBits.Kind = llvm::to_underlying(kind);
}
void setValue(unsigned Val) { Value = Val; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CharacterLiteralClass;
}
static void print(unsigned val, CharacterKind Kind, raw_ostream &OS);
static void print(unsigned val, CharacterLiteralKind Kind, raw_ostream &OS);
// Iterators
child_range children() {
@ -1770,6 +1780,15 @@ public:
}
};
enum class StringLiteralKind {
Ordinary,
Wide,
UTF8,
UTF16,
UTF32,
Unevaluated
};
/// StringLiteral - This represents a string literal expression, e.g. "foo"
/// or L"bar" (wide strings). The actual string data can be obtained with
/// getBytes() and is NOT null-terminated. The length of the string data is
@ -1808,10 +1827,6 @@ class StringLiteral final
///
/// * An array of getByteLength() char used to store the string data.
public:
enum StringKind { Ordinary, Wide, UTF8, UTF16, UTF32, Unevaluated };
private:
unsigned numTrailingObjects(OverloadToken<unsigned>) const { return 1; }
unsigned numTrailingObjects(OverloadToken<SourceLocation>) const {
return getNumConcatenated();
@ -1833,7 +1848,7 @@ private:
}
/// Build a string literal.
StringLiteral(const ASTContext &Ctx, StringRef Str, StringKind Kind,
StringLiteral(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind,
bool Pascal, QualType Ty, const SourceLocation *Loc,
unsigned NumConcatenated);
@ -1842,7 +1857,8 @@ private:
unsigned CharByteWidth);
/// Map a target and string kind to the appropriate character width.
static unsigned mapCharByteWidth(TargetInfo const &Target, StringKind SK);
static unsigned mapCharByteWidth(TargetInfo const &Target,
StringLiteralKind SK);
/// Set one of the string literal token.
void setStrTokenLoc(unsigned TokNum, SourceLocation L) {
@ -1854,13 +1870,13 @@ public:
/// This is the "fully general" constructor that allows representation of
/// strings formed from multiple concatenated tokens.
static StringLiteral *Create(const ASTContext &Ctx, StringRef Str,
StringKind Kind, bool Pascal, QualType Ty,
StringLiteralKind Kind, bool Pascal, QualType Ty,
const SourceLocation *Loc,
unsigned NumConcatenated);
/// Simple constructor for string literals made from one token.
static StringLiteral *Create(const ASTContext &Ctx, StringRef Str,
StringKind Kind, bool Pascal, QualType Ty,
StringLiteralKind Kind, bool Pascal, QualType Ty,
SourceLocation Loc) {
return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
}
@ -1902,16 +1918,16 @@ public:
unsigned getLength() const { return *getTrailingObjects<unsigned>(); }
unsigned getCharByteWidth() const { return StringLiteralBits.CharByteWidth; }
StringKind getKind() const {
return static_cast<StringKind>(StringLiteralBits.Kind);
StringLiteralKind getKind() const {
return static_cast<StringLiteralKind>(StringLiteralBits.Kind);
}
bool isOrdinary() const { return getKind() == Ordinary; }
bool isWide() const { return getKind() == Wide; }
bool isUTF8() const { return getKind() == UTF8; }
bool isUTF16() const { return getKind() == UTF16; }
bool isUTF32() const { return getKind() == UTF32; }
bool isUnevaluated() const { return getKind() == Unevaluated; }
bool isOrdinary() const { return getKind() == StringLiteralKind::Ordinary; }
bool isWide() const { return getKind() == StringLiteralKind::Wide; }
bool isUTF8() const { return getKind() == StringLiteralKind::UTF8; }
bool isUTF16() const { return getKind() == StringLiteralKind::UTF16; }
bool isUTF32() const { return getKind() == StringLiteralKind::UTF32; }
bool isUnevaluated() const { return getKind() == StringLiteralKind::Unevaluated; }
bool isPascal() const { return StringLiteralBits.IsPascal; }
bool containsNonAscii() const {
@ -1979,6 +1995,19 @@ public:
}
};
enum class PredefinedIdentKind {
Func,
Function,
LFunction, // Same as Function, but as wide string.
FuncDName,
FuncSig,
LFuncSig, // Same as FuncSig, but as wide string
PrettyFunction,
/// The same as PrettyFunction, except that the
/// 'virtual' keyword is omitted for virtual member functions.
PrettyFunctionNoVirtual
};
/// [C99 6.4.2.2] - A predefined identifier such as __func__.
class PredefinedExpr final
: public Expr,
@ -1990,22 +2019,7 @@ class PredefinedExpr final
// "Stmt *" for the predefined identifier. It is present if and only if
// hasFunctionName() is true and is always a "StringLiteral *".
public:
enum IdentKind {
Func,
Function,
LFunction, // Same as Function, but as wide string.
FuncDName,
FuncSig,
LFuncSig, // Same as FuncSig, but as wide string
PrettyFunction,
/// The same as PrettyFunction, except that the
/// 'virtual' keyword is omitted for virtual member functions.
PrettyFunctionNoVirtual
};
private:
PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK,
PredefinedExpr(SourceLocation L, QualType FNTy, PredefinedIdentKind IK,
bool IsTransparent, StringLiteral *SL);
explicit PredefinedExpr(EmptyShell Empty, bool HasFunctionName);
@ -2025,15 +2039,15 @@ public:
/// If IsTransparent, the PredefinedExpr is transparently handled as a
/// StringLiteral.
static PredefinedExpr *Create(const ASTContext &Ctx, SourceLocation L,
QualType FNTy, IdentKind IK, bool IsTransparent,
StringLiteral *SL);
QualType FNTy, PredefinedIdentKind IK,
bool IsTransparent, StringLiteral *SL);
/// Create an empty PredefinedExpr.
static PredefinedExpr *CreateEmpty(const ASTContext &Ctx,
bool HasFunctionName);
IdentKind getIdentKind() const {
return static_cast<IdentKind>(PredefinedExprBits.Kind);
PredefinedIdentKind getIdentKind() const {
return static_cast<PredefinedIdentKind>(PredefinedExprBits.Kind);
}
bool isTransparent() const { return PredefinedExprBits.IsTransparent; }
@ -2053,12 +2067,13 @@ public:
: nullptr;
}
static StringRef getIdentKindName(IdentKind IK);
static StringRef getIdentKindName(PredefinedIdentKind IK);
StringRef getIdentKindName() const {
return getIdentKindName(getIdentKind());
}
static std::string ComputeName(IdentKind IK, const Decl *CurrentDecl);
static std::string ComputeName(PredefinedIdentKind IK,
const Decl *CurrentDecl);
SourceLocation getBeginLoc() const { return getLocation(); }
SourceLocation getEndLoc() const { return getLocation(); }
@ -2341,7 +2356,7 @@ public:
}
protected:
/// Set FPFeatures in trailing storage, used only by Serialization
/// Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
void setStoredFPFeatures(FPOptionsOverride F) { getTrailingFPFeatures() = F; }
public:
@ -2359,6 +2374,7 @@ public:
}
friend TrailingObjects;
friend class ASTNodeImporter;
friend class ASTReader;
friend class ASTStmtReader;
friend class ASTStmtWriter;
@ -3607,6 +3623,19 @@ public:
return FPOptionsOverride();
}
/// Return
// True : if this conversion changes the volatile-ness of a gl-value.
// Qualification conversions on gl-values currently use CK_NoOp, but
// it's important to recognize volatile-changing conversions in
// clients code generation that normally eagerly peephole loads. Note
// that the query is answering for this specific node; Sema may
// produce multiple cast nodes for any particular conversion sequence.
// False : Otherwise.
bool changesVolatileQualification() const {
return (isGLValue() && (getType().isVolatileQualified() !=
getSubExpr()->getType().isVolatileQualified()));
}
static const FieldDecl *getTargetFieldForToUnionCast(QualType unionType,
QualType opType);
static const FieldDecl *getTargetFieldForToUnionCast(const RecordDecl *RD,
@ -4704,6 +4733,16 @@ public:
}
};
enum class SourceLocIdentKind {
Function,
FuncSig,
File,
FileName,
Line,
Column,
SourceLocStruct
};
/// Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(),
/// __builtin_FUNCTION(), __builtin_FUNCSIG(), __builtin_FILE(),
/// __builtin_FILE_NAME() or __builtin_source_location().
@ -4712,19 +4751,9 @@ class SourceLocExpr final : public Expr {
DeclContext *ParentContext;
public:
enum IdentKind {
Function,
FuncSig,
File,
FileName,
Line,
Column,
SourceLocStruct
};
SourceLocExpr(const ASTContext &Ctx, IdentKind Type, QualType ResultTy,
SourceLocation BLoc, SourceLocation RParenLoc,
DeclContext *Context);
SourceLocExpr(const ASTContext &Ctx, SourceLocIdentKind Type,
QualType ResultTy, SourceLocation BLoc,
SourceLocation RParenLoc, DeclContext *Context);
/// Build an empty call expression.
explicit SourceLocExpr(EmptyShell Empty) : Expr(SourceLocExprClass, Empty) {}
@ -4737,20 +4766,20 @@ public:
/// Return a string representing the name of the specific builtin function.
StringRef getBuiltinStr() const;
IdentKind getIdentKind() const {
return static_cast<IdentKind>(SourceLocExprBits.Kind);
SourceLocIdentKind getIdentKind() const {
return static_cast<SourceLocIdentKind>(SourceLocExprBits.Kind);
}
bool isIntType() const {
switch (getIdentKind()) {
case File:
case FileName:
case Function:
case FuncSig:
case SourceLocStruct:
case SourceLocIdentKind::File:
case SourceLocIdentKind::FileName:
case SourceLocIdentKind::Function:
case SourceLocIdentKind::FuncSig:
case SourceLocIdentKind::SourceLocStruct:
return false;
case Line:
case Column:
case SourceLocIdentKind::Line:
case SourceLocIdentKind::Column:
return true;
}
llvm_unreachable("unknown source location expression kind");
@ -5083,6 +5112,7 @@ private:
/// Whether this designated initializer used the GNU deprecated
/// syntax rather than the C99 '=' syntax.
LLVM_PREFERRED_TYPE(bool)
unsigned GNUSyntax : 1;
/// The number of designators in this initializer expression.
@ -5714,6 +5744,7 @@ class GenericSelectionExpr final
/// if and only if the generic selection expression is result-dependent.
unsigned NumAssocs : 15;
unsigned ResultIndex : 15; // NB: ResultDependentIndex is tied to this width.
LLVM_PREFERRED_TYPE(bool)
unsigned IsExprPredicate : 1;
enum : unsigned {
ResultDependentIndex = 0x7FFF
@ -6467,7 +6498,7 @@ public:
return cast<Expr>(SubExprs[ORDER_FAIL]);
}
Expr *getVal2() const {
if (Op == AO__atomic_exchange)
if (Op == AO__atomic_exchange || Op == AO__scoped_atomic_exchange)
return cast<Expr>(SubExprs[ORDER_FAIL]);
assert(NumSubExprs > VAL2);
return cast<Expr>(SubExprs[VAL2]);
@ -6479,6 +6510,16 @@ public:
QualType getValueType() const;
AtomicOp getOp() const { return Op; }
StringRef getOpAsString() const {
switch (Op) {
#define BUILTIN(ID, TYPE, ATTRS)
#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
case AO##ID: \
return #ID;
#include "clang/Basic/Builtins.def"
}
llvm_unreachable("not an atomic operator?");
}
unsigned getNumSubExprs() const { return NumSubExprs; }
Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); }
@ -6498,7 +6539,9 @@ public:
getOp() == AO__opencl_atomic_compare_exchange_weak ||
getOp() == AO__hip_atomic_compare_exchange_weak ||
getOp() == AO__atomic_compare_exchange ||
getOp() == AO__atomic_compare_exchange_n;
getOp() == AO__atomic_compare_exchange_n ||
getOp() == AO__scoped_atomic_compare_exchange ||
getOp() == AO__scoped_atomic_compare_exchange_n;
}
bool isOpenCL() const {
@ -6528,13 +6571,13 @@ public:
/// \return empty atomic scope model if the atomic op code does not have
/// scope operand.
static std::unique_ptr<AtomicScopeModel> getScopeModel(AtomicOp Op) {
auto Kind =
(Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
? AtomicScopeModelKind::OpenCL
: (Op >= AO__hip_atomic_load && Op <= AO__hip_atomic_fetch_max)
? AtomicScopeModelKind::HIP
: AtomicScopeModelKind::None;
return AtomicScopeModel::create(Kind);
if (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
return AtomicScopeModel::create(AtomicScopeModelKind::OpenCL);
else if (Op >= AO__hip_atomic_load && Op <= AO__hip_atomic_fetch_max)
return AtomicScopeModel::create(AtomicScopeModelKind::HIP);
else if (Op >= AO__scoped_atomic_load && Op <= AO__scoped_atomic_fetch_max)
return AtomicScopeModel::create(AtomicScopeModelKind::Generic);
return AtomicScopeModel::create(AtomicScopeModelKind::None);
}
/// Get atomic scope model.

View file

@ -760,7 +760,7 @@ public:
/// The null pointer literal (C++11 [lex.nullptr])
///
/// Introduced in C++11, the only literal of type \c nullptr_t is \c nullptr.
/// This also implements the null pointer literal in C2x (C2x 6.4.1) which is
/// This also implements the null pointer literal in C23 (C23 6.4.1) which is
/// intended to have the same semantics as the feature in C++.
class CXXNullPtrLiteralExpr : public Expr {
public:
@ -1146,9 +1146,8 @@ public:
/// };
/// \endcode
class CXXThisExpr : public Expr {
public:
CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit)
: Expr(CXXThisExprClass, Ty, VK_PRValue, OK_Ordinary) {
CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit, ExprValueKind VK)
: Expr(CXXThisExprClass, Ty, VK, OK_Ordinary) {
CXXThisExprBits.IsImplicit = IsImplicit;
CXXThisExprBits.Loc = L;
setDependence(computeDependence(this));
@ -1156,6 +1155,12 @@ public:
CXXThisExpr(EmptyShell Empty) : Expr(CXXThisExprClass, Empty) {}
public:
static CXXThisExpr *Create(const ASTContext &Ctx, SourceLocation L,
QualType Ty, bool IsImplicit);
static CXXThisExpr *CreateEmpty(const ASTContext &Ctx);
SourceLocation getLocation() const { return CXXThisExprBits.Loc; }
void setLocation(SourceLocation L) { CXXThisExprBits.Loc = L; }
@ -1514,19 +1519,17 @@ public:
}
};
enum class CXXConstructionKind {
Complete,
NonVirtualBase,
VirtualBase,
Delegating
};
/// Represents a call to a C++ constructor.
class CXXConstructExpr : public Expr {
friend class ASTStmtReader;
public:
enum ConstructionKind {
CK_Complete,
CK_NonVirtualBase,
CK_VirtualBase,
CK_Delegating
};
private:
/// A pointer to the constructor which will be ultimately called.
CXXConstructorDecl *Constructor;
@ -1562,7 +1565,7 @@ protected:
CXXConstructorDecl *Ctor, bool Elidable,
ArrayRef<Expr *> Args, bool HadMultipleCandidates,
bool ListInitialization, bool StdInitListInitialization,
bool ZeroInitialization, ConstructionKind ConstructKind,
bool ZeroInitialization, CXXConstructionKind ConstructKind,
SourceRange ParenOrBraceRange);
/// Build an empty C++ construction expression.
@ -1581,7 +1584,7 @@ public:
CXXConstructorDecl *Ctor, bool Elidable, ArrayRef<Expr *> Args,
bool HadMultipleCandidates, bool ListInitialization,
bool StdInitListInitialization, bool ZeroInitialization,
ConstructionKind ConstructKind, SourceRange ParenOrBraceRange);
CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange);
/// Create an empty C++ construction expression.
static CXXConstructExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs);
@ -1635,11 +1638,12 @@ public:
/// Determine whether this constructor is actually constructing
/// a base class (rather than a complete object).
ConstructionKind getConstructionKind() const {
return static_cast<ConstructionKind>(CXXConstructExprBits.ConstructionKind);
CXXConstructionKind getConstructionKind() const {
return static_cast<CXXConstructionKind>(
CXXConstructExprBits.ConstructionKind);
}
void setConstructionKind(ConstructionKind CK) {
CXXConstructExprBits.ConstructionKind = CK;
void setConstructionKind(CXXConstructionKind CK) {
CXXConstructExprBits.ConstructionKind = llvm::to_underlying(CK);
}
using arg_iterator = ExprIterator;
@ -1722,10 +1726,12 @@ private:
SourceLocation Loc;
/// Whether this is the construction of a virtual base.
LLVM_PREFERRED_TYPE(bool)
unsigned ConstructsVirtualBase : 1;
/// Whether the constructor is inherited from a virtual base class of the
/// class that we construct.
LLVM_PREFERRED_TYPE(bool)
unsigned InheritedFromVirtualBase : 1;
public:
@ -1754,9 +1760,9 @@ public:
/// Determine whether this constructor is actually constructing
/// a base class (rather than a complete object).
bool constructsVBase() const { return ConstructsVirtualBase; }
CXXConstructExpr::ConstructionKind getConstructionKind() const {
return ConstructsVirtualBase ? CXXConstructExpr::CK_VirtualBase
: CXXConstructExpr::CK_NonVirtualBase;
CXXConstructionKind getConstructionKind() const {
return ConstructsVirtualBase ? CXXConstructionKind::VirtualBase
: CXXConstructionKind::NonVirtualBase;
}
/// Determine whether the inherited constructor is inherited from a
@ -2200,6 +2206,20 @@ public:
}
};
enum class CXXNewInitializationStyle {
/// New-expression has no initializer as written.
None,
/// New-expression has no written initializer, but has an implicit one.
Implicit,
/// New-expression has a C++98 paren-delimited initializer.
Call,
/// New-expression has a C++11 list-initializer.
List
};
/// Represents a new-expression for memory allocation and constructor
/// calls, e.g: "new CXXNewExpr(foo)".
class CXXNewExpr final
@ -2253,25 +2273,12 @@ class CXXNewExpr final
return isParenTypeId();
}
public:
enum InitializationStyle {
/// New-expression has no initializer as written.
NoInit,
/// New-expression has a C++98 paren-delimited initializer.
CallInit,
/// New-expression has a C++11 list-initializer.
ListInit
};
private:
/// Build a c++ new expression.
CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew,
FunctionDecl *OperatorDelete, bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
InitializationStyle InitializationStyle, Expr *Initializer,
CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
SourceRange DirectInitRange);
@ -2286,7 +2293,7 @@ public:
FunctionDecl *OperatorDelete, bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs,
SourceRange TypeIdParens, std::optional<Expr *> ArraySize,
InitializationStyle InitializationStyle, Expr *Initializer,
CXXNewInitializationStyle InitializationStyle, Expr *Initializer,
QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range,
SourceRange DirectInitRange);
@ -2382,15 +2389,21 @@ public:
/// Whether this new-expression has any initializer at all.
bool hasInitializer() const {
return CXXNewExprBits.StoredInitializationStyle > 0;
switch (getInitializationStyle()) {
case CXXNewInitializationStyle::None:
return false;
case CXXNewInitializationStyle::Implicit:
case CXXNewInitializationStyle::Call:
case CXXNewInitializationStyle::List:
return true;
}
llvm_unreachable("Unknown initializer");
}
/// The kind of initializer this new-expression has.
InitializationStyle getInitializationStyle() const {
if (CXXNewExprBits.StoredInitializationStyle == 0)
return NoInit;
return static_cast<InitializationStyle>(
CXXNewExprBits.StoredInitializationStyle - 1);
CXXNewInitializationStyle getInitializationStyle() const {
return static_cast<CXXNewInitializationStyle>(
CXXNewExprBits.StoredInitializationStyle);
}
/// The initializer of this new-expression.
@ -2605,6 +2618,7 @@ class CXXPseudoDestructorExpr : public Expr {
/// Whether the operator was an arrow ('->'); otherwise, it was a
/// period ('.').
LLVM_PREFERRED_TYPE(bool)
bool IsArrow : 1;
/// The location of the '.' or '->' operator.
@ -2834,6 +2848,7 @@ public:
/// \endcode
class ArrayTypeTraitExpr : public Expr {
/// The trait. An ArrayTypeTrait enum in MSVC compat unsigned.
LLVM_PREFERRED_TYPE(ArrayTypeTrait)
unsigned ATT : 2;
/// The value of the type trait. Unspecified if dependent.
@ -2904,9 +2919,11 @@ public:
/// \endcode
class ExpressionTraitExpr : public Expr {
/// The trait. A ExpressionTrait enum in MSVC compatible unsigned.
LLVM_PREFERRED_TYPE(ExpressionTrait)
unsigned ET : 31;
/// The value of the type trait. Unspecified if dependent.
LLVM_PREFERRED_TYPE(bool)
unsigned Value : 1;
/// The location of the type trait keyword.
@ -3186,7 +3203,8 @@ class UnresolvedLookupExpr final
const DeclarationNameInfo &NameInfo, bool RequiresADL,
bool Overloaded,
const TemplateArgumentListInfo *TemplateArgs,
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
UnresolvedSetIterator Begin, UnresolvedSetIterator End,
bool KnownDependent);
UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults,
bool HasTemplateKWAndArgsInfo);
@ -3206,12 +3224,15 @@ public:
const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded,
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
// After canonicalization, there may be dependent template arguments in
// CanonicalConverted But none of Args is dependent. When any of
// CanonicalConverted dependent, KnownDependent is true.
static UnresolvedLookupExpr *
Create(const ASTContext &Context, CXXRecordDecl *NamingClass,
NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
const DeclarationNameInfo &NameInfo, bool RequiresADL,
const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin,
UnresolvedSetIterator End);
UnresolvedSetIterator End, bool KnownDependent);
static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context,
unsigned NumResults,

View file

@ -39,14 +39,13 @@ class ASTStmtWriter;
///
/// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
/// specialization of a concept results in a prvalue of type bool.
class ConceptSpecializationExpr final : public Expr, public ConceptReference {
class ConceptSpecializationExpr final : public Expr {
friend class ASTReader;
friend class ASTStmtReader;
public:
using SubstitutionDiagnostic = std::pair<SourceLocation, std::string>;
private:
ConceptReference *ConceptRef;
protected:
/// \brief The Implicit Concept Specialization Decl, which holds the template
/// arguments for this specialization.
ImplicitConceptSpecializationDecl *SpecDecl;
@ -56,16 +55,11 @@ protected:
/// ignored.
ASTConstraintSatisfaction *Satisfaction;
ConceptSpecializationExpr(const ASTContext &C, NestedNameSpecifierLoc NNS,
SourceLocation TemplateKWLoc,
DeclarationNameInfo ConceptNameInfo,
NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
ConceptSpecializationExpr(const ASTContext &C, ConceptReference *ConceptRef,
ImplicitConceptSpecializationDecl *SpecDecl,
const ConstraintSatisfaction *Satisfaction);
ConceptSpecializationExpr(const ASTContext &C, ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
ConceptSpecializationExpr(const ASTContext &C, ConceptReference *ConceptRef,
ImplicitConceptSpecializationDecl *SpecDecl,
const ConstraintSatisfaction *Satisfaction,
bool Dependent,
@ -74,16 +68,12 @@ protected:
public:
static ConceptSpecializationExpr *
Create(const ASTContext &C, NestedNameSpecifierLoc NNS,
SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo,
NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
Create(const ASTContext &C, ConceptReference *ConceptRef,
ImplicitConceptSpecializationDecl *SpecDecl,
const ConstraintSatisfaction *Satisfaction);
static ConceptSpecializationExpr *
Create(const ASTContext &C, ConceptDecl *NamedConcept,
const ASTTemplateArgumentListInfo *ArgsAsWritten,
Create(const ASTContext &C, ConceptReference *ConceptRef,
ImplicitConceptSpecializationDecl *SpecDecl,
const ConstraintSatisfaction *Satisfaction, bool Dependent,
bool ContainsUnexpandedParameterPack);
@ -92,6 +82,37 @@ public:
return SpecDecl->getTemplateArguments();
}
ConceptReference *getConceptReference() const { return ConceptRef; }
ConceptDecl *getNamedConcept() const { return ConceptRef->getNamedConcept(); }
// FIXME: Several of the following functions can be removed. Instead the
// caller can directly work with the ConceptReference.
bool hasExplicitTemplateArgs() const {
return ConceptRef->hasExplicitTemplateArgs();
}
SourceLocation getConceptNameLoc() const {
return ConceptRef->getConceptNameLoc();
}
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
return ConceptRef->getTemplateArgsAsWritten();
}
const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
return ConceptRef->getNestedNameSpecifierLoc();
}
SourceLocation getTemplateKWLoc() const {
return ConceptRef->getTemplateKWLoc();
}
NamedDecl *getFoundDecl() const { return ConceptRef->getFoundDecl(); }
const DeclarationNameInfo &getConceptNameInfo() const {
return ConceptRef->getConceptNameInfo();
}
const ImplicitConceptSpecializationDecl *getSpecializationDecl() const {
assert(SpecDecl && "Template Argument Decl not initialized");
return SpecDecl;
@ -120,17 +141,15 @@ public:
}
SourceLocation getBeginLoc() const LLVM_READONLY {
if (auto QualifierLoc = getNestedNameSpecifierLoc())
return QualifierLoc.getBeginLoc();
return ConceptName.getBeginLoc();
return ConceptRef->getBeginLoc();
}
SourceLocation getEndLoc() const LLVM_READONLY {
// If the ConceptSpecializationExpr is the ImmediatelyDeclaredConstraint
// of a TypeConstraint written syntactically as a constrained-parameter,
// there may not be a template argument list.
return ArgsAsWritten->RAngleLoc.isValid() ? ArgsAsWritten->RAngleLoc
: ConceptName.getEndLoc();
return ConceptRef->getEndLoc();
}
SourceLocation getExprLoc() const LLVM_READONLY {
return ConceptRef->getLocation();
}
// Iterators
@ -154,8 +173,11 @@ public:
private:
const RequirementKind Kind;
// FIXME: use RequirementDependence to model dependence?
LLVM_PREFERRED_TYPE(bool)
bool Dependent : 1;
LLVM_PREFERRED_TYPE(bool)
bool ContainsUnexpandedParameterPack : 1;
LLVM_PREFERRED_TYPE(bool)
bool Satisfied : 1;
public:
struct SubstitutionDiagnostic {
@ -492,6 +514,8 @@ class RequiresExpr final : public Expr,
unsigned NumLocalParameters;
unsigned NumRequirements;
RequiresExprBodyDecl *Body;
SourceLocation LParenLoc;
SourceLocation RParenLoc;
SourceLocation RBraceLoc;
unsigned numTrailingObjects(OverloadToken<ParmVarDecl *>) const {
@ -503,19 +527,22 @@ class RequiresExpr final : public Expr,
}
RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc,
RequiresExprBodyDecl *Body,
RequiresExprBodyDecl *Body, SourceLocation LParenLoc,
ArrayRef<ParmVarDecl *> LocalParameters,
SourceLocation RParenLoc,
ArrayRef<concepts::Requirement *> Requirements,
SourceLocation RBraceLoc);
RequiresExpr(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
unsigned NumRequirements);
public:
static RequiresExpr *
Create(ASTContext &C, SourceLocation RequiresKWLoc,
RequiresExprBodyDecl *Body, ArrayRef<ParmVarDecl *> LocalParameters,
ArrayRef<concepts::Requirement *> Requirements,
SourceLocation RBraceLoc);
static RequiresExpr *Create(ASTContext &C, SourceLocation RequiresKWLoc,
RequiresExprBodyDecl *Body,
SourceLocation LParenLoc,
ArrayRef<ParmVarDecl *> LocalParameters,
SourceLocation RParenLoc,
ArrayRef<concepts::Requirement *> Requirements,
SourceLocation RBraceLoc);
static RequiresExpr *
Create(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
unsigned NumRequirements);
@ -548,6 +575,8 @@ public:
return RequiresExprBits.RequiresKWLoc;
}
SourceLocation getLParenLoc() const { return LParenLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
SourceLocation getRBraceLoc() const { return RBraceLoc; }
static bool classof(const Stmt *T) {

View file

@ -317,6 +317,7 @@ class ObjCDictionaryLiteral final
/// key/value pairs, which provide the locations of the ellipses (if
/// any) and number of elements in the expansion (if known). If
/// there are no pack expansions, we optimize away this storage.
LLVM_PREFERRED_TYPE(bool)
unsigned HasPackExpansions : 1;
SourceRange Range;
@ -554,9 +555,11 @@ class ObjCIvarRefExpr : public Expr {
SourceLocation OpLoc;
// True if this is "X->F", false if this is "X.F".
LLVM_PREFERRED_TYPE(bool)
bool IsArrow : 1;
// True if ivar reference has no base (self assumed).
LLVM_PREFERRED_TYPE(bool)
bool IsFreeIvar : 1;
public:
@ -940,6 +943,23 @@ private:
class ObjCMessageExpr final
: public Expr,
private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> {
public:
/// The kind of receiver this message is sending to.
enum ReceiverKind {
/// The receiver is a class.
Class = 0,
/// The receiver is an object instance.
Instance,
/// The receiver is a superclass.
SuperClass,
/// The receiver is the instance of the superclass object.
SuperInstance
};
private:
/// Stores either the selector that this message is sending
/// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer
/// referring to the method that we type-checked against.
@ -955,6 +975,7 @@ class ObjCMessageExpr final
/// ReceiverKind values.
///
/// We pad this out to a byte to avoid excessive masking and shifting.
LLVM_PREFERRED_TYPE(ReceiverKind)
unsigned Kind : 8;
/// Whether we have an actual method prototype in \c
@ -962,18 +983,22 @@ class ObjCMessageExpr final
///
/// When non-zero, we have a method declaration; otherwise, we just
/// have a selector.
LLVM_PREFERRED_TYPE(bool)
unsigned HasMethod : 1;
/// Whether this message send is a "delegate init call",
/// i.e. a call of an init method on self from within an init method.
LLVM_PREFERRED_TYPE(bool)
unsigned IsDelegateInitCall : 1;
/// Whether this message send was implicitly generated by
/// the implementation rather than explicitly written by the user.
LLVM_PREFERRED_TYPE(bool)
unsigned IsImplicit : 1;
/// Whether the locations of the selector identifiers are in a
/// "standard" position, a enum SelectorLocationsKind.
LLVM_PREFERRED_TYPE(SelectorLocationsKind)
unsigned SelLocsKind : 2;
/// When the message expression is a send to 'super', this is
@ -1082,21 +1107,6 @@ public:
friend class ASTStmtWriter;
friend TrailingObjects;
/// The kind of receiver this message is sending to.
enum ReceiverKind {
/// The receiver is a class.
Class = 0,
/// The receiver is an object instance.
Instance,
/// The receiver is a superclass.
SuperClass,
/// The receiver is the instance of the superclass object.
SuperInstance
};
/// Create a message send to super.
///
/// \param Context The ASTContext in which this expression will be created.
@ -1631,6 +1641,7 @@ class ObjCBridgedCastExpr final
SourceLocation LParenLoc;
SourceLocation BridgeKeywordLoc;
LLVM_PREFERRED_TYPE(ObjCBridgeCastKind)
unsigned Kind : 2;
public:

View file

@ -208,6 +208,14 @@ public:
void Visit(const concepts::Requirement *R);
void Visit(const APValue &Value, QualType Ty);
void VisitAliasAttr(const AliasAttr *AA);
void VisitCleanupAttr(const CleanupAttr *CA);
void VisitDeprecatedAttr(const DeprecatedAttr *DA);
void VisitUnavailableAttr(const UnavailableAttr *UA);
void VisitSectionAttr(const SectionAttr *SA);
void VisitVisibilityAttr(const VisibilityAttr *VA);
void VisitTLSModelAttr(const TLSModelAttr *TA);
void VisitTypedefType(const TypedefType *TT);
void VisitUsingType(const UsingType *TT);
void VisitFunctionType(const FunctionType *T);
@ -277,6 +285,7 @@ public:
void VisitBinaryOperator(const BinaryOperator *BO);
void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
void VisitMemberExpr(const MemberExpr *ME);
void VisitAtomicExpr(const AtomicExpr *AE);
void VisitCXXNewExpr(const CXXNewExpr *NE);
void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
void VisitCXXThisExpr(const CXXThisExpr *TE);

View file

@ -178,8 +178,8 @@ public:
/// or type uniquing.
/// TODO: Extend this to internal types by generating names that are unique
/// across translation units so it can be used with LTO.
virtual void mangleTypeName(QualType T, raw_ostream &,
bool NormalizeIntegers = false) = 0;
virtual void mangleCanonicalTypeName(QualType T, raw_ostream &,
bool NormalizeIntegers = false) = 0;
/// @}
};

View file

@ -2513,6 +2513,89 @@ public:
}
};
/// This represents 'fail' clause in the '#pragma omp atomic'
/// directive.
///
/// \code
/// #pragma omp atomic compare fail
/// \endcode
/// In this example directive '#pragma omp atomic compare' has 'fail' clause.
class OMPFailClause final : public OMPClause {
// FailParameter is a memory-order-clause. Storing the ClauseKind is
// sufficient for our purpose.
OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
SourceLocation FailParameterLoc;
SourceLocation LParenLoc;
friend class OMPClauseReader;
/// Sets the location of '(' in fail clause.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
/// Sets the location of memoryOrder clause argument in fail clause.
void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
/// Sets the mem_order clause for 'atomic compare fail' directive.
void setFailParameter(OpenMPClauseKind FailParameter) {
this->FailParameter = FailParameter;
assert(checkFailClauseParameter(FailParameter) &&
"Invalid fail clause parameter");
}
public:
/// Build 'fail' clause.
///
/// \param StartLoc Starting location of the clause.
/// \param EndLoc Ending location of the clause.
OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
setFailParameter(FailParameter);
}
/// Build an empty clause.
OMPFailClause()
: OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
child_range children() {
return child_range(child_iterator(), child_iterator());
}
const_child_range children() const {
return const_child_range(const_child_iterator(), const_child_iterator());
}
child_range used_children() {
return child_range(child_iterator(), child_iterator());
}
const_child_range used_children() const {
return const_child_range(const_child_iterator(), const_child_iterator());
}
static bool classof(const OMPClause *T) {
return T->getClauseKind() == llvm::omp::OMPC_fail;
}
/// Gets the location of '(' (for the parameter) in fail clause.
SourceLocation getLParenLoc() const {
return LParenLoc;
}
/// Gets the location of Fail Parameter (type memory-order-clause) in
/// fail clause.
SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
/// Gets the parameter (type memory-order-clause) in Fail clause.
OpenMPClauseKind getFailParameter() const { return FailParameter; }
};
/// This represents clause 'private' in the '#pragma omp ...' directives.
///
/// \code
@ -3918,6 +4001,9 @@ class OMPLinearClause final
/// Location of ':'.
SourceLocation ColonLoc;
/// Location of 'step' modifier.
SourceLocation StepModifierLoc;
/// Sets the linear step for clause.
void setStep(Expr *Step) { *(getFinals().end()) = Step; }
@ -3929,16 +4015,18 @@ class OMPLinearClause final
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param ColonLoc Location of ':'.
/// \param StepModifierLoc Location of 'step' modifier.
/// \param EndLoc Ending location of the clause.
/// \param NumVars Number of variables.
OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
SourceLocation ColonLoc, SourceLocation EndLoc,
unsigned NumVars)
SourceLocation ColonLoc, SourceLocation StepModifierLoc,
SourceLocation EndLoc, unsigned NumVars)
: OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
LParenLoc, EndLoc, NumVars),
OMPClauseWithPostUpdate(this), Modifier(Modifier),
ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
StepModifierLoc(StepModifierLoc) {}
/// Build an empty clause.
///
@ -4017,6 +4105,7 @@ public:
/// \param Modifier Modifier of 'linear' clause.
/// \param ModifierLoc Modifier location.
/// \param ColonLoc Location of ':'.
/// \param StepModifierLoc Location of 'step' modifier.
/// \param EndLoc Ending location of the clause.
/// \param VL List of references to the variables.
/// \param PL List of private copies of original variables.
@ -4030,9 +4119,10 @@ public:
static OMPLinearClause *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep,
Stmt *PreInit, Expr *PostUpdate);
SourceLocation ColonLoc, SourceLocation StepModifierLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PL,
ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit,
Expr *PostUpdate);
/// Creates an empty clause with the place for \a NumVars variables.
///
@ -4055,9 +4145,15 @@ public:
/// Sets the location of ':'.
void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
/// Sets the location of 'step' modifier.
void setStepModifierLoc(SourceLocation Loc) { StepModifierLoc = Loc; }
/// Returns the location of ':'.
SourceLocation getColonLoc() const { return ColonLoc; }
/// Returns the location of 'step' modifier.
SourceLocation getStepModifierLoc() const { return StepModifierLoc; }
/// Returns linear step.
Expr *getStep() { return *(getFinals().end()); }
@ -7763,10 +7859,10 @@ public:
/// \param MLoc Location of the modifier
OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, OpenMPOrderClauseModifier M,
SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
SourceLocation MLoc)
: OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc),
LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(M),
LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
ModifierKwLoc(MLoc) {}
/// Build an empty clause.
@ -9172,6 +9268,75 @@ public:
}
};
/// This represents 'ompx_attribute' clause in a directive that might generate
/// an outlined function. An example is given below.
///
/// \code
/// #pragma omp target [...] ompx_attribute(flatten)
/// \endcode
class OMPXAttributeClause
: public OMPNoChildClause<llvm::omp::OMPC_ompx_attribute> {
friend class OMPClauseReader;
/// Location of '('.
SourceLocation LParenLoc;
/// The parsed attributes (clause arguments)
SmallVector<const Attr *> Attrs;
public:
/// Build 'ompx_attribute' clause.
///
/// \param Attrs The parsed attributes (clause arguments)
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
OMPXAttributeClause(ArrayRef<const Attr *> Attrs, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation EndLoc)
: OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Attrs(Attrs) {
}
/// Build an empty clause.
OMPXAttributeClause() : OMPNoChildClause() {}
/// Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
/// Returns the location of '('.
SourceLocation getLParenLoc() const { return LParenLoc; }
/// Returned the attributes parsed from this clause.
ArrayRef<const Attr *> getAttrs() const { return Attrs; }
private:
/// Replace the attributes with \p NewAttrs.
void setAttrs(ArrayRef<Attr *> NewAttrs) {
Attrs.clear();
Attrs.append(NewAttrs.begin(), NewAttrs.end());
}
};
/// This represents 'ompx_bare' clause in the '#pragma omp target teams ...'
/// directive.
///
/// \code
/// #pragma omp target teams ompx_bare
/// \endcode
/// In this example directive '#pragma omp target teams' has a 'ompx_bare'
/// clause.
class OMPXBareClause : public OMPNoChildClause<llvm::omp::OMPC_ompx_bare> {
public:
/// Build 'ompx_bare' clause.
///
/// \param StartLoc Starting location of the clause.
/// \param EndLoc Ending location of the clause.
OMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
: OMPNoChildClause(StartLoc, EndLoc) {}
/// Build an empty clause.
OMPXBareClause() = default;
};
} // namespace clang
#endif // LLVM_CLANG_AST_OPENMPCLAUSE_H

View file

@ -80,6 +80,7 @@ CAST_OPERATION(LValueToRValue)
/// (possibly) adding qualifiers or removing noexcept.
/// int -> int
/// char** -> const char * const *
/// int[1] -> int[]
/// void () noexcept -> void ()
CAST_OPERATION(NoOp)

View file

@ -66,7 +66,7 @@ struct PrintingPolicy {
SuppressLifetimeQualifiers(false),
SuppressTemplateArgsInCXXConstructors(false),
SuppressDefaultTemplateArgs(true), Bool(LO.Bool),
Nullptr(LO.CPlusPlus11 || LO.C2x), NullptrTypeInNamespace(LO.CPlusPlus),
Nullptr(LO.CPlusPlus11 || LO.C23), NullptrTypeInNamespace(LO.CPlusPlus),
Restrict(LO.C99), Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
UseVoidForZeroParams(!LO.CPlusPlus),
SplitTemplateClosers(!LO.CPlusPlus11), TerseOutput(false),
@ -106,6 +106,7 @@ struct PrintingPolicy {
/// declaration for "x", so that we will print "int *x"; it will be
/// \c true when we print "y", so that we suppress printing the
/// "const int" type specifier and instead only print the "*y".
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressSpecifiers : 1;
/// Whether type printing should skip printing the tag keyword.
@ -116,6 +117,7 @@ struct PrintingPolicy {
/// \code
/// struct Geometry::Point;
/// \endcode
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressTagKeyword : 1;
/// When true, include the body of a tag definition.
@ -126,22 +128,27 @@ struct PrintingPolicy {
/// \code
/// typedef struct { int x, y; } Point;
/// \endcode
LLVM_PREFERRED_TYPE(bool)
unsigned IncludeTagDefinition : 1;
/// Suppresses printing of scope specifiers.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressScope : 1;
/// Suppress printing parts of scope specifiers that are never
/// written, e.g., for anonymous namespaces.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressUnwrittenScope : 1;
/// Suppress printing parts of scope specifiers that correspond
/// to inline namespaces, where the name is unambiguous with the specifier
/// removed.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressInlineNamespace : 1;
/// Ignore qualifiers and tag keywords as specified by elaborated type sugar,
/// instead letting the underlying type print as normal.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressElaboration : 1;
/// Suppress printing of variable initializers.
@ -155,6 +162,7 @@ struct PrintingPolicy {
///
/// SuppressInitializers will be true when printing "auto x", so that the
/// internal initializer constructed for x will not be printed.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressInitializers : 1;
/// Whether we should print the sizes of constant array expressions as written
@ -173,53 +181,67 @@ struct PrintingPolicy {
/// int a[104];
/// char a[9] = "A string";
/// \endcode
LLVM_PREFERRED_TYPE(bool)
unsigned ConstantArraySizeAsWritten : 1;
/// When printing an anonymous tag name, also print the location of that
/// entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just prints
/// "(anonymous)" for the name.
LLVM_PREFERRED_TYPE(bool)
unsigned AnonymousTagLocations : 1;
/// When true, suppress printing of the __strong lifetime qualifier in ARC.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressStrongLifetime : 1;
/// When true, suppress printing of lifetime qualifier in ARC.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressLifetimeQualifiers : 1;
/// When true, suppresses printing template arguments in names of C++
/// constructors.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressTemplateArgsInCXXConstructors : 1;
/// When true, attempt to suppress template arguments that match the default
/// argument for the parameter.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressDefaultTemplateArgs : 1;
/// Whether we can use 'bool' rather than '_Bool' (even if the language
/// doesn't actually have 'bool', because, e.g., it is defined as a macro).
LLVM_PREFERRED_TYPE(bool)
unsigned Bool : 1;
/// Whether we should use 'nullptr' rather than '0' as a null pointer
/// constant.
LLVM_PREFERRED_TYPE(bool)
unsigned Nullptr : 1;
/// Whether 'nullptr_t' is in namespace 'std' or not.
LLVM_PREFERRED_TYPE(bool)
unsigned NullptrTypeInNamespace : 1;
/// Whether we can use 'restrict' rather than '__restrict'.
LLVM_PREFERRED_TYPE(bool)
unsigned Restrict : 1;
/// Whether we can use 'alignof' rather than '__alignof'.
LLVM_PREFERRED_TYPE(bool)
unsigned Alignof : 1;
/// Whether we can use '_Alignof' rather than '__alignof'.
LLVM_PREFERRED_TYPE(bool)
unsigned UnderscoreAlignof : 1;
/// Whether we should use '(void)' rather than '()' for a function prototype
/// with zero parameters.
LLVM_PREFERRED_TYPE(bool)
unsigned UseVoidForZeroParams : 1;
/// Whether nested templates must be closed like 'a\<b\<c\> \>' rather than
/// 'a\<b\<c\>\>'.
LLVM_PREFERRED_TYPE(bool)
unsigned SplitTemplateClosers : 1;
/// Provide a 'terse' output.
@ -227,27 +249,33 @@ struct PrintingPolicy {
/// For example, in this mode we don't print function bodies, class members,
/// declarations inside namespaces etc. Effectively, this should print
/// only the requested declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned TerseOutput : 1;
/// When true, do certain refinement needed for producing proper declaration
/// tag; such as, do not print attributes attached to the declaration.
///
LLVM_PREFERRED_TYPE(bool)
unsigned PolishForDeclaration : 1;
/// When true, print the half-precision floating-point type as 'half'
/// instead of '__fp16'
LLVM_PREFERRED_TYPE(bool)
unsigned Half : 1;
/// When true, print the built-in wchar_t type as __wchar_t. For use in
/// Microsoft mode when wchar_t is not available.
LLVM_PREFERRED_TYPE(bool)
unsigned MSWChar : 1;
/// When true, include newlines after statements like "break", etc.
LLVM_PREFERRED_TYPE(bool)
unsigned IncludeNewlines : 1;
/// Use whitespace and punctuation like MSVC does. In particular, this prints
/// anonymous namespaces as `anonymous namespace' and does not insert spaces
/// after template arguments.
LLVM_PREFERRED_TYPE(bool)
unsigned MSVCFormatting : 1;
/// Whether we should print the constant expressions as written in the
@ -266,42 +294,52 @@ struct PrintingPolicy {
/// 0x10
/// 2.5e3
/// \endcode
LLVM_PREFERRED_TYPE(bool)
unsigned ConstantsAsWritten : 1;
/// When true, don't print the implicit 'self' or 'this' expressions.
LLVM_PREFERRED_TYPE(bool)
unsigned SuppressImplicitBase : 1;
/// When true, print the fully qualified name of function declarations.
/// This is the opposite of SuppressScope and thus overrules it.
LLVM_PREFERRED_TYPE(bool)
unsigned FullyQualifiedName : 1;
/// Whether to print types as written or canonically.
LLVM_PREFERRED_TYPE(bool)
unsigned PrintCanonicalTypes : 1;
/// Whether to print an InjectedClassNameType with template arguments or as
/// written. When a template argument is unnamed, printing it results in
/// invalid C++ code.
LLVM_PREFERRED_TYPE(bool)
unsigned PrintInjectedClassNameWithArguments : 1;
/// Whether to use C++ template preferred_name attributes when printing
/// templates.
LLVM_PREFERRED_TYPE(bool)
unsigned UsePreferredNames : 1;
/// Whether to use type suffixes (eg: 1U) on integral non-type template
/// parameters.
LLVM_PREFERRED_TYPE(bool)
unsigned AlwaysIncludeTypeForTemplateArgument : 1;
/// Whether to strip underscores when printing reserved parameter names.
/// e.g. std::vector<class _Tp> becomes std::vector<class Tp>.
/// This only affects parameter names, and so describes a compatible API.
LLVM_PREFERRED_TYPE(bool)
unsigned CleanUglifiedParameters : 1;
/// Whether to print the entire array initializers, especially on non-type
/// template parameters, no matter how many elements there are.
LLVM_PREFERRED_TYPE(bool)
unsigned EntireContentsOfLargeArray : 1;
/// Whether to print enumerator non-type template parameters with a matching
/// enumerator name or via cast of an integer.
LLVM_PREFERRED_TYPE(bool)
unsigned UseEnumerators : 1;
/// Callbacks to use to allow the behavior of printing to be customized.

View file

@ -74,7 +74,7 @@ def APInt : PropertyType<"llvm::APInt"> { let PassByReference = 1; }
def APSInt : PropertyType<"llvm::APSInt"> { let PassByReference = 1; }
def APValue : PropertyType { let PassByReference = 1; }
def APValueKind : EnumPropertyType<"APValue::ValueKind">;
def ArraySizeModifier : EnumPropertyType<"ArrayType::ArraySizeModifier">;
def ArraySizeModifier : EnumPropertyType<"ArraySizeModifier">;
def AttrKind : EnumPropertyType<"attr::Kind">;
def AutoTypeKeyword : EnumPropertyType;
def Bool : PropertyType<"bool">;
@ -142,7 +142,7 @@ def TypeOfKind : EnumPropertyType<"TypeOfKind">;
def UInt32 : CountPropertyType<"uint32_t">;
def UInt64 : CountPropertyType<"uint64_t">;
def UnaryTypeTransformKind : EnumPropertyType<"UnaryTransformType::UTTKind">;
def VectorKind : EnumPropertyType<"VectorType::VectorKind">;
def VectorKind : EnumPropertyType<"VectorKind">;
def ExceptionSpecInfo : PropertyType<"FunctionProtoType::ExceptionSpecInfo"> {
let BufferElementTypes = [ QualType ];

View file

@ -178,6 +178,7 @@ private:
mutable bool RawTextValid : 1; ///< True if RawText is valid
mutable bool BriefTextValid : 1; ///< True if BriefText is valid
LLVM_PREFERRED_TYPE(CommentKind)
unsigned Kind : 3;
/// True if comment is attached to a declaration in ASTContext.

View file

@ -312,6 +312,13 @@ public:
/// \returns false if the visitation was terminated early, true otherwise.
bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc);
/// Recursively visit concept reference with location information.
///
/// \returns false if the visitation was terminated early, true otherwise.
bool TraverseConceptReference(ConceptReference *CR);
// Visit concept reference.
bool VisitConceptReference(ConceptReference *CR) { return true; }
// ---- Methods on Attrs ----
// Visit an attribute.
@ -469,9 +476,6 @@ public:
private:
// These are helper methods used by more than one Traverse* method.
bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
/// Traverses the qualifier, name and template arguments of a concept
/// reference.
bool TraverseConceptReferenceHelper(const ConceptReference &C);
// Traverses template parameter lists of either a DeclaratorDecl or TagDecl.
template <typename T>
@ -507,7 +511,7 @@ template <typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseTypeConstraint(
const TypeConstraint *C) {
if (!getDerived().shouldVisitImplicitCode()) {
TRY_TO(TraverseConceptReferenceHelper(*C));
TRY_TO(TraverseConceptReference(C->getConceptReference()));
return true;
}
if (Expr *IDC = C->getImmediatelyDeclaredConstraint()) {
@ -517,7 +521,7 @@ bool RecursiveASTVisitor<Derived>::TraverseTypeConstraint(
// if we have an immediately-declared-constraint, otherwise
// we'll end up visiting the concept and the arguments in
// the TC twice.
TRY_TO(TraverseConceptReferenceHelper(*C));
TRY_TO(TraverseConceptReference(C->getConceptReference()));
}
return true;
}
@ -540,18 +544,6 @@ bool RecursiveASTVisitor<Derived>::TraverseConceptRequirement(
llvm_unreachable("unexpected case");
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseConceptReferenceHelper(
const ConceptReference &C) {
TRY_TO(TraverseNestedNameSpecifierLoc(C.getNestedNameSpecifierLoc()));
TRY_TO(TraverseDeclarationNameInfo(C.getConceptNameInfo()));
if (C.hasExplicitTemplateArgs())
TRY_TO(TraverseTemplateArgumentLocsHelper(
C.getTemplateArgsAsWritten()->getTemplateArgs(),
C.getTemplateArgsAsWritten()->NumTemplateArgs));
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
DataRecursionQueue *Queue) {
@ -1356,10 +1348,7 @@ DEF_TRAVERSE_TYPELOC(UnaryTransformType, {
DEF_TRAVERSE_TYPELOC(AutoType, {
TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
if (TL.isConstrained()) {
TRY_TO(TraverseNestedNameSpecifierLoc(TL.getNestedNameSpecifierLoc()));
TRY_TO(TraverseDeclarationNameInfo(TL.getConceptNameInfo()));
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
TRY_TO(TraverseConceptReference(TL.getConceptReference()));
}
})
@ -1574,16 +1563,6 @@ DEF_TRAVERSE_DECL(FriendTemplateDecl, {
}
})
DEF_TRAVERSE_DECL(ClassScopeFunctionSpecializationDecl, {
TRY_TO(TraverseDecl(D->getSpecialization()));
if (D->hasExplicitTemplateArgs()) {
TRY_TO(TraverseTemplateArgumentLocsHelper(
D->getTemplateArgsAsWritten()->getTemplateArgs(),
D->getTemplateArgsAsWritten()->NumTemplateArgs));
}
})
DEF_TRAVERSE_DECL(LinkageSpecDecl, {})
DEF_TRAVERSE_DECL(ExportDecl, {})
@ -2124,7 +2103,7 @@ DEF_TRAVERSE_DECL(FieldDecl, {
TRY_TO(TraverseDeclaratorHelper(D));
if (D->isBitField())
TRY_TO(TraverseStmt(D->getBitWidth()));
else if (D->hasInClassInitializer())
if (D->hasInClassInitializer())
TRY_TO(TraverseStmt(D->getInClassInitializer()));
})
@ -2165,6 +2144,13 @@ bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *D) {
TALI->NumTemplateArgs));
}
}
} else if (const DependentFunctionTemplateSpecializationInfo *DFSI =
D->getDependentSpecializationInfo()) {
if (const ASTTemplateArgumentListInfo *TALI =
DFSI->TemplateArgumentsAsWritten) {
TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
TALI->NumTemplateArgs));
}
}
// Visit the function type itself, which can be either
@ -2522,6 +2508,22 @@ bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
ConceptReference *CR) {
if (!getDerived().shouldTraversePostOrder())
TRY_TO(VisitConceptReference(CR));
TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
if (CR->hasExplicitTemplateArgs())
TRY_TO(TraverseTemplateArgumentLocsHelper(
CR->getTemplateArgsAsWritten()->getTemplateArgs(),
CR->getTemplateArgsAsWritten()->NumTemplateArgs));
if (getDerived().shouldTraversePostOrder())
TRY_TO(VisitConceptReference(CR));
return true;
}
// If shouldVisitImplicitCode() returns false, this method traverses only the
// syntactic form of InitListExpr.
// If shouldVisitImplicitCode() return true, this method is called once for
@ -2903,8 +2905,9 @@ DEF_TRAVERSE_STMT(CoyieldExpr, {
}
})
DEF_TRAVERSE_STMT(ConceptSpecializationExpr,
{ TRY_TO(TraverseConceptReferenceHelper(*S)); })
DEF_TRAVERSE_STMT(ConceptSpecializationExpr, {
TRY_TO(TraverseConceptReference(S->getConceptReference()));
})
DEF_TRAVERSE_STMT(RequiresExpr, {
TRY_TO(TraverseDecl(S->getBody()));
@ -2980,6 +2983,9 @@ DEF_TRAVERSE_STMT(OMPSectionsDirective,
DEF_TRAVERSE_STMT(OMPSectionDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPScopeDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPSingleDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
@ -3392,6 +3398,11 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
return true;
@ -3875,6 +3886,17 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
OMPXAttributeClause *C) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
return true;
}
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm

View file

@ -13,15 +13,20 @@
#ifndef LLVM_CLANG_AST_STMT_H
#define LLVM_CLANG_AST_STMT_H
#include "clang/AST/APValue.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/DependenceFlags.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/StmtIterator.h"
#include "clang/Basic/CapturedStmt.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/Lambda.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TypeTraits.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
@ -62,6 +67,13 @@ class SourceManager;
class StringLiteral;
class Token;
class VarDecl;
enum class CharacterLiteralKind;
enum class ConstantResultStorageKind;
enum class CXXConstructionKind;
enum class CXXNewInitializationStyle;
enum class PredefinedIdentKind;
enum class SourceLocIdentKind;
enum class StringLiteralKind;
//===----------------------------------------------------------------------===//
// AST classes for statements.
@ -103,6 +115,7 @@ protected:
friend class Stmt;
/// The statement class.
LLVM_PREFERRED_TYPE(StmtClass)
unsigned sClass : 8;
};
enum { NumStmtBits = 8 };
@ -112,6 +125,7 @@ protected:
friend class ASTStmtWriter;
friend class NullStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// True if the null statement was preceded by an empty macro, e.g:
@ -119,6 +133,7 @@ protected:
/// #define CALL(x)
/// CALL(0);
/// @endcode
LLVM_PREFERRED_TYPE(bool)
unsigned HasLeadingEmptyMacro : 1;
/// The location of the semi-colon.
@ -129,10 +144,12 @@ protected:
friend class ASTStmtReader;
friend class CompoundStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// True if the compound statement has one or more pragmas that set some
/// floating-point features.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
unsigned NumStmts;
@ -141,6 +158,7 @@ protected:
class LabelStmtBitfields {
friend class LabelStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
SourceLocation IdentLoc;
@ -150,6 +168,7 @@ protected:
friend class ASTStmtReader;
friend class AttributedStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// Number of attributes.
@ -163,18 +182,23 @@ protected:
friend class ASTStmtReader;
friend class IfStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// Whether this is a constexpr if, or a consteval if, or neither.
LLVM_PREFERRED_TYPE(IfStatementKind)
unsigned Kind : 3;
/// True if this if statement has storage for an else statement.
LLVM_PREFERRED_TYPE(bool)
unsigned HasElse : 1;
/// True if this if statement has storage for a variable declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned HasVar : 1;
/// True if this if statement has storage for an init statement.
LLVM_PREFERRED_TYPE(bool)
unsigned HasInit : 1;
/// The location of the "if".
@ -184,17 +208,21 @@ protected:
class SwitchStmtBitfields {
friend class SwitchStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// True if the SwitchStmt has storage for an init statement.
LLVM_PREFERRED_TYPE(bool)
unsigned HasInit : 1;
/// True if the SwitchStmt has storage for a condition variable.
LLVM_PREFERRED_TYPE(bool)
unsigned HasVar : 1;
/// If the SwitchStmt is a switch on an enum value, records whether all
/// the enum values were covered by CaseStmts. The coverage information
/// value is meant to be a hint for possible clients.
LLVM_PREFERRED_TYPE(bool)
unsigned AllEnumCasesCovered : 1;
/// The location of the "switch".
@ -205,9 +233,11 @@ protected:
friend class ASTStmtReader;
friend class WhileStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// True if the WhileStmt has storage for a condition variable.
LLVM_PREFERRED_TYPE(bool)
unsigned HasVar : 1;
/// The location of the "while".
@ -217,6 +247,7 @@ protected:
class DoStmtBitfields {
friend class DoStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// The location of the "do".
@ -226,6 +257,7 @@ protected:
class ForStmtBitfields {
friend class ForStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// The location of the "for".
@ -236,6 +268,7 @@ protected:
friend class GotoStmt;
friend class IndirectGotoStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// The location of the "goto".
@ -245,6 +278,7 @@ protected:
class ContinueStmtBitfields {
friend class ContinueStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// The location of the "continue".
@ -254,6 +288,7 @@ protected:
class BreakStmtBitfields {
friend class BreakStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// The location of the "break".
@ -263,9 +298,11 @@ protected:
class ReturnStmtBitfields {
friend class ReturnStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// True if this ReturnStmt has storage for an NRVO candidate.
LLVM_PREFERRED_TYPE(bool)
unsigned HasNRVOCandidate : 1;
/// The location of the "return".
@ -276,10 +313,12 @@ protected:
friend class SwitchCase;
friend class CaseStmt;
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
/// Used by CaseStmt to store whether it is a case statement
/// of the form case LHS ... RHS (a GNU extension).
LLVM_PREFERRED_TYPE(bool)
unsigned CaseStmtIsGNURange : 1;
/// The location of the "case" or "default" keyword.
@ -312,11 +351,15 @@ protected:
friend class PseudoObjectExpr; // ctor
friend class ShuffleVectorExpr; // ctor
LLVM_PREFERRED_TYPE(StmtBitfields)
unsigned : NumStmtBits;
LLVM_PREFERRED_TYPE(ExprValueKind)
unsigned ValueKind : 2;
LLVM_PREFERRED_TYPE(ExprObjectKind)
unsigned ObjectKind : 3;
unsigned /*ExprDependence*/ Dependent : llvm::BitWidth<ExprDependence>;
LLVM_PREFERRED_TYPE(ExprDependence)
unsigned Dependent : llvm::BitWidth<ExprDependence>;
};
enum { NumExprBits = NumStmtBits + 5 + llvm::BitWidth<ExprDependence> };
@ -325,28 +368,35 @@ protected:
friend class ASTStmtWriter;
friend class ConstantExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The kind of result that is tail-allocated.
LLVM_PREFERRED_TYPE(ConstantResultStorageKind)
unsigned ResultKind : 2;
/// The kind of Result as defined by APValue::Kind.
/// The kind of Result as defined by APValue::ValueKind.
LLVM_PREFERRED_TYPE(APValue::ValueKind)
unsigned APValueKind : 4;
/// When ResultKind == RSK_Int64, true if the tail-allocated integer is
/// unsigned.
/// When ResultKind == ConstantResultStorageKind::Int64, true if the
/// tail-allocated integer is unsigned.
LLVM_PREFERRED_TYPE(bool)
unsigned IsUnsigned : 1;
/// When ResultKind == RSK_Int64. the BitWidth of the tail-allocated
/// integer. 7 bits because it is the minimal number of bits to represent a
/// value from 0 to 64 (the size of the tail-allocated integer).
/// When ResultKind == ConstantResultStorageKind::Int64. the BitWidth of the
/// tail-allocated integer. 7 bits because it is the minimal number of bits
/// to represent a value from 0 to 64 (the size of the tail-allocated
/// integer).
unsigned BitWidth : 7;
/// When ResultKind == RSK_APValue, true if the ASTContext will cleanup the
/// tail-allocated APValue.
/// When ResultKind == ConstantResultStorageKind::APValue, true if the
/// ASTContext will cleanup the tail-allocated APValue.
LLVM_PREFERRED_TYPE(bool)
unsigned HasCleanup : 1;
/// True if this ConstantExpr was created for immediate invocation.
LLVM_PREFERRED_TYPE(bool)
unsigned IsImmediateInvocation : 1;
};
@ -354,18 +404,20 @@ protected:
friend class ASTStmtReader;
friend class PredefinedExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The kind of this PredefinedExpr. One of the enumeration values
/// in PredefinedExpr::IdentKind.
LLVM_PREFERRED_TYPE(PredefinedIdentKind)
unsigned Kind : 4;
/// True if this PredefinedExpr has a trailing "StringLiteral *"
/// for the predefined identifier.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFunctionName : 1;
/// True if this PredefinedExpr should be treated as a StringLiteral (for
/// MSVC compatibility).
LLVM_PREFERRED_TYPE(bool)
unsigned IsTransparent : 1;
/// The location of this PredefinedExpr.
@ -376,14 +428,24 @@ protected:
friend class ASTStmtReader; // deserialization
friend class DeclRefExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned HasQualifier : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned HasTemplateKWAndArgsInfo : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned HasFoundDecl : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned HadMultipleCandidates : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned RefersToEnclosingVariableOrCapture : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
LLVM_PREFERRED_TYPE(NonOdrUseReason)
unsigned NonOdrUseReason : 2;
LLVM_PREFERRED_TYPE(bool)
unsigned IsImmediateEscalating : 1;
/// The location of the declaration name itself.
@ -394,12 +456,15 @@ protected:
class FloatingLiteralBitfields {
friend class FloatingLiteral;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
static_assert(
llvm::APFloat::S_MaxSemantics < 16,
"Too many Semantics enum values to fit in bitfield of size 4");
LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
unsigned Semantics : 4; // Provides semantics for APFloat construction
LLVM_PREFERRED_TYPE(bool)
unsigned IsExact : 1;
};
@ -407,10 +472,12 @@ protected:
friend class ASTStmtReader;
friend class StringLiteral;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The kind of this string literal.
/// One of the enumeration values of StringLiteral::StringKind.
LLVM_PREFERRED_TYPE(StringLiteralKind)
unsigned Kind : 3;
/// The width of a single character in bytes. Only values of 1, 2,
@ -418,6 +485,7 @@ protected:
/// the target + string kind to the appropriate CharByteWidth.
unsigned CharByteWidth : 3;
LLVM_PREFERRED_TYPE(bool)
unsigned IsPascal : 1;
/// The number of concatenated token this string is made of.
@ -428,22 +496,28 @@ protected:
class CharacterLiteralBitfields {
friend class CharacterLiteral;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(CharacterLiteralKind)
unsigned Kind : 3;
};
class UnaryOperatorBitfields {
friend class UnaryOperator;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(UnaryOperatorKind)
unsigned Opc : 5;
LLVM_PREFERRED_TYPE(bool)
unsigned CanOverflow : 1;
//
/// This is only meaningful for operations on floating point
/// types when additional values need to be in trailing storage.
/// It is 0 otherwise.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
SourceLocation Loc;
@ -452,9 +526,12 @@ protected:
class UnaryExprOrTypeTraitExprBitfields {
friend class UnaryExprOrTypeTraitExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(UnaryExprOrTypeTrait)
unsigned Kind : 3;
LLVM_PREFERRED_TYPE(bool)
unsigned IsType : 1; // true if operand is a type, false if an expression.
};
@ -462,6 +539,7 @@ protected:
friend class ArraySubscriptExpr;
friend class MatrixSubscriptExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
SourceLocation RBracketLoc;
@ -470,14 +548,17 @@ protected:
class CallExprBitfields {
friend class CallExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
unsigned NumPreArgs : 1;
/// True if the callee of the call expression was found using ADL.
LLVM_PREFERRED_TYPE(bool)
unsigned UsesADL : 1;
/// True if the call expression has some floating-point features.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
/// Padding used to align OffsetToTrailingObjects to a byte multiple.
@ -494,15 +575,18 @@ protected:
friend class ASTStmtReader;
friend class MemberExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// IsArrow - True if this is "X->F", false if this is "X.F".
LLVM_PREFERRED_TYPE(bool)
unsigned IsArrow : 1;
/// True if this member expression used a nested-name-specifier to
/// refer to the member, e.g., "x->Base::f", or found its member via
/// a using declaration. When true, a MemberExprNameQualifier
/// structure is allocated immediately after the MemberExpr.
LLVM_PREFERRED_TYPE(bool)
unsigned HasQualifierOrFoundDecl : 1;
/// True if this member expression specified a template keyword
@ -510,15 +594,18 @@ protected:
/// x->template f, x->template f<int>.
/// When true, an ASTTemplateKWAndArgsInfo structure and its
/// TemplateArguments (if any) are present.
LLVM_PREFERRED_TYPE(bool)
unsigned HasTemplateKWAndArgsInfo : 1;
/// True if this member expression refers to a method that
/// was resolved from an overloaded set having size greater than 1.
LLVM_PREFERRED_TYPE(bool)
unsigned HadMultipleCandidates : 1;
/// Value of type NonOdrUseReason indicating why this MemberExpr does
/// not constitute an odr-use of the named declaration. Meaningful only
/// when naming a static member.
LLVM_PREFERRED_TYPE(NonOdrUseReason)
unsigned NonOdrUseReason : 2;
/// This is the location of the -> or . in the expression.
@ -529,12 +616,16 @@ protected:
friend class CastExpr;
friend class ImplicitCastExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(CastKind)
unsigned Kind : 7;
LLVM_PREFERRED_TYPE(bool)
unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr.
/// True if the call expression has some floating-point features.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
/// The number of CXXBaseSpecifiers in the cast. 14 bits would be enough
@ -545,13 +636,16 @@ protected:
class BinaryOperatorBitfields {
friend class BinaryOperator;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(BinaryOperatorKind)
unsigned Opc : 6;
/// This is only meaningful for operations on floating point
/// types when additional values need to be in trailing storage.
/// It is 0 otherwise.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
SourceLocation OpLoc;
@ -560,10 +654,12 @@ protected:
class InitListExprBitfields {
friend class InitListExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether this initializer list originally had a GNU array-range
/// designator in it. This is a temporary marker used by CodeGen.
LLVM_PREFERRED_TYPE(bool)
unsigned HadArrayRangeDesignator : 1;
};
@ -571,6 +667,7 @@ protected:
friend class ASTStmtReader;
friend class ParenListExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The number of expressions in the paren list.
@ -581,6 +678,7 @@ protected:
friend class ASTStmtReader;
friend class GenericSelectionExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The location of the "_Generic".
@ -591,6 +689,7 @@ protected:
friend class ASTStmtReader; // deserialization
friend class PseudoObjectExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
unsigned NumSubExprs : 16;
@ -601,10 +700,12 @@ protected:
friend class ASTStmtReader;
friend class SourceLocExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The kind of source location builtin represented by the SourceLocExpr.
/// Ex. __builtin_LINE, __builtin_FUNCTION, etc.
LLVM_PREFERRED_TYPE(SourceLocIdentKind)
unsigned Kind : 3;
};
@ -612,6 +713,7 @@ protected:
friend class ASTStmtReader;
friend class StmtExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The number of levels of template parameters enclosing this statement
@ -626,10 +728,12 @@ protected:
friend class ASTStmtReader;
friend class CXXOperatorCallExpr;
LLVM_PREFERRED_TYPE(CallExprBitfields)
unsigned : NumCallExprBits;
/// The kind of this overloaded operator. One of the enumerator
/// value of OverloadedOperatorKind.
LLVM_PREFERRED_TYPE(OverloadedOperatorKind)
unsigned OperatorKind : 6;
};
@ -637,17 +741,21 @@ protected:
friend class ASTStmtReader;
friend class CXXRewrittenBinaryOperator;
LLVM_PREFERRED_TYPE(CallExprBitfields)
unsigned : NumCallExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned IsReversed : 1;
};
class CXXBoolLiteralExprBitfields {
friend class CXXBoolLiteralExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The value of the boolean literal.
LLVM_PREFERRED_TYPE(bool)
unsigned Value : 1;
/// The location of the boolean literal.
@ -657,6 +765,7 @@ protected:
class CXXNullPtrLiteralExprBitfields {
friend class CXXNullPtrLiteralExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The location of the null pointer literal.
@ -666,9 +775,11 @@ protected:
class CXXThisExprBitfields {
friend class CXXThisExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether this is an implicit "this".
LLVM_PREFERRED_TYPE(bool)
unsigned IsImplicit : 1;
/// The location of the "this".
@ -679,9 +790,11 @@ protected:
friend class ASTStmtReader;
friend class CXXThrowExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether the thrown variable (if any) is in scope.
LLVM_PREFERRED_TYPE(bool)
unsigned IsThrownVariableInScope : 1;
/// The location of the "throw".
@ -692,9 +805,11 @@ protected:
friend class ASTStmtReader;
friend class CXXDefaultArgExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether this CXXDefaultArgExpr rewrote its argument and stores a copy.
LLVM_PREFERRED_TYPE(bool)
unsigned HasRewrittenInit : 1;
/// The location where the default argument expression was used.
@ -705,10 +820,12 @@ protected:
friend class ASTStmtReader;
friend class CXXDefaultInitExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether this CXXDefaultInitExprBitfields rewrote its argument and stores
/// a copy.
LLVM_PREFERRED_TYPE(bool)
unsigned HasRewrittenInit : 1;
/// The location where the default initializer expression was used.
@ -719,6 +836,7 @@ protected:
friend class ASTStmtReader;
friend class CXXScalarValueInitExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
SourceLocation RParenLoc;
@ -729,28 +847,35 @@ protected:
friend class ASTStmtWriter;
friend class CXXNewExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Was the usage ::new, i.e. is the global new to be used?
LLVM_PREFERRED_TYPE(bool)
unsigned IsGlobalNew : 1;
/// Do we allocate an array? If so, the first trailing "Stmt *" is the
/// size expression.
LLVM_PREFERRED_TYPE(bool)
unsigned IsArray : 1;
/// Should the alignment be passed to the allocation function?
LLVM_PREFERRED_TYPE(bool)
unsigned ShouldPassAlignment : 1;
/// If this is an array allocation, does the usual deallocation
/// function for the allocated type want to know the allocated size?
LLVM_PREFERRED_TYPE(bool)
unsigned UsualArrayDeleteWantsSize : 1;
/// What kind of initializer do we have? Could be none, parens, or braces.
/// In storage, we distinguish between "none, and no initializer expr", and
/// "none, but an implicit initializer expr".
LLVM_PREFERRED_TYPE(CXXNewInitializationStyle)
unsigned StoredInitializationStyle : 2;
/// True if the allocated type was expressed as a parenthesized type-id.
LLVM_PREFERRED_TYPE(bool)
unsigned IsParenTypeId : 1;
/// The number of placement new arguments.
@ -761,21 +886,26 @@ protected:
friend class ASTStmtReader;
friend class CXXDeleteExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Is this a forced global delete, i.e. "::delete"?
LLVM_PREFERRED_TYPE(bool)
unsigned GlobalDelete : 1;
/// Is this the array form of delete, i.e. "delete[]"?
LLVM_PREFERRED_TYPE(bool)
unsigned ArrayForm : 1;
/// ArrayFormAsWritten can be different from ArrayForm if 'delete' is
/// applied to pointer-to-array type (ArrayFormAsWritten will be false
/// while ArrayForm will be true).
LLVM_PREFERRED_TYPE(bool)
unsigned ArrayFormAsWritten : 1;
/// Does the usual deallocation function for the element type require
/// a size_t argument?
LLVM_PREFERRED_TYPE(bool)
unsigned UsualArrayDeleteWantsSize : 1;
/// Location of the expression.
@ -787,13 +917,16 @@ protected:
friend class ASTStmtWriter;
friend class TypeTraitExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The kind of type trait, which is a value of a TypeTrait enumerator.
LLVM_PREFERRED_TYPE(TypeTrait)
unsigned Kind : 8;
/// If this expression is not value-dependent, this indicates whether
/// the trait evaluated true or false.
LLVM_PREFERRED_TYPE(bool)
unsigned Value : 1;
/// The number of arguments to this type trait. According to [implimits]
@ -807,10 +940,12 @@ protected:
friend class ASTStmtWriter;
friend class DependentScopeDeclRefExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether the name includes info for explicit template
/// keyword and arguments.
LLVM_PREFERRED_TYPE(bool)
unsigned HasTemplateKWAndArgsInfo : 1;
};
@ -818,14 +953,22 @@ protected:
friend class ASTStmtReader;
friend class CXXConstructExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned Elidable : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned HadMultipleCandidates : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned ListInitialization : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned StdInitListInitialization : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned ZeroInitialization : 1;
LLVM_PREFERRED_TYPE(CXXConstructionKind)
unsigned ConstructionKind : 3;
LLVM_PREFERRED_TYPE(bool)
unsigned IsImmediateEscalating : 1;
SourceLocation Loc;
@ -835,9 +978,11 @@ protected:
friend class ASTStmtReader; // deserialization
friend class ExprWithCleanups;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
// When false, it must not have side effects.
LLVM_PREFERRED_TYPE(bool)
unsigned CleanupsHaveSideEffects : 1;
unsigned NumObjects : 32 - 1 - NumExprBits;
@ -847,6 +992,7 @@ protected:
friend class ASTStmtReader;
friend class CXXUnresolvedConstructExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The number of arguments used to construct the type.
@ -857,18 +1003,22 @@ protected:
friend class ASTStmtReader;
friend class CXXDependentScopeMemberExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether this member expression used the '->' operator or
/// the '.' operator.
LLVM_PREFERRED_TYPE(bool)
unsigned IsArrow : 1;
/// Whether this member expression has info for explicit template
/// keyword and arguments.
LLVM_PREFERRED_TYPE(bool)
unsigned HasTemplateKWAndArgsInfo : 1;
/// See getFirstQualifierFoundInScope() and the comment listing
/// the trailing objects.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFirstQualifierFoundInScope : 1;
/// The location of the '->' or '.' operator.
@ -879,10 +1029,12 @@ protected:
friend class ASTStmtReader;
friend class OverloadExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// Whether the name includes info for explicit template
/// keyword and arguments.
LLVM_PREFERRED_TYPE(bool)
unsigned HasTemplateKWAndArgsInfo : 1;
/// Padding used by the derived classes to store various bits. If you
@ -899,14 +1051,17 @@ protected:
friend class ASTStmtReader;
friend class UnresolvedLookupExpr;
LLVM_PREFERRED_TYPE(OverloadExprBitfields)
unsigned : NumOverloadExprBits;
/// True if these lookup results should be extended by
/// argument-dependent lookup if this is the operand of a function call.
LLVM_PREFERRED_TYPE(bool)
unsigned RequiresADL : 1;
/// True if these lookup results are overloaded. This is pretty trivially
/// rederivable if we urgently need to kill this field.
LLVM_PREFERRED_TYPE(bool)
unsigned Overloaded : 1;
};
static_assert(sizeof(UnresolvedLookupExprBitfields) <= 4,
@ -917,13 +1072,16 @@ protected:
friend class ASTStmtReader;
friend class UnresolvedMemberExpr;
LLVM_PREFERRED_TYPE(OverloadExprBitfields)
unsigned : NumOverloadExprBits;
/// Whether this member expression used the '->' operator or
/// the '.' operator.
LLVM_PREFERRED_TYPE(bool)
unsigned IsArrow : 1;
/// Whether the lookup results contain an unresolved using declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned HasUnresolvedUsing : 1;
};
static_assert(sizeof(UnresolvedMemberExprBitfields) <= 4,
@ -934,8 +1092,10 @@ protected:
friend class ASTStmtReader;
friend class CXXNoexceptExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned Value : 1;
};
@ -943,6 +1103,7 @@ protected:
friend class ASTStmtReader;
friend class SubstNonTypeTemplateParmExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The location of the non-type template parameter reference.
@ -954,17 +1115,21 @@ protected:
friend class ASTStmtWriter;
friend class LambdaExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The default capture kind, which is a value of type
/// LambdaCaptureDefault.
LLVM_PREFERRED_TYPE(LambdaCaptureDefault)
unsigned CaptureDefault : 2;
/// Whether this lambda had an explicit parameter list vs. an
/// implicit (and empty) parameter list.
LLVM_PREFERRED_TYPE(bool)
unsigned ExplicitParams : 1;
/// Whether this lambda had the result type explicitly specified.
LLVM_PREFERRED_TYPE(bool)
unsigned ExplicitResultType : 1;
/// The number of captures.
@ -976,8 +1141,10 @@ protected:
friend class ASTStmtWriter;
friend class RequiresExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned IsSatisfied : 1;
SourceLocation RequiresKWLoc;
};
@ -987,8 +1154,10 @@ protected:
class CoawaitExprBitfields {
friend class CoawaitExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned IsImplicit : 1;
};
@ -997,8 +1166,10 @@ protected:
class ObjCIndirectCopyRestoreExprBitfields {
friend class ObjCIndirectCopyRestoreExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
LLVM_PREFERRED_TYPE(bool)
unsigned ShouldCopy : 1;
};
@ -1008,10 +1179,12 @@ protected:
friend class ASTStmtReader;
friend class OpaqueValueExpr;
LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;
/// The OVE is a unique semantic reference to its source expression if this
/// bit is set to true.
LLVM_PREFERRED_TYPE(bool)
unsigned IsUnique : 1;
SourceLocation Loc;

View file

@ -281,6 +281,15 @@ class OMPExecutableDirective : public Stmt {
return Data->getClauses();
}
/// Was this directive mapped from an another directive?
/// e.g. 1) omp loop bind(parallel) is mapped to OMPD_for
/// 2) omp loop bind(teams) is mapped to OMPD_distribute
/// 3) omp loop bind(thread) is mapped to OMPD_simd
/// It was necessary to note it down in the Directive because of
/// clang::TreeTransform::TransformOMPExecutableDirective() pass in
/// the frontend.
OpenMPDirectiveKind PrevMappedDirective = llvm::omp::OMPD_unknown;
protected:
/// Data, associated with the directive.
OMPChildren *Data = nullptr;
@ -345,6 +354,10 @@ protected:
return Inst;
}
void setMappedDirective(OpenMPDirectiveKind MappedDirective) {
PrevMappedDirective = MappedDirective;
}
public:
/// Iterates over expressions/statements used in the construct.
class used_clauses_child_iterator
@ -598,6 +611,8 @@ public:
"Expected directive with the associated statement.");
return Data->getRawStmt();
}
OpenMPDirectiveKind getMappedDirective() const { return PrevMappedDirective; }
};
/// This represents '#pragma omp parallel' directive.
@ -979,7 +994,7 @@ public:
unsigned getNumAssociatedLoops() const { return getLoopsNumber(); }
/// Return the number of loops generated by this loop transformation.
unsigned getNumGeneratedLoops() { return NumGeneratedLoops; }
unsigned getNumGeneratedLoops() const { return NumGeneratedLoops; }
/// Get the de-sugared statements after the loop transformation.
///
@ -1604,7 +1619,8 @@ public:
SourceLocation EndLoc, unsigned CollapsedNum,
ArrayRef<OMPClause *> Clauses,
Stmt *AssociatedStmt,
const HelperExprs &Exprs);
const HelperExprs &Exprs,
OpenMPDirectiveKind ParamPrevMappedDirective);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@ -1682,7 +1698,8 @@ public:
SourceLocation EndLoc, unsigned CollapsedNum,
ArrayRef<OMPClause *> Clauses,
Stmt *AssociatedStmt, const HelperExprs &Exprs,
Expr *TaskRedRef, bool HasCancel);
Expr *TaskRedRef, bool HasCancel,
OpenMPDirectiveKind ParamPrevMappedDirective);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@ -1914,6 +1931,57 @@ public:
}
};
/// This represents '#pragma omp scope' directive.
/// \code
/// #pragma omp scope private(a,b) nowait
/// \endcode
/// In this example directive '#pragma omp scope' has clauses 'private' with
/// the variables 'a' and 'b' and nowait.
///
class OMPScopeDirective final : public OMPExecutableDirective {
friend class ASTStmtReader;
friend class OMPExecutableDirective;
/// Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending location of the directive.
///
OMPScopeDirective(SourceLocation StartLoc, SourceLocation EndLoc)
: OMPExecutableDirective(OMPScopeDirectiveClass, llvm::omp::OMPD_scope,
StartLoc, EndLoc) {}
/// Build an empty directive.
///
explicit OMPScopeDirective()
: OMPExecutableDirective(OMPScopeDirectiveClass, llvm::omp::OMPD_scope,
SourceLocation(), SourceLocation()) {}
public:
/// Creates directive.
///
/// \param C AST context.
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending Location of the directive.
/// \param AssociatedStmt Statement, associated with the directive.
///
static OMPScopeDirective *Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation EndLoc,
ArrayRef<OMPClause *> Clauses,
Stmt *AssociatedStmt);
/// Creates an empty directive.
///
/// \param C AST context.
///
static OMPScopeDirective *CreateEmpty(const ASTContext &C,
unsigned NumClauses, EmptyShell);
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPScopeDirectiveClass;
}
};
/// This represents '#pragma omp single' directive.
///
/// \code
@ -4406,7 +4474,8 @@ public:
static OMPDistributeDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
Stmt *AssociatedStmt, const HelperExprs &Exprs);
Stmt *AssociatedStmt, const HelperExprs &Exprs,
OpenMPDirectiveKind ParamPrevMappedDirective);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.

View file

@ -103,18 +103,23 @@ private:
/// The kind of template argument we're storing.
struct DA {
LLVM_PREFERRED_TYPE(ArgKind)
unsigned Kind : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsDefaulted : 1;
void *QT;
ValueDecl *D;
};
struct I {
LLVM_PREFERRED_TYPE(ArgKind)
unsigned Kind : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsDefaulted : 1;
// We store a decomposed APSInt with the data allocated by ASTContext if
// BitWidth > 64. The memory may be shared between multiple
// TemplateArgument instances.
unsigned BitWidth : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsUnsigned : 1;
union {
/// Used to store the <= 64 bits integer value.
@ -126,19 +131,25 @@ private:
void *Type;
};
struct A {
LLVM_PREFERRED_TYPE(ArgKind)
unsigned Kind : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsDefaulted : 1;
unsigned NumArgs;
const TemplateArgument *Args;
};
struct TA {
LLVM_PREFERRED_TYPE(ArgKind)
unsigned Kind : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsDefaulted : 1;
unsigned NumExpansions;
void *Name;
};
struct TV {
LLVM_PREFERRED_TYPE(ArgKind)
unsigned Kind : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned IsDefaulted : 1;
uintptr_t V;
};

View file

@ -55,7 +55,7 @@ protected:
};
struct BitsTag {
/// A Kind.
LLVM_PREFERRED_TYPE(Kind)
unsigned Kind : 2;
// The template parameter index.

View file

@ -189,6 +189,8 @@ public:
void Visit(const GenericSelectionExpr::ConstAssociation &A);
void Visit(const ConceptReference *);
void Visit(const concepts::Requirement *R);
void Visit(const APValue &Value, QualType Ty);
@ -202,6 +204,9 @@ public:
void dumpName(const NamedDecl *ND);
void dumpAccessSpecifier(AccessSpecifier AS);
void dumpCleanupObject(const ExprWithCleanups::CleanupObject &C);
void dumpTemplateSpecializationKind(TemplateSpecializationKind TSK);
void dumpNestedNameSpecifier(const NestedNameSpecifier *NNS);
void dumpConceptReference(const ConceptReference *R);
void dumpDeclRef(const Decl *D, StringRef Label = {});
@ -246,6 +251,7 @@ public:
void VisitLabelStmt(const LabelStmt *Node);
void VisitGotoStmt(const GotoStmt *Node);
void VisitCaseStmt(const CaseStmt *Node);
void VisitReturnStmt(const ReturnStmt *Node);
void VisitCompoundStmt(const CompoundStmt *Node);
void VisitConstantExpr(const ConstantExpr *Node);
void VisitCallExpr(const CallExpr *Node);
@ -253,6 +259,7 @@ public:
void VisitCastExpr(const CastExpr *Node);
void VisitImplicitCastExpr(const ImplicitCastExpr *Node);
void VisitDeclRefExpr(const DeclRefExpr *Node);
void VisitDependentScopeDeclRefExpr(const DependentScopeDeclRefExpr *Node);
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *Node);
void VisitPredefinedExpr(const PredefinedExpr *Node);
void VisitCharacterLiteral(const CharacterLiteral *Node);

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_AST_TYPELOC_H
#define LLVM_CLANG_AST_TYPELOC_H
#include "clang/AST/ASTConcept.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateBase.h"
@ -242,7 +243,7 @@ private:
inline TypeSourceInfo::TypeSourceInfo(QualType ty, size_t DataSize) : Ty(ty) {
// Init data attached to the object. See getTypeLoc.
memset(this + 1, 0, DataSize);
memset(static_cast<void *>(this + 1), 0, DataSize);
}
/// Return the TypeLoc for a type source info.
@ -2104,17 +2105,10 @@ class DeducedTypeLoc
DeducedType> {};
struct AutoTypeLocInfo : TypeSpecLocInfo {
NestedNameSpecifierLoc NestedNameSpec;
SourceLocation TemplateKWLoc;
SourceLocation ConceptNameLoc;
NamedDecl *FoundDecl = nullptr;
SourceLocation LAngleLoc;
SourceLocation RAngleLoc;
// For decltype(auto).
SourceLocation RParenLoc;
// Followed by a TemplateArgumentLocInfo[]
ConceptReference *CR = nullptr;
};
class AutoTypeLoc
@ -2135,79 +2129,77 @@ public:
return getTypePtr()->isConstrained();
}
const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
return getLocalData()->NestedNameSpec;
}
void setConceptReference(ConceptReference *CR) { getLocalData()->CR = CR; }
void setNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) {
getLocalData()->NestedNameSpec = NNS;
ConceptReference *getConceptReference() const { return getLocalData()->CR; }
// FIXME: Several of the following functions can be removed. Instead the
// caller can directly work with the ConceptReference.
const NestedNameSpecifierLoc getNestedNameSpecifierLoc() const {
if (const auto *CR = getConceptReference())
return CR->getNestedNameSpecifierLoc();
return NestedNameSpecifierLoc();
}
SourceLocation getTemplateKWLoc() const {
return getLocalData()->TemplateKWLoc;
}
void setTemplateKWLoc(SourceLocation Loc) {
getLocalData()->TemplateKWLoc = Loc;
if (const auto *CR = getConceptReference())
return CR->getTemplateKWLoc();
return SourceLocation();
}
SourceLocation getConceptNameLoc() const {
return getLocalData()->ConceptNameLoc;
}
void setConceptNameLoc(SourceLocation Loc) {
getLocalData()->ConceptNameLoc = Loc;
if (const auto *CR = getConceptReference())
return CR->getConceptNameLoc();
return SourceLocation();
}
NamedDecl *getFoundDecl() const {
return getLocalData()->FoundDecl;
}
void setFoundDecl(NamedDecl *D) {
getLocalData()->FoundDecl = D;
if (const auto *CR = getConceptReference())
return CR->getFoundDecl();
return nullptr;
}
ConceptDecl *getNamedConcept() const {
return getTypePtr()->getTypeConstraintConcept();
if (const auto *CR = getConceptReference())
return CR->getNamedConcept();
return nullptr;
}
DeclarationNameInfo getConceptNameInfo() const;
DeclarationNameInfo getConceptNameInfo() const {
return getConceptReference()->getConceptNameInfo();
}
bool hasExplicitTemplateArgs() const {
return getLocalData()->LAngleLoc.isValid();
return (getConceptReference() &&
getConceptReference()->getTemplateArgsAsWritten() &&
getConceptReference()
->getTemplateArgsAsWritten()
->getLAngleLoc()
.isValid());
}
SourceLocation getLAngleLoc() const {
return this->getLocalData()->LAngleLoc;
}
void setLAngleLoc(SourceLocation Loc) {
this->getLocalData()->LAngleLoc = Loc;
if (const auto *CR = getConceptReference())
if (const auto *TAAW = CR->getTemplateArgsAsWritten())
return TAAW->getLAngleLoc();
return SourceLocation();
}
SourceLocation getRAngleLoc() const {
return this->getLocalData()->RAngleLoc;
}
void setRAngleLoc(SourceLocation Loc) {
this->getLocalData()->RAngleLoc = Loc;
if (const auto *CR = getConceptReference())
if (const auto *TAAW = CR->getTemplateArgsAsWritten())
return TAAW->getRAngleLoc();
return SourceLocation();
}
unsigned getNumArgs() const {
return getTypePtr()->getTypeConstraintArguments().size();
}
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI) {
getArgInfos()[i] = AI;
}
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const {
return getArgInfos()[i];
}
TemplateArgumentLoc getArgLoc(unsigned i) const {
return TemplateArgumentLoc(getTypePtr()->getTypeConstraintArguments()[i],
getArgLocInfo(i));
const auto *CR = getConceptReference();
assert(CR && "No ConceptReference");
return CR->getTemplateArgsAsWritten()->getTemplateArgs()[i];
}
SourceRange getLocalSourceRange() const {
@ -2227,19 +2219,6 @@ public:
}
void initializeLocal(ASTContext &Context, SourceLocation Loc);
unsigned getExtraLocalDataSize() const {
return getNumArgs() * sizeof(TemplateArgumentLocInfo);
}
unsigned getExtraLocalDataAlignment() const {
return alignof(TemplateArgumentLocInfo);
}
private:
TemplateArgumentLocInfo *getArgInfos() const {
return static_cast<TemplateArgumentLocInfo*>(getExtraLocalData());
}
};
class DeducedTemplateSpecializationTypeLoc
@ -2315,7 +2294,7 @@ public:
QualType getInnerType() const { return getTypePtr()->getNamedType(); }
bool isEmpty() const {
return getTypePtr()->getKeyword() == ElaboratedTypeKeyword::ETK_None &&
return getTypePtr()->getKeyword() == ElaboratedTypeKeyword::None &&
!getTypePtr()->getQualifier();
}

View file

@ -323,6 +323,9 @@ let Class = FunctionProtoType in {
? node->getExtParameterInfos()
: llvm::ArrayRef<FunctionProtoType::ExtParameterInfo>() }];
}
def : Property<"AArch64SMEAttributes", UInt32> {
let Read = [{ node->getAArch64SMEAttributes() }];
}
def : Creator<[{
auto extInfo = FunctionType::ExtInfo(noReturn, hasRegParm, regParm,
@ -338,6 +341,7 @@ let Class = FunctionProtoType in {
epi.ExceptionSpec = exceptionSpecifier;
epi.ExtParameterInfos =
extParameterInfo.empty() ? nullptr : extParameterInfo.data();
epi.AArch64SMEAttributes = AArch64SMEAttributes;
return ctx.getFunctionType(returnType, parameters, epi);
}]>;
}

View file

@ -279,7 +279,7 @@ public:
AddressPointLocation getAddressPoint(BaseSubobject Base) const {
assert(AddressPoints.count(Base) && "Did not find address point!");
return AddressPoints.find(Base)->second;
return AddressPoints.lookup(Base);
}
const AddressPointsMapTy &getAddressPoints() const {

View file

@ -300,7 +300,7 @@ AST_POLYMORPHIC_MATCHER_REGEX(isExpansionInFileMatching,
return false;
}
auto FileEntry =
SourceManager.getFileEntryForID(SourceManager.getFileID(ExpansionLoc));
SourceManager.getFileEntryRefForID(SourceManager.getFileID(ExpansionLoc));
if (!FileEntry) {
return false;
}
@ -2519,6 +2519,10 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
chooseExpr;
/// Matches builtin function __builtin_convertvector.
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
convertVectorExpr;
/// Matches GNU __null expression.
extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
gnuNullExpr;
@ -3924,7 +3928,7 @@ AST_MATCHER_P(CallExpr, callee, internal::Matcher<Stmt>,
AST_POLYMORPHIC_MATCHER_P_OVERLOAD(
callee, AST_POLYMORPHIC_SUPPORTED_TYPES(ObjCMessageExpr, CallExpr),
internal::Matcher<Decl>, InnerMatcher, 1) {
if (const auto *CallNode = dyn_cast<CallExpr>(&Node))
if (isa<CallExpr>(&Node))
return callExpr(hasDeclaration(InnerMatcher))
.matches(Node, Finder, Builder);
else {
@ -6934,10 +6938,25 @@ AST_POLYMORPHIC_MATCHER_P(hasSize,
/// T data[Size];
/// };
/// \endcode
/// dependentSizedArrayType
/// dependentSizedArrayType()
/// matches "T data[Size]"
extern const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
/// Matches C++ extended vector type where either the type or size is
/// dependent.
///
/// Given
/// \code
/// template<typename T, int Size>
/// class vector {
/// typedef T __attribute__((ext_vector_type(Size))) type;
/// };
/// \endcode
/// dependentSizedExtVectorType()
/// matches "T __attribute__((ext_vector_type(Size)))"
extern const AstTypeMatcher<DependentSizedExtVectorType>
dependentSizedExtVectorType;
/// Matches C arrays with unspecified size.
///
/// Given
@ -7239,6 +7258,18 @@ AST_TYPELOC_TRAVERSE_MATCHER_DECL(
/// matches "typedef int X"
extern const AstTypeMatcher<TypedefType> typedefType;
/// Matches qualified types when the qualifier is applied via a macro.
///
/// Given
/// \code
/// #define CDECL __attribute__((cdecl))
/// typedef void (CDECL *X)();
/// typedef void (__attribute__((cdecl)) *Y)();
/// \endcode
/// macroQualifiedType()
/// matches the type of the typedef declaration of \c X but not \c Y.
extern const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
/// Matches enum types.
///
/// Given

View file

@ -202,7 +202,7 @@ struct ChildrenGetterTy<clang::CFGBlock, IsPostDom> {
auto Children = children<OrderedNodeTy>(N);
ChildrenTy Ret{Children.begin(), Children.end()};
llvm::erase_value(Ret, nullptr);
llvm::erase(Ret, nullptr);
return Ret;
}
};

View file

@ -6,9 +6,13 @@
//
//===----------------------------------------------------------------------===//
//
// This file defines functionality for partitioning a CFG into intervals. The
// concepts and implementations are based on the presentation in "Compilers" by
// Aho, Sethi and Ullman (the "dragon book"), pages 664-666.
// This file defines functionality for partitioning a CFG into intervals and
// building a weak topological order (WTO) of the nodes, based on the
// partitioning. The concepts and implementations for the graph partitioning
// are based on the presentation in "Compilers" by Aho, Sethi and Ullman (the
// "dragon book"), pages 664-666. The concepts around WTOs is taken from the
// paper "Efficient chaotic iteration strategies with widenings," by
// F. Bourdoncle ([Bourdoncle1993]).
//
//===----------------------------------------------------------------------===//
@ -17,34 +21,103 @@
#include "clang/Analysis/CFG.h"
#include "llvm/ADT/DenseSet.h"
#include <deque>
#include <memory>
#include <vector>
namespace clang {
/// A _weak topological ordering_ (WTO) of CFG nodes provides a total order over
/// the CFG (defined in `WTOCompare`, below), which can guide the order in which
/// to visit nodes in fixpoint computations over the CFG.
///
/// Roughly, a WTO a) groups the blocks so that loop heads are grouped with
/// their bodies and any nodes they dominate after the loop and b) orders the
/// groups topologically. As a result, the blocks in a series of loops are
/// ordered such that all nodes in loop `i` are earlier in the order than nodes
/// in loop `j`. This ordering, when combined with widening, bounds the number
/// of times a node must be visited for a dataflow algorithm to reach a
/// fixpoint. For the precise definition of a WTO and its properties, see
/// [Bourdoncle1993].
///
/// Here, we provide a simplified WTO which drops its nesting structure,
/// maintaining only the ordering itself. The ordering is built from the limit
/// flow graph of `Cfg` (derived from iteratively partitioning it into
/// intervals) if and only if it is reducible (its limit flow graph has one
/// node). Returns `nullopt` when `Cfg` is not reducible.
///
/// This WTO construction is described in Section 4.2 of [Bourdoncle1993].
using WeakTopologicalOrdering = std::vector<const CFGBlock *>;
std::optional<WeakTopologicalOrdering> getIntervalWTO(const CFG &Cfg);
// An interval is a strongly-connected component of the CFG along with a
// trailing acyclic structure. The _header_ of the interval is either the CFG
// entry block or has at least one predecessor outside of the interval. All
// other blocks in the interval have only predecessors also in the interval.
struct CFGInterval {
CFGInterval(const CFGBlock *Header) : Header(Header), Blocks({Header}) {}
struct WTOCompare {
WTOCompare(const WeakTopologicalOrdering &WTO);
// The block from which the interval was constructed. Is either the CFG entry
// block or has at least one predecessor outside the interval.
const CFGBlock *Header;
bool operator()(const CFGBlock *B1, const CFGBlock *B2) const {
auto ID1 = B1->getBlockID();
auto ID2 = B2->getBlockID();
llvm::SmallDenseSet<const CFGBlock *> Blocks;
unsigned V1 = ID1 >= BlockOrder.size() ? 0 : BlockOrder[ID1];
unsigned V2 = ID2 >= BlockOrder.size() ? 0 : BlockOrder[ID2];
return V1 > V2;
}
// Successor blocks of the *interval*: blocks outside the interval for
// reachable (in one edge) from within the interval.
llvm::SmallDenseSet<const CFGBlock *> Successors;
std::vector<unsigned> BlockOrder;
};
CFGInterval buildInterval(const CFG &Cfg, const CFGBlock &Header);
namespace internal {
// An interval is a strongly-connected component of the CFG along with a
// trailing acyclic structure. An interval can be constructed directly from CFG
// blocks or from a graph of other intervals. Each interval has one _header_
// block, from which the interval is built. The _header_ of the interval is
// either the graph's entry block or has at least one predecessor outside of the
// interval. All other blocks in the interval have only predecessors also in the
// interval.
struct CFGIntervalNode {
CFGIntervalNode() = default;
CFGIntervalNode(unsigned ID) : ID(ID) {}
// Partitions `Cfg` into intervals and constructs a graph of the intervals,
CFGIntervalNode(unsigned ID, std::vector<const CFGBlock *> Nodes)
: ID(ID), Nodes(std::move(Nodes)) {}
const llvm::SmallDenseSet<const CFGIntervalNode *> &preds() const {
return Predecessors;
}
const llvm::SmallDenseSet<const CFGIntervalNode *> &succs() const {
return Successors;
}
// Unique identifier of this interval relative to other intervals in the same
// graph.
unsigned ID;
std::vector<const CFGBlock *> Nodes;
// Predessor intervals of this interval: those intervals for which there
// exists an edge from a node in that other interval to the head of this
// interval.
llvm::SmallDenseSet<const CFGIntervalNode *> Predecessors;
// Successor intervals of this interval: those intervals for which there
// exists an edge from a node in this interval to the head of that other
// interval.
llvm::SmallDenseSet<const CFGIntervalNode *> Successors;
};
// Since graphs are built from pointers to nodes, we use a deque to ensure
// pointer stability.
using CFGIntervalGraph = std::deque<CFGIntervalNode>;
std::vector<const CFGBlock *> buildInterval(const CFGBlock *Header);
// Partitions `Cfg` into intervals and constructs the graph of the intervals
// based on the edges between nodes in these intervals.
std::vector<CFGInterval> partitionIntoIntervals(const CFG &Cfg);
CFGIntervalGraph partitionIntoIntervals(const CFG &Cfg);
// (Further) partitions `Graph` into intervals and constructs the graph of the
// intervals based on the edges between nodes (themselves intervals) in these
// intervals.
CFGIntervalGraph partitionIntoIntervals(const CFGIntervalGraph &Graph);
} // namespace internal
} // namespace clang
#endif // LLVM_CLANG_ANALYSIS_ANALYSES_INTERVALPARTITION_H

View file

@ -47,7 +47,13 @@ enum ProtectedOperationKind {
POK_PassByRef,
/// Passing a pt-guarded variable by reference.
POK_PtPassByRef
POK_PtPassByRef,
/// Returning a guarded variable by reference.
POK_ReturnByRef,
/// Returning a pt-guarded variable by reference.
POK_PtReturnByRef,
};
/// This enum distinguishes between different kinds of lock actions. For

View file

@ -361,7 +361,7 @@ public:
unsigned NumArgs = 0;
// Function arguments
const Expr *const *FunArgs = nullptr;
llvm::PointerUnion<const Expr *const *, til::SExpr *> FunArgs = nullptr;
// is Self referred to with -> or .?
bool SelfArrow = false;

View file

@ -16,14 +16,46 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Stmt.h"
#include "llvm/Support/Debug.h"
namespace clang {
using DefMapTy = llvm::DenseMap<const VarDecl *, std::vector<const VarDecl *>>;
using VarGrpTy = std::vector<const VarDecl *>;
using VarGrpRef = ArrayRef<const VarDecl *>;
class VariableGroupsManager {
public:
VariableGroupsManager() = default;
virtual ~VariableGroupsManager() = default;
/// Returns the set of variables (including `Var`) that need to be fixed
/// together in one step.
///
/// `Var` must be a variable that needs fix (so it must be in a group).
/// `HasParm` is an optional argument that will be set to true if the set of
/// variables, where `Var` is in, contains parameters.
virtual VarGrpRef getGroupOfVar(const VarDecl *Var,
bool *HasParm = nullptr) const =0;
/// Returns the non-empty group of variables that include parameters of the
/// analyzing function, if such a group exists. An empty group, otherwise.
virtual VarGrpRef getGroupOfParms() const =0;
};
/// The interface that lets the caller handle unsafe buffer usage analysis
/// results by overriding this class's handle... methods.
class UnsafeBufferUsageHandler {
#ifndef NDEBUG
public:
// A self-debugging facility that you can use to notify the user when
// suggestions or fixits are incomplete.
// Uses std::function to avoid computing the message when it won't
// actually be displayed.
using DebugNote = std::pair<SourceLocation, std::string>;
using DebugNoteList = std::vector<DebugNote>;
using DebugNoteByVar = std::map<const VarDecl *, DebugNoteList>;
DebugNoteByVar DebugNotesByVar;
#endif
public:
UnsafeBufferUsageHandler() = default;
virtual ~UnsafeBufferUsageHandler() = default;
@ -37,12 +69,35 @@ public:
bool IsRelatedToDecl) = 0;
/// Invoked when a fix is suggested against a variable. This function groups
/// all variables that must be fixed together (i.e their types must be changed to the
/// same target type to prevent type mismatches) into a single fixit.
/// all variables that must be fixed together (i.e their types must be changed
/// to the same target type to prevent type mismatches) into a single fixit.
///
/// `D` is the declaration of the callable under analysis that owns `Variable`
/// and all of its group mates.
virtual void handleUnsafeVariableGroup(const VarDecl *Variable,
const DefMapTy &VarGrpMap,
FixItList &&Fixes) = 0;
const VariableGroupsManager &VarGrpMgr,
FixItList &&Fixes, const Decl *D) = 0;
#ifndef NDEBUG
public:
bool areDebugNotesRequested() {
DEBUG_WITH_TYPE("SafeBuffers", return true);
return false;
}
void addDebugNoteForVar(const VarDecl *VD, SourceLocation Loc,
std::string Text) {
if (areDebugNotesRequested())
DebugNotesByVar[VD].push_back(std::make_pair(Loc, Text));
}
void clearDebugNotes() {
if (areDebugNotesRequested())
DebugNotesByVar.clear();
}
#endif
public:
/// Returns a reference to the `Preprocessor`:
virtual bool isSafeBufferOptOut(const SourceLocation &Loc) const = 0;

View file

@ -36,6 +36,7 @@ FIXABLE_GADGET(PointerDereference)
FIXABLE_GADGET(UPCAddressofArraySubscript) // '&DRE[any]' in an Unspecified Pointer Context
FIXABLE_GADGET(UPCStandalonePointer)
FIXABLE_GADGET(UPCPreIncrement) // '++Ptr' in an Unspecified Pointer Context
FIXABLE_GADGET(UUCAddAssign) // 'Ptr += n' in an Unspecified Untyped Context
FIXABLE_GADGET(PointerAssignment)
FIXABLE_GADGET(PointerInit)

View file

@ -14,10 +14,11 @@
#ifndef LLVM_CLANG_ANALYSIS_CFG_H
#define LLVM_CLANG_ANALYSIS_CFG_H
#include "clang/Analysis/Support/BumpVector.h"
#include "clang/Analysis/ConstructionContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Analysis/ConstructionContext.h"
#include "clang/Analysis/Support/BumpVector.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/GraphTraits.h"
@ -74,7 +75,8 @@ public:
MemberDtor,
TemporaryDtor,
DTOR_BEGIN = AutomaticObjectDtor,
DTOR_END = TemporaryDtor
DTOR_END = TemporaryDtor,
CleanupFunction,
};
protected:
@ -383,6 +385,32 @@ private:
}
};
class CFGCleanupFunction final : public CFGElement {
public:
CFGCleanupFunction() = default;
CFGCleanupFunction(const VarDecl *VD)
: CFGElement(Kind::CleanupFunction, VD) {
assert(VD->hasAttr<CleanupAttr>());
}
const VarDecl *getVarDecl() const {
return static_cast<VarDecl *>(Data1.getPointer());
}
/// Returns the function to be called when cleaning up the var decl.
const FunctionDecl *getFunctionDecl() const {
const CleanupAttr *A = getVarDecl()->getAttr<CleanupAttr>();
return A->getFunctionDecl();
}
private:
friend class CFGElement;
static bool isKind(const CFGElement E) {
return E.getKind() == Kind::CleanupFunction;
}
};
/// Represents C++ object destructor implicitly generated for automatic object
/// or temporary bound to const reference at the point of leaving its local
/// scope.
@ -1142,6 +1170,10 @@ public:
Elements.push_back(CFGAutomaticObjDtor(VD, S), C);
}
void appendCleanupFunction(const VarDecl *VD, BumpVectorContext &C) {
Elements.push_back(CFGCleanupFunction(VD), C);
}
void appendLifetimeEnds(VarDecl *VD, Stmt *S, BumpVectorContext &C) {
Elements.push_back(CFGLifetimeEnds(VD, S), C);
}
@ -1162,6 +1194,7 @@ public:
CFGCallback() = default;
virtual ~CFGCallback() = default;
virtual void logicAlwaysTrue(const BinaryOperator *B, bool isAlwaysTrue) {}
virtual void compareAlwaysTrue(const BinaryOperator *B, bool isAlwaysTrue) {}
virtual void compareBitwiseEquality(const BinaryOperator *B,
bool isAlwaysTrue) {}

View file

@ -26,6 +26,8 @@ class CFGStmtMap {
void *M;
CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
CFGStmtMap(const CFGStmtMap &) = delete;
CFGStmtMap &operator=(const CFGStmtMap &) = delete;
public:
~CFGStmtMap();

View file

@ -11,6 +11,7 @@
#include "clang/Analysis/FlowSensitive/Formula.h"
#include "clang/Analysis/FlowSensitive/StorageLocation.h"
#include "clang/Analysis/FlowSensitive/Value.h"
#include "llvm/ADT/StringRef.h"
#include <vector>
namespace clang::dataflow {
@ -19,15 +20,17 @@ namespace clang::dataflow {
/// For example, `Value`, `StorageLocation`, `Atom`, and `Formula`.
class Arena {
public:
Arena() : True(makeAtom()), False(makeAtom()) {}
Arena()
: True(Formula::create(Alloc, Formula::Literal, {}, 1)),
False(Formula::create(Alloc, Formula::Literal, {}, 0)) {}
Arena(const Arena &) = delete;
Arena &operator=(const Arena &) = delete;
/// Creates a `T` (some subclass of `StorageLocation`), forwarding `args` to
/// the constructor, and returns a reference to it.
///
/// The `DataflowAnalysisContext` takes ownership of the created object. The
/// object will be destroyed when the `DataflowAnalysisContext` is destroyed.
/// The `Arena` takes ownership of the created object. The object will be
/// destroyed when the `Arena` is destroyed.
template <typename T, typename... Args>
std::enable_if_t<std::is_base_of<StorageLocation, T>::value, T &>
create(Args &&...args) {
@ -42,8 +45,8 @@ public:
/// Creates a `T` (some subclass of `Value`), forwarding `args` to the
/// constructor, and returns a reference to it.
///
/// The `DataflowAnalysisContext` takes ownership of the created object. The
/// object will be destroyed when the `DataflowAnalysisContext` is destroyed.
/// The `Arena` takes ownership of the created object. The object will be
/// destroyed when the `Arena` is destroyed.
template <typename T, typename... Args>
std::enable_if_t<std::is_base_of<Value, T>::value, T &>
create(Args &&...args) {
@ -105,9 +108,11 @@ public:
const Formula &makeAtomRef(Atom A);
/// Returns a formula for a literal true/false.
const Formula &makeLiteral(bool Value) {
return makeAtomRef(Value ? True : False);
}
const Formula &makeLiteral(bool Value) { return Value ? True : False; }
// Parses a formula from its textual representation.
// This may refer to atoms that were not produced by makeAtom() yet!
llvm::Expected<const Formula &> parseFormula(llvm::StringRef);
/// Returns a new atomic boolean variable, distinct from any other.
Atom makeAtom() { return static_cast<Atom>(NextAtom++); };
@ -139,7 +144,7 @@ private:
llvm::DenseMap<const Formula *, BoolValue *> FormulaValues;
unsigned NextAtom = 0;
Atom True, False;
const Formula &True, &False;
};
} // namespace clang::dataflow

View file

@ -40,15 +40,9 @@ public:
static llvm::Expected<ControlFlowContext> build(const Decl &D, Stmt &S,
ASTContext &C);
/// Builds a ControlFlowContext from an AST node. `D` is the function in which
/// `S` resides. `D` must not be null and `D->isTemplated()` must be false.
LLVM_DEPRECATED("Use the version that takes a const Decl & instead", "")
static llvm::Expected<ControlFlowContext> build(const Decl *D, Stmt &S,
ASTContext &C);
/// Returns the `Decl` containing the statement used to construct the CFG, if
/// available.
const Decl *getDecl() const { return ContainingDecl; }
const Decl &getDecl() const { return ContainingDecl; }
/// Returns the CFG that is stored in this context.
const CFG &getCFG() const { return *Cfg; }
@ -64,9 +58,7 @@ public:
}
private:
// FIXME: Once the deprecated `build` method is removed, mark `D` as "must not
// be null" and add an assertion.
ControlFlowContext(const Decl *D, std::unique_ptr<CFG> Cfg,
ControlFlowContext(const Decl &D, std::unique_ptr<CFG> Cfg,
llvm::DenseMap<const Stmt *, const CFGBlock *> StmtToBlock,
llvm::BitVector BlockReachable)
: ContainingDecl(D), Cfg(std::move(Cfg)),
@ -74,7 +66,7 @@ private:
BlockReachable(std::move(BlockReachable)) {}
/// The `Decl` containing the statement used to construct the CFG.
const Decl *ContainingDecl;
const Decl &ContainingDecl;
std::unique_ptr<CFG> Cfg;
llvm::DenseMap<const Stmt *, const CFGBlock *> StmtToBlock;
llvm::BitVector BlockReachable;

View file

@ -25,9 +25,13 @@
#include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
#include "clang/Analysis/FlowSensitive/MatchSwitch.h"
#include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
#include "llvm/ADT/Any.h"
#include "clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
namespace clang {
@ -81,14 +85,6 @@ public:
explicit DataflowAnalysis(ASTContext &Context) : Context(Context) {}
/// Deprecated. Use the `DataflowAnalysisOptions` constructor instead.
explicit DataflowAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
: DataflowAnalysis(
Context,
{ApplyBuiltinTransfer
? DataflowAnalysisContext::Options{}
: std::optional<DataflowAnalysisContext::Options>()}) {}
explicit DataflowAnalysis(ASTContext &Context,
DataflowAnalysisOptions Options)
: TypeErasedDataflowAnalysis(Options), Context(Context) {}
@ -238,6 +234,76 @@ runDataflowAnalysis(
return std::move(BlockStates);
}
// Create an analysis class that is derived from `DataflowAnalysis`. This is an
// SFINAE adapter that allows us to call two different variants of constructor
// (either with or without the optional `Environment` parameter).
// FIXME: Make all classes derived from `DataflowAnalysis` take an `Environment`
// parameter in their constructor so that we can get rid of this abomination.
template <typename AnalysisT>
auto createAnalysis(ASTContext &ASTCtx, Environment &Env)
-> decltype(AnalysisT(ASTCtx, Env)) {
return AnalysisT(ASTCtx, Env);
}
template <typename AnalysisT>
auto createAnalysis(ASTContext &ASTCtx, Environment &Env)
-> decltype(AnalysisT(ASTCtx)) {
return AnalysisT(ASTCtx);
}
/// Runs a dataflow analysis over the given function and then runs `Diagnoser`
/// over the results. Returns a list of diagnostics for `FuncDecl` or an
/// error. Currently, errors can occur (at least) because the analysis requires
/// too many iterations over the CFG or the SAT solver times out.
///
/// The default value of `MaxSATIterations` was chosen based on the following
/// observations:
/// - Non-pathological calls to the solver typically require only a few hundred
/// iterations.
/// - This limit is still low enough to keep runtimes acceptable (on typical
/// machines) in cases where we hit the limit.
template <typename AnalysisT, typename Diagnostic>
llvm::Expected<llvm::SmallVector<Diagnostic>> diagnoseFunction(
const FunctionDecl &FuncDecl, ASTContext &ASTCtx,
llvm::function_ref<llvm::SmallVector<Diagnostic>(
const CFGElement &, ASTContext &,
const TransferStateForDiagnostics<typename AnalysisT::Lattice> &)>
Diagnoser,
std::int64_t MaxSATIterations = 1'000'000'000) {
llvm::Expected<ControlFlowContext> Context =
ControlFlowContext::build(FuncDecl);
if (!Context)
return Context.takeError();
auto OwnedSolver = std::make_unique<WatchedLiteralsSolver>(MaxSATIterations);
const WatchedLiteralsSolver *Solver = OwnedSolver.get();
DataflowAnalysisContext AnalysisContext(std::move(OwnedSolver));
Environment Env(AnalysisContext, FuncDecl);
AnalysisT Analysis = createAnalysis<AnalysisT>(ASTCtx, Env);
llvm::SmallVector<Diagnostic> Diagnostics;
if (llvm::Error Err =
runTypeErasedDataflowAnalysis(
*Context, Analysis, Env,
[&ASTCtx, &Diagnoser, &Diagnostics](
const CFGElement &Elt,
const TypeErasedDataflowAnalysisState &State) mutable {
auto EltDiagnostics = Diagnoser(
Elt, ASTCtx,
TransferStateForDiagnostics<typename AnalysisT::Lattice>(
llvm::any_cast<const typename AnalysisT::Lattice &>(
State.Lattice.Value),
State.Env));
llvm::move(EltDiagnostics, std::back_inserter(Diagnostics));
})
.takeError())
return std::move(Err);
if (Solver->reachedLimit())
return llvm::createStringError(llvm::errc::interrupted,
"SAT solver timed out");
return Diagnostics;
}
/// Abstract base class for dataflow "models": reusable analysis components that
/// model a particular aspect of program semantics in the `Environment`. For
/// example, a model may capture a type and its related functions.

View file

@ -58,6 +58,10 @@ using FieldSet = llvm::SmallSetVector<const FieldDecl *, 4>;
/// Returns the set of all fields in the type.
FieldSet getObjectFields(QualType Type);
/// Returns whether `Fields` and `FieldLocs` contain the same fields.
bool containsSameFields(const FieldSet &Fields,
const RecordStorageLocation::FieldToLoc &FieldLocs);
struct ContextSensitiveOptions {
/// The maximum depth to analyze. A value of zero is equivalent to disabling
/// context-sensitive analysis entirely.
@ -92,55 +96,59 @@ public:
/*Logger=*/nullptr});
~DataflowAnalysisContext();
/// Sets a callback that returns the names and types of the synthetic fields
/// to add to a `RecordStorageLocation` of a given type.
/// Typically, this is called from the constructor of a `DataflowAnalysis`
///
/// To maintain the invariant that all `RecordStorageLocation`s of a given
/// type have the same fields:
/// * The callback must always return the same result for a given type
/// * `setSyntheticFieldCallback()` must be called before any
// `RecordStorageLocation`s are created.
void setSyntheticFieldCallback(
std::function<llvm::StringMap<QualType>(QualType)> CB) {
assert(!RecordStorageLocationCreated);
SyntheticFieldCallback = CB;
}
/// Returns a new storage location appropriate for `Type`.
///
/// A null `Type` is interpreted as the pointee type of `std::nullptr_t`.
StorageLocation &createStorageLocation(QualType Type);
/// Creates a `RecordStorageLocation` for the given type and with the given
/// fields.
///
/// Requirements:
///
/// `FieldLocs` must contain exactly the fields returned by
/// `getModeledFields(Type)`.
/// `SyntheticFields` must contain exactly the fields returned by
/// `getSyntheticFields(Type)`.
RecordStorageLocation &createRecordStorageLocation(
QualType Type, RecordStorageLocation::FieldToLoc FieldLocs,
RecordStorageLocation::SyntheticFieldMap SyntheticFields);
/// Returns a stable storage location for `D`.
StorageLocation &getStableStorageLocation(const VarDecl &D);
StorageLocation &getStableStorageLocation(const ValueDecl &D);
/// Returns a stable storage location for `E`.
StorageLocation &getStableStorageLocation(const Expr &E);
/// Assigns `Loc` as the storage location of `D`.
///
/// Requirements:
///
/// `D` must not be assigned a storage location.
void setStorageLocation(const ValueDecl &D, StorageLocation &Loc) {
assert(!DeclToLoc.contains(&D));
DeclToLoc[&D] = &Loc;
}
/// Returns the storage location assigned to `D` or null if `D` has no
/// assigned storage location.
StorageLocation *getStorageLocation(const ValueDecl &D) const {
return DeclToLoc.lookup(&D);
}
/// Assigns `Loc` as the storage location of `E`.
///
/// Requirements:
///
/// `E` must not be assigned a storage location.
void setStorageLocation(const Expr &E, StorageLocation &Loc) {
const Expr &CanonE = ignoreCFGOmittedNodes(E);
assert(!ExprToLoc.contains(&CanonE));
ExprToLoc[&CanonE] = &Loc;
}
/// Returns the storage location assigned to `E` or null if `E` has no
/// assigned storage location.
StorageLocation *getStorageLocation(const Expr &E) const {
return ExprToLoc.lookup(&ignoreCFGOmittedNodes(E));
}
/// Returns a pointer value that represents a null pointer. Calls with
/// `PointeeType` that are canonically equivalent will return the same result.
/// A null `PointeeType` can be used for the pointee of `std::nullptr_t`.
PointerValue &getOrCreateNullPointerValue(QualType PointeeType);
/// Adds `Constraint` to current and future flow conditions in this context.
///
/// Invariants must contain only flow-insensitive information, i.e. facts that
/// are true on all paths through the program.
/// Information can be added eagerly (when analysis begins), or lazily (e.g.
/// when values are first used). The analysis must be careful that the same
/// information is added regardless of which order blocks are analyzed in.
void addInvariant(const Formula &Constraint);
/// Adds `Constraint` to the flow condition identified by `Token`.
void addFlowConditionConstraint(Atom Token, const Formula &Constraint);
@ -153,13 +161,17 @@ public:
/// token.
Atom joinFlowConditions(Atom FirstToken, Atom SecondToken);
/// Returns true if and only if the constraints of the flow condition
/// identified by `Token` imply that `Val` is true.
bool flowConditionImplies(Atom Token, const Formula &);
/// Returns true if the constraints of the flow condition identified by
/// `Token` imply that `F` is true.
/// Returns false if the flow condition does not imply `F` or if the solver
/// times out.
bool flowConditionImplies(Atom Token, const Formula &F);
/// Returns true if and only if the constraints of the flow condition
/// identified by `Token` are always true.
bool flowConditionIsTautology(Atom Token);
/// Returns true if the constraints of the flow condition identified by
/// `Token` still allow `F` to be true.
/// Returns false if the flow condition implies that `F` is false or if the
/// solver times out.
bool flowConditionAllows(Atom Token, const Formula &F);
/// Returns true if `Val1` is equivalent to `Val2`.
/// Note: This function doesn't take into account constraints on `Val1` and
@ -189,6 +201,15 @@ public:
/// context.
FieldSet getModeledFields(QualType Type);
/// Returns the names and types of the synthetic fields for the given record
/// type.
llvm::StringMap<QualType> getSyntheticFields(QualType Type) {
assert(Type->isRecordType());
if (SyntheticFieldCallback)
return SyntheticFieldCallback(Type);
return {};
}
private:
friend class Environment;
@ -207,12 +228,17 @@ private:
void addModeledFields(const FieldSet &Fields);
/// Adds all constraints of the flow condition identified by `Token` and all
/// of its transitive dependencies to `Constraints`. `VisitedTokens` is used
/// to track tokens of flow conditions that were already visited by recursive
/// calls.
void addTransitiveFlowConditionConstraints(
Atom Token, llvm::SetVector<const Formula *> &Constraints,
llvm::DenseSet<Atom> &VisitedTokens);
/// of its transitive dependencies to `Constraints`.
void
addTransitiveFlowConditionConstraints(Atom Token,
llvm::SetVector<const Formula *> &Out);
/// Returns true if the solver is able to prove that there is a satisfying
/// assignment for `Constraints`.
bool isSatisfiable(llvm::SetVector<const Formula *> Constraints) {
return querySolver(std::move(Constraints)).getStatus() ==
Solver::Result::Status::Satisfiable;
}
/// Returns true if the solver is able to prove that there is no satisfying
/// assignment for `Constraints`
@ -257,6 +283,7 @@ private:
// dependencies is stored in the `FlowConditionDeps` map.
llvm::DenseMap<Atom, llvm::DenseSet<Atom>> FlowConditionDeps;
llvm::DenseMap<Atom, const Formula *> FlowConditionConstraints;
const Formula *Invariant = nullptr;
llvm::DenseMap<const FunctionDecl *, ControlFlowContext> FunctionContexts;
@ -264,6 +291,11 @@ private:
FieldSet ModeledFields;
std::unique_ptr<Logger> LogOwner; // If created via flags.
std::function<llvm::StringMap<QualType>(QualType)> SyntheticFieldCallback;
/// Has any `RecordStorageLocation` been created yet?
bool RecordStorageLocationCreated = false;
};
} // namespace dataflow

View file

@ -38,18 +38,6 @@
namespace clang {
namespace dataflow {
/// Indicates what kind of indirections should be skipped past when retrieving
/// storage locations or values.
///
/// FIXME: Consider renaming this or replacing it with a more appropriate model.
/// See the discussion in https://reviews.llvm.org/D116596 for context.
enum class SkipPast {
/// No indirections should be skipped past.
None,
/// An optional reference should be skipped past.
Reference,
};
/// Indicates the result of a tentative comparison.
enum class ComparisonResult {
Same,
@ -88,7 +76,7 @@ public:
virtual ComparisonResult compare(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
const Environment &Env2) {
// FIXME: Consider adding QualType to StructValue and removing the Type
// FIXME: Consider adding QualType to RecordValue and removing the Type
// argument here.
return ComparisonResult::Unknown;
}
@ -178,6 +166,15 @@ public:
/// with a symbolic representation of the `this` pointee.
Environment(DataflowAnalysisContext &DACtx, const DeclContext &DeclCtx);
/// Assigns storage locations and values to all parameters, captures, global
/// variables, fields and functions referenced in the function currently being
/// analyzed.
///
/// Requirements:
///
/// The function must have a body.
void initialize();
/// Returns a new environment that is a copy of this one.
///
/// The state of the program is initially the same, but can be mutated without
@ -254,7 +251,7 @@ public:
/// Creates a storage location for `D`. Does not assign the returned storage
/// location to `D` in the environment. Does not assign a value to the
/// returned storage location in the environment.
StorageLocation &createStorageLocation(const VarDecl &D);
StorageLocation &createStorageLocation(const ValueDecl &D);
/// Creates a storage location for `E`. Does not assign the returned storage
/// location to `E` in the environment. Does not assign a value to the
@ -266,73 +263,44 @@ public:
/// Requirements:
///
/// `D` must not already have a storage location in the environment.
///
/// If `D` has reference type, `Loc` must refer directly to the referenced
/// object (if any), not to a `ReferenceValue`, and it is not permitted to
/// later change `Loc` to refer to a `ReferenceValue.`
void setStorageLocation(const ValueDecl &D, StorageLocation &Loc);
/// Returns the storage location assigned to `D` in the environment, or null
/// if `D` isn't assigned a storage location in the environment.
///
/// Note that if `D` has reference type, the storage location that is returned
/// refers directly to the referenced object, not a `ReferenceValue`.
StorageLocation *getStorageLocation(const ValueDecl &D) const;
/// Assigns `Loc` as the storage location of `E` in the environment.
///
/// This function is deprecated; prefer `setStorageLocationStrict()`.
/// For details, see https://discourse.llvm.org/t/70086.
///
/// Requirements:
///
/// `E` must not be assigned a storage location in the environment.
void setStorageLocation(const Expr &E, StorageLocation &Loc);
/// Removes the location assigned to `D` in the environment (if any).
void removeDecl(const ValueDecl &D);
/// Assigns `Loc` as the storage location of the glvalue `E` in the
/// environment.
///
/// This function is the preferred alternative to
/// `setStorageLocation(const Expr &, StorageLocation &)`. Once the migration
/// to strict handling of value categories is complete (see
/// https://discourse.llvm.org/t/70086), `setStorageLocation()` will be
/// removed and this function will be renamed to `setStorageLocation()`.
///
/// Requirements:
///
/// `E` must not be assigned a storage location in the environment.
/// `E` must be a glvalue or a `BuiltinType::BuiltinFn`
void setStorageLocationStrict(const Expr &E, StorageLocation &Loc);
/// Returns the storage location assigned to `E` in the environment, applying
/// the `SP` policy for skipping past indirections, or null if `E` isn't
/// assigned a storage location in the environment.
///
/// This function is deprecated; prefer `getStorageLocationStrict()`.
/// For details, see https://discourse.llvm.org/t/70086.
StorageLocation *getStorageLocation(const Expr &E, SkipPast SP) const;
void setStorageLocation(const Expr &E, StorageLocation &Loc);
/// Returns the storage location assigned to the glvalue `E` in the
/// environment, or null if `E` isn't assigned a storage location in the
/// environment.
///
/// If the storage location for `E` is associated with a
/// `ReferenceValue RefVal`, returns `RefVal.getReferentLoc()` instead.
///
/// This function is the preferred alternative to
/// `getStorageLocation(const Expr &, SkipPast)`. Once the migration
/// to strict handling of value categories is complete (see
/// https://discourse.llvm.org/t/70086), `getStorageLocation()` will be
/// removed and this function will be renamed to `getStorageLocation()`.
///
/// Requirements:
/// `E` must be a glvalue or a `BuiltinType::BuiltinFn`
StorageLocation *getStorageLocationStrict(const Expr &E) const;
StorageLocation *getStorageLocation(const Expr &E) const;
/// Returns the storage location assigned to the `this` pointee in the
/// environment or null if the `this` pointee has no assigned storage location
/// in the environment.
AggregateStorageLocation *getThisPointeeStorageLocation() const;
RecordStorageLocation *getThisPointeeStorageLocation() const {
return ThisPointeeLoc;
}
/// Sets the storage location assigned to the `this` pointee in the
/// environment.
void setThisPointeeStorageLocation(RecordStorageLocation &Loc) {
ThisPointeeLoc = &Loc;
}
/// Returns the location of the result object for a record-type prvalue.
///
@ -357,7 +325,7 @@ public:
///
/// Requirements:
/// `E` must be a prvalue of record type.
AggregateStorageLocation &getResultObjectLocation(const Expr &RecordPRValue);
RecordStorageLocation &getResultObjectLocation(const Expr &RecordPRValue);
/// Returns the return value of the current function. This can be null if:
/// - The function has a void return type
@ -416,9 +384,10 @@ public:
/// storage locations and values for indirections until it finds a
/// non-pointer/non-reference type.
///
/// If `Type` is a class, struct, or union type, calls `setValue()` to
/// associate the `StructValue` with its storage location
/// (`StructValue::getAggregateLoc()`).
/// If `Type` is a class, struct, or union type, creates values for all
/// modeled fields (including synthetic fields) and calls `setValue()` to
/// associate the `RecordValue` with its storage location
/// (`RecordValue::getLoc()`).
///
/// If `Type` is one of the following types, this function will always return
/// a non-null pointer:
@ -453,7 +422,7 @@ public:
/// this value. Otherwise, initializes the object with a value created using
/// `createValue()`. Uses the storage location returned by
/// `DataflowAnalysisContext::getStableStorageLocation(D)`.
StorageLocation &createObject(const VarDecl &D, const Expr *InitExpr) {
StorageLocation &createObject(const ValueDecl &D, const Expr *InitExpr) {
return createObjectInternal(&D, D.getType(), InitExpr);
}
@ -479,41 +448,23 @@ public:
/// Requirements:
///
/// `E` must be a prvalue
/// `Val` must not be a `ReferenceValue`
/// If `Val` is a `StructValue`, its `AggregateStorageLocation` must be the
/// same as that of any `StructValue` that has already been associated with
/// If `Val` is a `RecordValue`, its `RecordStorageLocation` must be the
/// same as that of any `RecordValue` that has already been associated with
/// `E`. This is to guarantee that the result object initialized by a prvalue
/// `StructValue` has a durable storage location.
void setValueStrict(const Expr &E, Value &Val);
/// `RecordValue` has a durable storage location.
void setValue(const Expr &E, Value &Val);
/// Returns the value assigned to `Loc` in the environment or null if `Loc`
/// isn't assigned a value in the environment.
Value *getValue(const StorageLocation &Loc) const;
/// Equivalent to `getValue(getStorageLocation(D, SP), SkipPast::None)` if `D`
/// is assigned a storage location in the environment, otherwise returns null.
/// Equivalent to `getValue(getStorageLocation(D))` if `D` is assigned a
/// storage location in the environment, otherwise returns null.
Value *getValue(const ValueDecl &D) const;
/// Equivalent to `getValue(getStorageLocation(E, SP), SkipPast::None)` if `E`
/// is assigned a storage location in the environment, otherwise returns null.
///
/// This function is deprecated; prefer `getValueStrict()`. For details, see
/// https://discourse.llvm.org/t/70086.
Value *getValue(const Expr &E, SkipPast SP) const;
/// Returns the `Value` assigned to the prvalue `E` in the environment, or
/// null if `E` isn't assigned a value in the environment.
///
/// This function is the preferred alternative to
/// `getValue(const Expr &, SkipPast)`. Once the migration to strict handling
/// of value categories is complete (see https://discourse.llvm.org/t/70086),
/// `getValue()` will be removed and this function will be renamed to
/// `getValue()`.
///
/// Requirements:
///
/// `E` must be a prvalue
Value *getValueStrict(const Expr &E) const;
/// Equivalent to `getValue(getStorageLocation(E, SP))` if `E` is assigned a
/// storage location in the environment, otherwise returns null.
Value *getValue(const Expr &E) const;
// FIXME: should we deprecate the following & call arena().create() directly?
@ -536,9 +487,8 @@ public:
/// Returns a symbolic boolean value that models a boolean literal equal to
/// `Value`
AtomicBoolValue &getBoolLiteralValue(bool Value) const {
return cast<AtomicBoolValue>(
arena().makeBoolValue(arena().makeLiteral(Value)));
BoolValue &getBoolLiteralValue(bool Value) const {
return arena().makeBoolValue(arena().makeLiteral(Value));
}
/// Returns an atomic boolean value.
@ -610,12 +560,23 @@ public:
Atom getFlowConditionToken() const { return FlowConditionToken; }
/// Record a fact that must be true if this point in the program is reached.
void addToFlowCondition(const Formula &);
void assume(const Formula &);
/// Returns true if the formula is always true when this point is reached.
/// Returns false if the formula may be false, or if the flow condition isn't
/// sufficiently precise to prove that it is true.
bool flowConditionImplies(const Formula &) const;
/// Returns false if the formula may be false (or the flow condition isn't
/// sufficiently precise to prove that it is true) or if the solver times out.
///
/// Note that there is an asymmetry between this function and `allows()` in
/// that they both return false if the solver times out. The assumption is
/// that if `proves()` or `allows()` returns true, this will result in a
/// diagnostic, and we want to bias towards false negatives in the case where
/// the solver times out.
bool proves(const Formula &) const;
/// Returns true if the formula may be true when this point is reached.
/// Returns false if the formula is always false when this point is reached
/// (or the flow condition is overly constraining) or if the solver times out.
bool allows(const Formula &) const;
/// Returns the `DeclContext` of the block being analysed, if any. Otherwise,
/// returns null.
@ -627,6 +588,9 @@ public:
return dyn_cast<FunctionDecl>(getDeclCtx());
}
/// Returns the size of the call stack.
size_t callStackSize() const { return CallStack.size(); }
/// Returns whether this `Environment` can be extended to analyze the given
/// `Callee` (i.e. if `pushCall` can be used), with recursion disallowed and a
/// given `MaxDepth`.
@ -644,6 +608,14 @@ private:
// The copy-constructor is for use in fork() only.
Environment(const Environment &) = default;
/// Internal version of `setStorageLocation()` that doesn't check if the
/// expression is a prvalue.
void setStorageLocationInternal(const Expr &E, StorageLocation &Loc);
/// Internal version of `getStorageLocation()` that doesn't check if the
/// expression is a prvalue.
StorageLocation *getStorageLocationInternal(const Expr &E) const;
/// Creates a value appropriate for `Type`, if `Type` is supported, otherwise
/// return null.
///
@ -669,12 +641,9 @@ private:
/// Shared implementation of `createObject()` overloads.
/// `D` and `InitExpr` may be null.
StorageLocation &createObjectInternal(const VarDecl *D, QualType Ty,
StorageLocation &createObjectInternal(const ValueDecl *D, QualType Ty,
const Expr *InitExpr);
StorageLocation &skip(StorageLocation &Loc, SkipPast SP) const;
const StorageLocation &skip(const StorageLocation &Loc, SkipPast SP) const;
/// Shared implementation of `pushCall` overloads. Note that unlike
/// `pushCall`, this member is invoked on the environment of the callee, not
/// of the caller.
@ -703,16 +672,19 @@ private:
StorageLocation *ReturnLoc = nullptr;
// The storage location of the `this` pointee. Should only be null if the
// function being analyzed is only a function and not a method.
AggregateStorageLocation *ThisPointeeLoc = nullptr;
RecordStorageLocation *ThisPointeeLoc = nullptr;
// Maps from program declarations and statements to storage locations that are
// Maps from declarations and glvalue expression to storage locations that are
// assigned to them. Unlike the maps in `DataflowAnalysisContext`, these
// include only storage locations that are in scope for a particular basic
// block.
llvm::DenseMap<const ValueDecl *, StorageLocation *> DeclToLoc;
llvm::DenseMap<const Expr *, StorageLocation *> ExprToLoc;
// Maps from prvalue expressions and storage locations to the values that
// are assigned to them.
// We preserve insertion order so that join/widen process values in
// deterministic sequence. This in turn produces deterministic SAT formulas.
llvm::MapVector<const Expr *, Value *> ExprToVal;
llvm::MapVector<const StorageLocation *, Value *> LocToVal;
Atom FlowConditionToken;
@ -722,36 +694,35 @@ private:
/// `CXXMemberCallExpr`, or null if none is defined in the environment.
/// Dereferences the pointer if the member call expression was written using
/// `->`.
AggregateStorageLocation *
getImplicitObjectLocation(const CXXMemberCallExpr &MCE, const Environment &Env);
RecordStorageLocation *getImplicitObjectLocation(const CXXMemberCallExpr &MCE,
const Environment &Env);
/// Returns the storage location for the base object of a `MemberExpr`, or null
/// if none is defined in the environment. Dereferences the pointer if the
/// member expression was written using `->`.
AggregateStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
const Environment &Env);
RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
const Environment &Env);
/// Returns the fields of `RD` that are initialized by an `InitListExpr`, in the
/// order in which they appear in `InitListExpr::inits()`.
std::vector<FieldDecl *> getFieldsForInitListExpr(const RecordDecl *RD);
/// Associates a new `StructValue` with `Loc` and returns the new value.
/// Associates a new `RecordValue` with `Loc` and returns the new value.
/// It is not defined whether the field values remain the same or not.
///
/// This function is primarily intended for use by checks that set custom
/// properties on `StructValue`s to model the state of these values. Such checks
/// should avoid modifying the properties of an existing `StructValue` because
/// properties on `RecordValue`s to model the state of these values. Such checks
/// should avoid modifying the properties of an existing `RecordValue` because
/// these changes would be visible to other `Environment`s that share the same
/// `StructValue`. Instead, call `refreshStructValue()`, then set the properties
/// on the new `StructValue` that it returns. Typical usage:
/// `RecordValue`. Instead, call `refreshRecordValue()`, then set the properties
/// on the new `RecordValue` that it returns. Typical usage:
///
/// refreshStructValue(Loc, Env).setProperty("my_prop", MyPropValue);
StructValue &refreshStructValue(AggregateStorageLocation &Loc,
Environment &Env);
/// refreshRecordValue(Loc, Env).setProperty("my_prop", MyPropValue);
RecordValue &refreshRecordValue(RecordStorageLocation &Loc, Environment &Env);
/// Associates a new `StructValue` with `Expr` and returns the new value.
/// Associates a new `RecordValue` with `Expr` and returns the new value.
/// See also documentation for the overload above.
StructValue &refreshStructValue(const Expr &Expr, Environment &Env);
RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env);
} // namespace dataflow
} // namespace clang

View file

@ -12,6 +12,7 @@
#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
#include "clang/Analysis/Analyses/IntervalPartition.h"
#include "clang/Analysis/Analyses/PostOrderCFGView.h"
#include "clang/Analysis/CFG.h"
#include "llvm/ADT/PriorityQueue.h"
@ -21,16 +22,13 @@ namespace clang {
/// on the order defined by 'Comp'.
template <typename Comp, unsigned QueueSize> class DataflowWorklistBase {
llvm::BitVector EnqueuedBlocks;
PostOrderCFGView *POV;
llvm::PriorityQueue<const CFGBlock *,
SmallVector<const CFGBlock *, QueueSize>, Comp>
WorkList;
public:
DataflowWorklistBase(const CFG &Cfg, PostOrderCFGView *POV, Comp C)
: EnqueuedBlocks(Cfg.getNumBlockIDs()), POV(POV), WorkList(C) {}
const PostOrderCFGView *getCFGView() const { return POV; }
DataflowWorklistBase(const CFG &Cfg, Comp C)
: EnqueuedBlocks(Cfg.getNumBlockIDs()), WorkList(C) {}
void enqueueBlock(const CFGBlock *Block) {
if (Block && !EnqueuedBlocks[Block->getBlockID()]) {
@ -62,7 +60,7 @@ struct ReversePostOrderCompare {
struct ForwardDataflowWorklist
: DataflowWorklistBase<ReversePostOrderCompare, 20> {
ForwardDataflowWorklist(const CFG &Cfg, PostOrderCFGView *POV)
: DataflowWorklistBase(Cfg, POV,
: DataflowWorklistBase(Cfg,
ReversePostOrderCompare{POV->getComparator()}) {}
ForwardDataflowWorklist(const CFG &Cfg, AnalysisDeclContext &Ctx)
@ -74,6 +72,19 @@ struct ForwardDataflowWorklist
}
};
/// A worklist implementation for forward dataflow analysis based on a weak
/// topological ordering of the nodes. The worklist cannot contain the same
/// block multiple times at once.
struct WTODataflowWorklist : DataflowWorklistBase<WTOCompare, 20> {
WTODataflowWorklist(const CFG &Cfg, const WTOCompare &Cmp)
: DataflowWorklistBase(Cfg, Cmp) {}
void enqueueSuccessors(const CFGBlock *Block) {
for (auto B : Block->succs())
enqueueBlock(B);
}
};
/// A worklist implementation for backward dataflow analysis. The enqueued
/// block will be dequeued in post order. The worklist cannot contain the same
/// block multiple times at once.
@ -81,8 +92,7 @@ struct BackwardDataflowWorklist
: DataflowWorklistBase<PostOrderCFGView::BlockOrderCompare, 20> {
BackwardDataflowWorklist(const CFG &Cfg, AnalysisDeclContext &Ctx)
: DataflowWorklistBase(
Cfg, Ctx.getAnalysis<PostOrderCFGView>(),
Ctx.getAnalysis<PostOrderCFGView>()->getComparator()) {}
Cfg, Ctx.getAnalysis<PostOrderCFGView>()->getComparator()) {}
void enqueuePredecessors(const CFGBlock *Block) {
for (auto B : Block->preds())

View file

@ -13,12 +13,10 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <string>
#include <type_traits>
namespace clang::dataflow {
@ -54,7 +52,8 @@ public:
/// A reference to an atomic boolean variable.
/// We name these e.g. "V3", where 3 == atom identity == Value.
AtomRef,
// FIXME: add const true/false rather than modeling them as variables
/// Constant true or false.
Literal,
Not, /// True if its only operand is false
@ -71,6 +70,11 @@ public:
return static_cast<Atom>(Value);
}
bool literal() const {
assert(kind() == Literal);
return static_cast<bool>(Value);
}
ArrayRef<const Formula *> operands() const {
return ArrayRef(reinterpret_cast<Formula *const *>(this + 1),
numOperands(kind()));
@ -83,9 +87,9 @@ public:
void print(llvm::raw_ostream &OS, const AtomNames * = nullptr) const;
// Allocate Formulas using Arena rather than calling this function directly.
static Formula &create(llvm::BumpPtrAllocator &Alloc, Kind K,
ArrayRef<const Formula *> Operands,
unsigned Value = 0);
static const Formula &create(llvm::BumpPtrAllocator &Alloc, Kind K,
ArrayRef<const Formula *> Operands,
unsigned Value = 0);
private:
Formula() = default;
@ -95,6 +99,7 @@ private:
static unsigned numOperands(Kind K) {
switch (K) {
case AtomRef:
case Literal:
return 0;
case Not:
return 1;

View file

@ -50,7 +50,9 @@ public:
/// Called when we start (re-)processing a block in the CFG.
/// The target program point is the entry to the specified block.
/// Calls to log() describe transferBranch(), join() etc.
virtual void enterBlock(const CFGBlock &) {}
/// `PostVisit` specifies whether we're processing the block for the
/// post-visit callback.
virtual void enterBlock(const CFGBlock &, bool PostVisit) {}
/// Called when we start processing an element in the current CFG block.
/// The target program point is after the specified element.
/// Calls to log() describe the transfer() function.

View file

@ -48,6 +48,10 @@ template <typename LatticeT> struct TransferState {
};
/// A read-only version of TransferState.
///
/// FIXME: this type is being used as a general (typed) view type for untyped
/// dataflow analysis state, rather than strictly for transfer-function
/// purposes. Move it (and rename it) to DataflowAnalysis.h.
template <typename LatticeT> struct TransferStateForDiagnostics {
TransferStateForDiagnostics(const LatticeT &Lattice, const Environment &Env)
: Lattice(Lattice), Env(Env) {}

View file

@ -21,7 +21,7 @@
#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
#include "clang/Analysis/FlowSensitive/NoopLattice.h"
#include "clang/Basic/SourceLocation.h"
#include <vector>
#include "llvm/ADT/SmallVector.h"
namespace clang {
namespace dataflow {
@ -45,7 +45,7 @@ struct UncheckedOptionalAccessModelOptions {
class UncheckedOptionalAccessModel
: public DataflowAnalysis<UncheckedOptionalAccessModel, NoopLattice> {
public:
UncheckedOptionalAccessModel(ASTContext &Ctx);
UncheckedOptionalAccessModel(ASTContext &Ctx, dataflow::Environment &Env);
/// Returns a matcher for the optional classes covered by this model.
static ast_matchers::DeclarationMatcher optionalClassDecl();
@ -54,17 +54,6 @@ public:
void transfer(const CFGElement &Elt, NoopLattice &L, Environment &Env);
ComparisonResult compare(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
const Environment &Env2) override;
bool merge(QualType Type, const Value &Val1, const Environment &Env1,
const Value &Val2, const Environment &Env2, Value &MergedVal,
Environment &MergedEnv) override;
Value *widen(QualType Type, Value &Prev, const Environment &PrevEnv,
Value &Current, Environment &CurrentEnv) override;
private:
CFGMatchSwitch<TransferState<NoopLattice>> TransferMatchSwitch;
};
@ -74,11 +63,14 @@ public:
UncheckedOptionalAccessDiagnoser(
UncheckedOptionalAccessModelOptions Options = {});
std::vector<SourceLocation> diagnose(ASTContext &Ctx, const CFGElement *Elt,
const Environment &Env);
llvm::SmallVector<SourceLocation>
operator()(const CFGElement &Elt, ASTContext &Ctx,
const TransferStateForDiagnostics<NoopLattice> &State) {
return DiagnoseMatchSwitch(Elt, Ctx, State.Env);
}
private:
CFGMatchSwitch<const Environment, std::vector<SourceLocation>>
CFGMatchSwitch<const Environment, llvm::SmallVector<SourceLocation>>
DiagnoseMatchSwitch;
};

View file

@ -24,15 +24,9 @@ namespace dataflow {
class NoopAnalysis : public DataflowAnalysis<NoopAnalysis, NoopLattice> {
public:
/// Deprecated. Use the `DataflowAnalysisOptions` constructor instead.
NoopAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
: DataflowAnalysis<NoopAnalysis, NoopLattice>(Context,
ApplyBuiltinTransfer) {}
NoopAnalysis(ASTContext &Context)
: DataflowAnalysis<NoopAnalysis, NoopLattice>(Context) {}
/// `ApplyBuiltinTransfer` controls whether to run the built-in transfer
/// functions that model memory during the analysis. Their results are not
/// used by `NoopAnalysis`, but tests that need to inspect the environment
/// should enable them.
NoopAnalysis(ASTContext &Context, DataflowAnalysisOptions Options)
: DataflowAnalysis<NoopAnalysis, NoopLattice>(Context, Options) {}

View file

@ -21,24 +21,24 @@ namespace dataflow {
/// Copies a record (struct, class, or union) from `Src` to `Dst`.
///
/// This performs a deep copy, i.e. it copies every field and recurses on
/// fields of record type. It also copies properties from the `StructValue`
/// associated with `Src` to the `StructValue` associated with `Dst` (if these
/// `StructValue`s exist).
/// This performs a deep copy, i.e. it copies every field (including synthetic
/// fields) and recurses on fields of record type. It also copies properties
/// from the `RecordValue` associated with `Src` to the `RecordValue` associated
/// with `Dst` (if these `RecordValue`s exist).
///
/// If there is a `StructValue` associated with `Dst` in the environment, this
/// function creates a new `StructValue` and associates it with `Dst`; clients
/// need to be aware of this and must not assume that the `StructValue`
/// If there is a `RecordValue` associated with `Dst` in the environment, this
/// function creates a new `RecordValue` and associates it with `Dst`; clients
/// need to be aware of this and must not assume that the `RecordValue`
/// associated with `Dst` remains the same after the call.
///
/// We create a new `StructValue` rather than modifying properties on the old
/// `StructValue` because the old `StructValue` may be shared with other
/// We create a new `RecordValue` rather than modifying properties on the old
/// `RecordValue` because the old `RecordValue` may be shared with other
/// `Environment`s, and we don't want changes to properties to be visible there.
///
/// Requirements:
///
/// `Src` and `Dst` must have the same canonical unqualified type.
void copyRecord(AggregateStorageLocation &Src, AggregateStorageLocation &Dst,
void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
Environment &Env);
/// Returns whether the records `Loc1` and `Loc2` are equal.
@ -47,10 +47,11 @@ void copyRecord(AggregateStorageLocation &Src, AggregateStorageLocation &Dst,
/// retrieved from `Env2`. A convenience overload retrieves values for `Loc1`
/// and `Loc2` from the same environment.
///
/// This performs a deep comparison, i.e. it compares every field and recurses
/// on fields of record type. Fields of reference type compare equal if they
/// refer to the same storage location. If `StructValue`s are associated with
/// `Loc1` and `Loc2`, it also compares the properties on those `StructValue`s.
/// This performs a deep comparison, i.e. it compares every field (including
/// synthetic fields) and recurses on fields of record type. Fields of reference
/// type compare equal if they refer to the same storage location. If
/// `RecordValue`s are associated with `Loc1` and Loc2`, it also compares the
/// properties on those `RecordValue`s.
///
/// Note on how to interpret the result:
/// - If this returns true, the records are guaranteed to be equal at runtime.
@ -60,12 +61,11 @@ void copyRecord(AggregateStorageLocation &Src, AggregateStorageLocation &Dst,
/// Requirements:
///
/// `Src` and `Dst` must have the same canonical unqualified type.
bool recordsEqual(const AggregateStorageLocation &Loc1, const Environment &Env1,
const AggregateStorageLocation &Loc2,
const Environment &Env2);
bool recordsEqual(const RecordStorageLocation &Loc1, const Environment &Env1,
const RecordStorageLocation &Loc2, const Environment &Env2);
inline bool recordsEqual(const AggregateStorageLocation &Loc1,
const AggregateStorageLocation &Loc2,
inline bool recordsEqual(const RecordStorageLocation &Loc1,
const RecordStorageLocation &Loc2,
const Environment &Env) {
return recordsEqual(Loc1, Env, Loc2, Env);
}

View file

@ -0,0 +1,49 @@
//===-- SimplifyConstraints.h -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SIMPLIFYCONSTRAINTS_H
#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SIMPLIFYCONSTRAINTS_H
#include "clang/Analysis/FlowSensitive/Arena.h"
#include "clang/Analysis/FlowSensitive/Formula.h"
#include "llvm/ADT/SetVector.h"
namespace clang {
namespace dataflow {
/// Information on the way a set of constraints was simplified.
struct SimplifyConstraintsInfo {
/// List of equivalence classes of atoms. For each equivalence class, the
/// original constraints imply that all atoms in it must be equivalent.
/// Simplification replaces all occurrences of atoms in an equivalence class
/// with a single representative atom from the class.
/// Does not contain equivalence classes with just one member or atoms
/// contained in `TrueAtoms` or `FalseAtoms`.
llvm::SmallVector<llvm::SmallVector<Atom>> EquivalentAtoms;
/// Atoms that the original constraints imply must be true.
/// Simplification replaces all occurrences of these atoms by a true literal
/// (which may enable additional simplifications).
llvm::SmallVector<Atom> TrueAtoms;
/// Atoms that the original constraints imply must be false.
/// Simplification replaces all occurrences of these atoms by a false literal
/// (which may enable additional simplifications).
llvm::SmallVector<Atom> FalseAtoms;
};
/// Simplifies a set of constraints (implicitly connected by "and") in a way
/// that does not change satisfiability of the constraints. This does _not_ mean
/// that the set of solutions is the same before and after simplification.
/// `Info`, if non-null, will be populated with information about the
/// simplifications that were made to the formula (e.g. to display to the user).
void simplifyConstraints(llvm::SetVector<const Formula *> &Constraints,
Arena &arena, SimplifyConstraintsInfo *Info = nullptr);
} // namespace dataflow
} // namespace clang
#endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SIMPLIFYCONSTRAINTS_H

View file

@ -31,7 +31,10 @@ namespace dataflow {
/// values is stored in the environment.
class StorageLocation {
public:
enum class Kind { Scalar, Aggregate };
enum class Kind {
Scalar,
Record,
};
StorageLocation(Kind LocKind, QualType Type) : LocKind(LocKind), Type(Type) {
assert(Type.isNull() || !Type->isReferenceType());
@ -66,11 +69,17 @@ public:
}
};
/// A storage location which is subdivided into smaller storage locations that
/// can be traced independently by abstract interpretation. For example: a
/// struct with public members. The child map is flat, so when used for a struct
/// or class type, all accessible members of base struct and class types are
/// directly accesible as children of this location.
/// A storage location for a record (struct, class, or union).
///
/// Contains storage locations for all modeled fields of the record (also
/// referred to as "children"). The child map is flat, so accessible members of
/// the base class are directly accessible as children of this location.
///
/// Record storage locations may also contain so-called synthetic fields. These
/// are typically used to model the internal state of a class (e.g. the value
/// stored in a `std::optional`) without having to depend on that class's
/// implementation details. All `RecordStorageLocation`s of a given type should
/// have the same synthetic fields.
///
/// The storage location for a field of reference type may be null. This
/// typically occurs in one of two situations:
@ -82,16 +91,15 @@ public:
/// FIXME: Currently, the storage location of unions is modelled the same way as
/// that of structs or classes. Eventually, we need to change this modelling so
/// that all of the members of a given union have the same storage location.
class AggregateStorageLocation final : public StorageLocation {
class RecordStorageLocation final : public StorageLocation {
public:
using FieldToLoc = llvm::DenseMap<const ValueDecl *, StorageLocation *>;
using SyntheticFieldMap = llvm::StringMap<StorageLocation *>;
explicit AggregateStorageLocation(QualType Type)
: AggregateStorageLocation(Type, FieldToLoc()) {}
AggregateStorageLocation(QualType Type, FieldToLoc TheChildren)
: StorageLocation(Kind::Aggregate, Type),
Children(std::move(TheChildren)) {
RecordStorageLocation(QualType Type, FieldToLoc TheChildren,
SyntheticFieldMap TheSyntheticFields)
: StorageLocation(Kind::Record, Type), Children(std::move(TheChildren)),
SyntheticFields(std::move(TheSyntheticFields)) {
assert(!Type.isNull());
assert(Type->isRecordType());
assert([this] {
@ -104,7 +112,7 @@ public:
}
static bool classof(const StorageLocation *Loc) {
return Loc->getKind() == Kind::Aggregate;
return Loc->getKind() == Kind::Record;
}
/// Returns the child storage location for `D`.
@ -131,9 +139,22 @@ public:
return It->second;
}
/// Returns the storage location for the synthetic field `Name`.
/// The synthetic field must exist.
StorageLocation &getSyntheticField(llvm::StringRef Name) const {
StorageLocation *Loc = SyntheticFields.lookup(Name);
assert(Loc != nullptr);
return *Loc;
}
llvm::iterator_range<SyntheticFieldMap::const_iterator>
synthetic_fields() const {
return {SyntheticFields.begin(), SyntheticFields.end()};
}
/// Changes the child storage location for a field `D` of reference type.
/// All other fields cannot change their storage location and always retain
/// the storage location passed to the `AggregateStorageLocation` constructor.
/// the storage location passed to the `RecordStorageLocation` constructor.
///
/// Requirements:
///
@ -149,6 +170,7 @@ public:
private:
FieldToLoc Children;
SyntheticFieldMap SyntheticFields;
};
} // namespace dataflow

View file

@ -132,25 +132,6 @@ struct TypeErasedDataflowAnalysisState {
}
};
/// Transfers the state of a basic block by evaluating each of its elements in
/// the context of `Analysis` and the states of its predecessors that are
/// available in `BlockStates`. `PostVisitCFG` (if provided) will be applied to
/// each element in the block, after it is evaluated.
///
/// Requirements:
///
/// All predecessors of `Block` except those with loop back edges must have
/// already been transferred. States in `BlockStates` that are set to
/// `std::nullopt` represent basic blocks that are not evaluated yet.
TypeErasedDataflowAnalysisState transferBlock(
const ControlFlowContext &CFCtx,
llvm::ArrayRef<std::optional<TypeErasedDataflowAnalysisState>> BlockStates,
const CFGBlock &Block, const Environment &InitEnv,
TypeErasedDataflowAnalysis &Analysis,
std::function<void(const CFGElement &,
const TypeErasedDataflowAnalysisState &)>
PostVisitCFG = nullptr);
/// Performs dataflow analysis and returns a mapping from basic block IDs to
/// dataflow analysis states that model the respective basic blocks. Indices of
/// the returned vector correspond to basic block IDs. Returns an error if the

View file

@ -34,9 +34,8 @@ class Value {
public:
enum class Kind {
Integer,
Reference,
Pointer,
Struct,
Record,
// TODO: Top values should not be need to be type-specific.
TopBool,
@ -82,8 +81,8 @@ private:
/// transitivity. It does *not* include comparison of `Properties`.
///
/// Computes equivalence for these subclasses:
/// * ReferenceValue, PointerValue -- pointee locations are equal. Does not
/// compute deep equality of `Value` at said location.
/// * PointerValue -- pointee locations are equal. Does not compute deep
/// equality of `Value` at said location.
/// * TopBoolValue -- both are `TopBoolValue`s.
///
/// Otherwise, falls back to pointer equality.
@ -165,23 +164,6 @@ public:
}
};
/// Models a dereferenced pointer. For example, a reference in C++ or an lvalue
/// in C.
class ReferenceValue final : public Value {
public:
explicit ReferenceValue(StorageLocation &ReferentLoc)
: Value(Kind::Reference), ReferentLoc(ReferentLoc) {}
static bool classof(const Value *Val) {
return Val->getKind() == Kind::Reference;
}
StorageLocation &getReferentLoc() const { return ReferentLoc; }
private:
StorageLocation &ReferentLoc;
};
/// Models a symbolic pointer. Specifically, any value of type `T*`.
class PointerValue final : public Value {
public:
@ -202,13 +184,13 @@ private:
/// In C++, prvalues of class type serve only a limited purpose: They can only
/// be used to initialize a result object. It is not possible to access member
/// variables or call member functions on a prvalue of class type.
/// Correspondingly, `StructValue` also serves only two limited purposes:
/// Correspondingly, `RecordValue` also serves only two limited purposes:
/// - It conveys a prvalue of class type from the place where the object is
/// constructed to the result object that it initializes.
///
/// When creating a prvalue of class type, we already need a storage location
/// for `this`, even though prvalues are otherwise not associated with storage
/// locations. `StructValue` is therefore essentially a wrapper for a storage
/// locations. `RecordValue` is therefore essentially a wrapper for a storage
/// location, which is then used to set the storage location for the result
/// object when we process the AST node for that result object.
///
@ -216,41 +198,35 @@ private:
/// MyStruct S = MyStruct(3);
///
/// In this example, `MyStruct(3) is a prvalue, which is modeled as a
/// `StructValue` that wraps an `AbstractStorageLocation`. This
// `AbstractStorageLocation` is then used as the storage location for `S`.
/// `RecordValue` that wraps a `RecordStorageLocation`. This
// `RecordStorageLocation` is then used as the storage location for `S`.
///
/// - It allows properties to be associated with an object of class type.
/// Note that when doing so, you should avoid mutating the properties of an
/// existing `StructValue` in place, as these changes would be visible to
/// other `Environment`s that share the same `StructValue`. Instead, associate
/// a new `StructValue` with the `AggregateStorageLocation` and set the
/// properties on this new `StructValue`. (See also `refreshStructValue()` in
/// existing `RecordValue` in place, as these changes would be visible to
/// other `Environment`s that share the same `RecordValue`. Instead, associate
/// a new `RecordValue` with the `RecordStorageLocation` and set the
/// properties on this new `RecordValue`. (See also `refreshRecordValue()` in
/// DataflowEnvironment.h, which makes this easy.)
/// Note also that this implies that it is common for the same
/// `AggregateStorageLocation` to be associated with different `StructValue`s
/// `RecordStorageLocation` to be associated with different `RecordValue`s
/// in different environments.
/// Over time, we may eliminate `StructValue` entirely. See also the discussion
/// Over time, we may eliminate `RecordValue` entirely. See also the discussion
/// here: https://reviews.llvm.org/D155204#inline-1503204
class StructValue final : public Value {
class RecordValue final : public Value {
public:
explicit StructValue(AggregateStorageLocation &Loc)
: Value(Kind::Struct), Loc(Loc) {}
explicit RecordValue(RecordStorageLocation &Loc)
: Value(Kind::Record), Loc(Loc) {}
static bool classof(const Value *Val) {
return Val->getKind() == Kind::Struct;
return Val->getKind() == Kind::Record;
}
/// Returns the storage location that this `StructValue` is associated with.
AggregateStorageLocation &getAggregateLoc() const { return Loc; }
/// Convenience function that returns the child storage location for `Field`.
/// See also the documentation for `AggregateStorageLocation::getChild()`.
StorageLocation *getChild(const ValueDecl &Field) const {
return Loc.getChild(Field);
}
/// Returns the storage location that this `RecordValue` is associated with.
RecordStorageLocation &getLoc() const { return Loc; }
private:
AggregateStorageLocation &Loc;
RecordStorageLocation &Loc;
};
raw_ostream &operator<<(raw_ostream &OS, const Value &Val);

View file

@ -71,7 +71,7 @@ SVE_VECTOR_TYPE("__SVFloat16_t", "__SVFloat16_t", SveFloat16, SveFloat16Ty, 8, 1
SVE_VECTOR_TYPE("__SVFloat32_t", "__SVFloat32_t", SveFloat32, SveFloat32Ty, 4, 32, true, true, false)
SVE_VECTOR_TYPE("__SVFloat64_t", "__SVFloat64_t", SveFloat64, SveFloat64Ty, 2, 64, true, true, false)
SVE_VECTOR_TYPE("__SVBFloat16_t", "__SVBFloat16_t", SveBFloat16, SveBFloat16Ty, 8, 16, true, false, true)
SVE_VECTOR_TYPE("__SVBfloat16_t", "__SVBfloat16_t", SveBFloat16, SveBFloat16Ty, 8, 16, true, false, true)
//
// x2

View file

@ -107,6 +107,10 @@ def NonBitField : SubsetSubject<Field,
[{!S->isBitField()}],
"non-bit-field non-static data members">;
def BitField : SubsetSubject<Field,
[{S->isBitField()}],
"bit-field data members">;
def NonStaticCXXMethod : SubsetSubject<CXXMethod,
[{!S->isStatic()}],
"non-static member functions">;
@ -273,23 +277,28 @@ class DefaultIntArgument<string name, int default> : IntArgument<name, 1> {
int Default = default;
}
// This argument is more complex, it includes the enumerator type name,
// a list of strings to accept, and a list of enumerators to map them to.
// This argument is more complex, it includes the enumerator type
// name, whether the enum type is externally defined, a list of
// strings to accept, and a list of enumerators to map them to.
class EnumArgument<string name, string type, list<string> values,
list<string> enums, bit opt = 0, bit fake = 0>
list<string> enums, bit opt = 0, bit fake = 0,
bit isExternalType = 0>
: Argument<name, opt, fake> {
string Type = type;
list<string> Values = values;
list<string> Enums = enums;
bit IsExternalType = isExternalType;
}
// FIXME: There should be a VariadicArgument type that takes any other type
// of argument and generates the appropriate type.
class VariadicEnumArgument<string name, string type, list<string> values,
list<string> enums> : Argument<name, 1> {
list<string> enums, bit isExternalType = 0>
: Argument<name, 1> {
string Type = type;
list<string> Values = values;
list<string> Enums = enums;
bit IsExternalType = isExternalType;
}
// This handles one spelling of an attribute.
@ -300,14 +309,17 @@ class Spelling<string name, string variety, int version = 1> {
}
class GNU<string name> : Spelling<name, "GNU">;
class Declspec<string name> : Spelling<name, "Declspec">;
class Declspec<string name> : Spelling<name, "Declspec"> {
bit PrintOnLeft = 1;
}
class Microsoft<string name> : Spelling<name, "Microsoft">;
class CXX11<string namespace, string name, int version = 1>
: Spelling<name, "CXX11", version> {
bit CanPrintOnLeft = 0;
string Namespace = namespace;
}
class C2x<string namespace, string name, int version = 1>
: Spelling<name, "C2x", version> {
class C23<string namespace, string name, int version = 1>
: Spelling<name, "C23", version> {
string Namespace = namespace;
}
@ -330,14 +342,14 @@ class Pragma<string namespace, string name> : Spelling<name, "Pragma"> {
}
// The GCC spelling implies GNU<name>, CXX11<"gnu", name>, and optionally,
// C2x<"gnu", name>. This spelling should be used for any GCC-compatible
// C23<"gnu", name>. This spelling should be used for any GCC-compatible
// attributes.
class GCC<string name, bit allowInC = 1> : Spelling<name, "GCC"> {
bit AllowInC = allowInC;
}
// The Clang spelling implies GNU<name>, CXX11<"clang", name>, and optionally,
// C2x<"clang", name>. This spelling should be used for any Clang-specific
// C23<"clang", name>. This spelling should be used for any Clang-specific
// attributes.
class Clang<string name, bit allowInC = 1, int version = 1>
: Spelling<name, "Clang", version> {
@ -415,7 +427,7 @@ class TargetArch<list<string> arches> : TargetSpec {
let Arches = arches;
}
def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
def TargetAArch64 : TargetArch<["aarch64"]>;
def TargetAArch64 : TargetArch<["aarch64", "aarch64_be", "aarch64_32"]>;
def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
def TargetAVR : TargetArch<["avr"]>;
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
@ -443,10 +455,19 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", "arm", "thumb", "aarch6
def TargetELF : TargetSpec {
let ObjectFormats = ["ELF"];
}
def TargetELFOrMachO : TargetSpec {
let ObjectFormats = ["ELF", "MachO"];
}
def TargetSupportsInitPriority : TargetSpec {
let CustomCode = [{ !Target.getTriple().isOSzOS() }];
}
class TargetSpecificSpelling<TargetSpec target, list<Spelling> spellings> {
TargetSpec Target = target;
list<Spelling> Spellings = spellings;
}
// Attribute subject match rules that are used for #pragma clang attribute.
//
// A instance of AttrSubjectMatcherRule represents an individual match rule.
@ -559,6 +580,12 @@ class AttrSubjectMatcherAggregateRule<AttrSubject subject> {
def SubjectMatcherForNamed : AttrSubjectMatcherAggregateRule<Named>;
class Attr {
// Specifies that when printed, this attribute is meaningful on the
// 'left side' of the declaration.
bit CanPrintOnLeft = 1;
// Specifies that when printed, this attribute is required to be printed on
// the 'left side' of the declaration.
bit PrintOnLeft = 0;
// The various ways in which an attribute can be spelled in source
list<Spelling> Spellings;
// The things to which an attribute can appertain
@ -567,6 +594,8 @@ class Attr {
list<Argument> Args = [];
// Accessors which should be generated for the attribute.
list<Accessor> Accessors = [];
// Specify targets for spellings.
list<TargetSpecificSpelling> TargetSpecificSpellings = [];
// Set to true for attributes with arguments which require delayed parsing.
bit LateParsed = 0;
// Set to false to prevent an attribute from being propagated from a template
@ -707,7 +736,7 @@ def Alias : Attr {
def BuiltinAlias : Attr {
let Spellings = [CXX11<"clang", "builtin_alias">,
C2x<"clang", "builtin_alias">,
C23<"clang", "builtin_alias">,
GNU<"clang_builtin_alias">];
let Args = [IdentifierArgument<"BuiltinName">];
let Subjects = SubjectList<[Function], ErrorDiag>;
@ -769,9 +798,9 @@ def AlignNatural : InheritableAttr {
def AlwaysInline : DeclOrStmtAttr {
let Spellings = [GCC<"always_inline">, CXX11<"clang", "always_inline">,
C2x<"clang", "always_inline">, CustomKeyword<"__forceinline">];
C23<"clang", "always_inline">, CustomKeyword<"__forceinline">];
let Accessors = [Accessor<"isClangAlwaysInline", [CXX11<"clang", "always_inline">,
C2x<"clang", "always_inline">]>];
C23<"clang", "always_inline">]>];
let Subjects = SubjectList<[Function, Stmt], WarnDiag,
"functions and statements">;
let Documentation = [AlwaysInlineDocs];
@ -857,7 +886,7 @@ def Annotate : InheritableParamAttr {
}
def AnnotateType : TypeAttr {
let Spellings = [CXX11<"clang", "annotate_type">, C2x<"clang", "annotate_type">];
let Spellings = [CXX11<"clang", "annotate_type">, C23<"clang", "annotate_type">];
let Args = [StringArgument<"Annotation">, VariadicExprArgument<"Args">];
let HasCustomParsing = 1;
let AcceptsExprPack = 1;
@ -892,6 +921,7 @@ def AVRSignal : InheritableAttr, TargetSpecificAttr<TargetAVR> {
}
def AsmLabel : InheritableAttr {
let CanPrintOnLeft = 0;
let Spellings = [CustomKeyword<"asm">, CustomKeyword<"__asm__">];
let Args = [
// Label specifies the mangled name for the decl.
@ -1055,6 +1085,42 @@ def CFConsumed : InheritableParamAttr {
let Documentation = [RetainBehaviorDocs];
}
// coro_only_destroy_when_complete indicates the coroutines whose return type
// is marked by coro_only_destroy_when_complete can only be destroyed when the
// coroutine completes. Then the space for the destroy functions can be saved.
def CoroOnlyDestroyWhenComplete : InheritableAttr {
let Spellings = [Clang<"coro_only_destroy_when_complete">];
let Subjects = SubjectList<[CXXRecord]>;
let LangOpts = [CPlusPlus];
let Documentation = [CoroOnlyDestroyWhenCompleteDocs];
let SimpleHandler = 1;
}
def CoroReturnType : InheritableAttr {
let Spellings = [Clang<"coro_return_type">];
let Subjects = SubjectList<[CXXRecord]>;
let LangOpts = [CPlusPlus];
let Documentation = [CoroReturnTypeAndWrapperDoc];
let SimpleHandler = 1;
}
def CoroWrapper : InheritableAttr {
let Spellings = [Clang<"coro_wrapper">];
let Subjects = SubjectList<[Function]>;
let LangOpts = [CPlusPlus];
let Documentation = [CoroReturnTypeAndWrapperDoc];
let SimpleHandler = 1;
}
def CoroLifetimeBound : InheritableAttr {
let Spellings = [Clang<"coro_lifetimebound">];
let Subjects = SubjectList<[CXXRecord]>;
let LangOpts = [CPlusPlus];
let Documentation = [CoroLifetimeBoundDoc];
let SimpleHandler = 1;
}
// OSObject-based attributes.
def OSConsumed : InheritableParamAttr {
let Spellings = [Clang<"os_consumed">];
@ -1148,7 +1214,7 @@ def Constructor : InheritableAttr {
let Spellings = [GCC<"constructor">];
let Args = [DefaultIntArgument<"Priority", 65535>];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
let Documentation = [CtorDtorDocs];
}
def CPUSpecific : InheritableAttr {
@ -1257,7 +1323,8 @@ def CUDAInvalidTarget : InheritableAttr {
def CUDALaunchBounds : InheritableAttr {
let Spellings = [GNU<"launch_bounds">, Declspec<"__launch_bounds__">];
let Args = [ExprArgument<"MaxThreads">, ExprArgument<"MinBlocks", 1>];
let Args = [ExprArgument<"MaxThreads">, ExprArgument<"MinBlocks", 1>,
ExprArgument<"MaxBlocks", 1>];
let LangOpts = [CUDA];
let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
// An AST node is created for this attribute, but is not used by other parts
@ -1297,7 +1364,7 @@ def C11NoReturn : InheritableAttr {
def CXX11NoReturn : InheritableAttr {
let Spellings = [CXX11<"", "noreturn", 200809>,
C2x<"", "noreturn", 202202>, C2x<"", "_Noreturn", 202202>];
C23<"", "noreturn", 202202>, C23<"", "_Noreturn", 202202>];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [CXX11NoReturnDocs];
}
@ -1401,7 +1468,7 @@ def RenderScriptKernel : Attr {
def Deprecated : InheritableAttr {
let Spellings = [GCC<"deprecated">, Declspec<"deprecated">,
CXX11<"","deprecated", 201309>,
C2x<"", "deprecated", 201904>];
C23<"", "deprecated", 201904>];
let Args = [StringArgument<"Message", 1>,
// An optional string argument that enables us to provide a
// Fix-It.
@ -1414,7 +1481,7 @@ def Destructor : InheritableAttr {
let Spellings = [GCC<"destructor">];
let Args = [DefaultIntArgument<"Priority", 65535>];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
let Documentation = [CtorDtorDocs];
}
def EmptyBases : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
@ -1434,6 +1501,7 @@ def AllocSize : InheritableAttr {
}
def EnableIf : InheritableAttr {
let CanPrintOnLeft = 0;
// Does not have a [[]] spelling because this attribute requires the ability
// to parse function arguments but the attribute is not written in the type
// position.
@ -1459,7 +1527,7 @@ def ExtVectorType : Attr {
def FallThrough : StmtAttr {
let Spellings = [CXX11<"", "fallthrough", 201603>,
C2x<"", "fallthrough", 201910>,
C23<"", "fallthrough", 201910>,
CXX11<"clang", "fallthrough">, GCC<"fallthrough">];
// The attribute only applies to a NullStmt, but we have special fix-it
// behavior if applied to a case label.
@ -1469,12 +1537,12 @@ def FallThrough : StmtAttr {
}
def Likely : StmtAttr {
let Spellings = [CXX11<"", "likely", 201803>, C2x<"clang", "likely">];
let Spellings = [CXX11<"", "likely", 201803>, C23<"clang", "likely">];
let Documentation = [LikelihoodDocs];
}
def Unlikely : StmtAttr {
let Spellings = [CXX11<"", "unlikely", 201803>, C2x<"clang", "unlikely">];
let Spellings = [CXX11<"", "unlikely", 201803>, C23<"clang", "unlikely">];
let Documentation = [LikelihoodDocs];
}
def : MutualExclusions<[Likely, Unlikely]>;
@ -1600,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
let Documentation = [Undocumented];
}
def IFunc : Attr, TargetSpecificAttr<TargetELF> {
def IFunc : Attr, TargetSpecificAttr<TargetELFOrMachO> {
let Spellings = [GCC<"ifunc">];
let Args = [StringArgument<"Resolver">];
let Subjects = SubjectList<[Function]>;
@ -1787,11 +1855,14 @@ def ArmMveStrictPolymorphism : TypeAttr, TargetSpecificAttr<TargetARM> {
let Documentation = [ArmMveStrictPolymorphismDocs];
}
def NoUniqueAddress : InheritableAttr, TargetSpecificAttr<TargetItaniumCXXABI> {
let Spellings = [CXX11<"", "no_unique_address", 201803>];
def NoUniqueAddress : InheritableAttr {
let Subjects = SubjectList<[NonBitField], ErrorDiag>;
let Spellings = [CXX11<"", "no_unique_address", 201803>, CXX11<"msvc", "no_unique_address", 201803>];
let TargetSpecificSpellings = [
TargetSpecificSpelling<TargetItaniumCXXABI, [CXX11<"", "no_unique_address", 201803>]>,
TargetSpecificSpelling<TargetMicrosoftCXXABI, [CXX11<"msvc", "no_unique_address", 201803>]>,
];
let Documentation = [NoUniqueAddressDocs];
let SimpleHandler = 1;
}
def ReturnsTwice : InheritableAttr {
@ -1853,10 +1924,10 @@ def Convergent : InheritableAttr {
def NoInline : DeclOrStmtAttr {
let Spellings = [CustomKeyword<"__noinline__">, GCC<"noinline">,
CXX11<"clang", "noinline">, C2x<"clang", "noinline">,
CXX11<"clang", "noinline">, C23<"clang", "noinline">,
Declspec<"noinline">];
let Accessors = [Accessor<"isClangNoInline", [CXX11<"clang", "noinline">,
C2x<"clang", "noinline">]>];
C23<"clang", "noinline">]>];
let Documentation = [NoInlineDocs];
let Subjects = SubjectList<[Function, Stmt], WarnDiag,
"functions and statements">;
@ -1956,6 +2027,14 @@ def BPFPreserveAccessIndex : InheritableAttr,
let LangOpts = [COnly];
}
def BPFPreserveStaticOffset : InheritableAttr,
TargetSpecificAttr<TargetBPF> {
let Spellings = [Clang<"preserve_static_offset">];
let Subjects = SubjectList<[Record], ErrorDiag>;
let Documentation = [BPFPreserveStaticOffsetDocs];
let LangOpts = [COnly];
}
def BTFDeclTag : InheritableAttr {
let Spellings = [Clang<"btf_decl_tag">];
let Args = [StringArgument<"BTFDeclTag">];
@ -2136,7 +2215,8 @@ def NotTailCalled : InheritableAttr {
def : MutualExclusions<[AlwaysInline, NotTailCalled]>;
def NoStackProtector : InheritableAttr {
let Spellings = [Clang<"no_stack_protector">, Declspec<"safebuffers">];
let Spellings = [Clang<"no_stack_protector">, CXX11<"gnu", "no_stack_protector">,
C23<"gnu", "no_stack_protector">, Declspec<"safebuffers">];
let Subjects = SubjectList<[Function]>;
let Documentation = [NoStackProtectorDocs];
let SimpleHandler = 1;
@ -2435,9 +2515,43 @@ def AArch64SVEPcs: DeclOrTypeAttr {
def ArmStreaming : TypeAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_streaming">];
let Documentation = [ArmStreamingDocs];
let Subjects = SubjectList<[HasFunctionProto], ErrorDiag>;
let Documentation = [ArmSmeStreamingDocs];
}
def ArmStreamingCompatible : TypeAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_streaming_compatible">];
let Subjects = SubjectList<[HasFunctionProto], ErrorDiag>;
let Documentation = [ArmSmeStreamingCompatibleDocs];
}
def ArmSharedZA : TypeAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_shared_za">];
let Subjects = SubjectList<[HasFunctionProto], ErrorDiag>;
let Documentation = [ArmSmeSharedZADocs];
}
def ArmPreservesZA : TypeAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_preserves_za">];
let Subjects = SubjectList<[HasFunctionProto], ErrorDiag>;
let Documentation = [ArmSmePreservesZADocs];
}
def ArmLocallyStreaming : InheritableAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_locally_streaming">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [ArmSmeLocallyStreamingDocs];
}
def ArmNewZA : InheritableAttr, TargetSpecificAttr<TargetAArch64> {
let Spellings = [RegularKeyword<"__arm_new_za">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [ArmSmeNewZADocs];
}
def : MutualExclusions<[ArmNewZA, ArmSharedZA]>;
def : MutualExclusions<[ArmNewZA, ArmPreservesZA]>;
def Pure : InheritableAttr {
let Spellings = [GCC<"pure">];
let Documentation = [Undocumented];
@ -2682,9 +2796,10 @@ def SwiftAsyncError : InheritableAttr {
let Documentation = [SwiftAsyncErrorDocs];
}
def Suppress : StmtAttr {
let Spellings = [CXX11<"gsl", "suppress">];
def Suppress : DeclOrStmtAttr {
let Spellings = [CXX11<"gsl", "suppress">, Clang<"suppress">];
let Args = [VariadicStringArgument<"DiagnosticIdentifiers">];
let Accessors = [Accessor<"isGSL", [CXX11<"gsl", "suppress">]>];
let Documentation = [SuppressDocs];
}
@ -2748,6 +2863,11 @@ def PreserveAll : DeclOrTypeAttr {
let Documentation = [PreserveAllDocs];
}
def M68kRTD: DeclOrTypeAttr {
let Spellings = [Clang<"m68k_rtd">];
let Documentation = [M68kRTDDocs];
}
def Target : InheritableAttr {
let Spellings = [GCC<"target">];
let Args = [StringArgument<"featuresStr">];
@ -2763,7 +2883,7 @@ def Target : InheritableAttr {
for (auto &Feature : AttrFeatures) {
Feature = Feature.trim();
if (Feature.startswith("arch="))
if (Feature.starts_with("arch="))
return Feature.drop_front(sizeof("arch=") - 1);
}
return "";
@ -2781,8 +2901,8 @@ def Target : InheritableAttr {
for (auto &Feature : AttrFeatures) {
Feature = Feature.trim();
if (!Feature.startswith("no-") && !Feature.startswith("arch=") &&
!Feature.startswith("fpmath=") && !Feature.startswith("tune="))
if (!Feature.starts_with("no-") && !Feature.starts_with("arch=") &&
!Feature.starts_with("fpmath=") && !Feature.starts_with("tune="))
Out.push_back(Feature);
}
}
@ -2886,6 +3006,7 @@ def Unavailable : InheritableAttr {
}
def DiagnoseIf : InheritableAttr {
let CanPrintOnLeft = 0;
// Does not have a [[]] spelling because this attribute requires the ability
// to parse function arguments but the attribute is not written in the type
// position.
@ -2936,7 +3057,7 @@ def ObjCRequiresPropertyDefs : InheritableAttr {
def Unused : InheritableAttr {
let Spellings = [CXX11<"", "maybe_unused", 201603>, GCC<"unused">,
C2x<"", "maybe_unused", 202106>];
C23<"", "maybe_unused", 202106>];
let Subjects = SubjectList<[Var, ObjCIvar, Type, Enum, EnumConstant, Label,
Field, ObjCMethod, FunctionLike]>;
let Documentation = [WarnMaybeUnusedDocs];
@ -3030,7 +3151,7 @@ def WarnUnused : InheritableAttr {
def WarnUnusedResult : InheritableAttr {
let Spellings = [CXX11<"", "nodiscard", 201907>,
C2x<"", "nodiscard", 202003>,
C23<"", "nodiscard", 202003>,
CXX11<"clang", "warn_unused_result">,
GCC<"warn_unused_result">];
let Subjects = SubjectList<[ObjCMethod, Enum, Record, FunctionLike, TypedefName]>;
@ -3079,7 +3200,7 @@ def AnyX86Interrupt : InheritableAttr, TargetSpecificAttr<TargetAnyX86> {
let Subjects = SubjectList<[HasFunctionProto]>;
let ParseKind = "Interrupt";
let HasCustomParsing = 1;
let Documentation = [Undocumented];
let Documentation = [AnyX86InterruptDocs];
}
def AnyX86NoCallerSavedRegisters : InheritableAttr,
@ -3530,6 +3651,14 @@ def : MutualExclusions<[Owner, Pointer]>;
// Microsoft-related attributes
def MSConstexpr : InheritableAttr {
let LangOpts = [MicrosoftExt];
let Spellings = [CXX11<"msvc", "constexpr">];
let Subjects = SubjectList<[Function, ReturnStmt], ErrorDiag,
"functions and return statements">;
let Documentation = [MSConstexprDocs];
}
def MSNoVTable : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
let Spellings = [Declspec<"novtable">];
let Subjects = SubjectList<[CXXRecord]>;
@ -4099,24 +4228,14 @@ def HLSLShader : InheritableAttr {
let Spellings = [Microsoft<"shader">];
let Subjects = SubjectList<[HLSLEntry]>;
let LangOpts = [HLSL];
// NOTE:
// order for the enum should match order in llvm::Triple::EnvironmentType.
// ShaderType will be converted to llvm::Triple::EnvironmentType like
// (llvm::Triple::EnvironmentType)((uint32_t)ShaderType +
// (uint32_t)llvm::Triple::EnvironmentType::Pixel).
// This will avoid update code for convert when new shader type is added.
let Args = [
EnumArgument<"Type", "ShaderType",
[
"pixel", "vertex", "geometry", "hull", "domain", "compute",
"library", "raygeneration", "intersection", "anyHit",
"closestHit", "miss", "callable", "mesh", "amplification"
],
[
"Pixel", "Vertex", "Geometry", "Hull", "Domain", "Compute",
"Library", "RayGeneration", "Intersection", "AnyHit",
"ClosestHit", "Miss", "Callable", "Mesh", "Amplification"
]>
["pixel", "vertex", "geometry", "hull", "domain", "compute",
"raygeneration", "intersection", "anyhit", "closesthit",
"miss", "callable", "mesh", "amplification"],
["Pixel", "Vertex", "Geometry", "Hull", "Domain", "Compute",
"RayGeneration", "Intersection", "AnyHit", "ClosestHit",
"Miss", "Callable", "Mesh", "Amplification"]>
];
let Documentation = [HLSLSV_ShaderTypeAttrDocs];
}
@ -4125,26 +4244,27 @@ def HLSLResource : InheritableAttr {
let Spellings = [];
let Subjects = SubjectList<[Struct]>;
let LangOpts = [HLSL];
let Args = [EnumArgument<"ResourceType", "ResourceClass",
let Args = [EnumArgument<"ResourceClass", "llvm::hlsl::ResourceClass",
["SRV", "UAV", "CBuffer", "Sampler"],
["SRV", "UAV", "CBuffer", "Sampler"]
>,
EnumArgument<"ResourceShape", "ResourceKind",
["SRV", "UAV", "CBuffer", "Sampler"],
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1>,
EnumArgument<"ResourceKind", "llvm::hlsl::ResourceKind",
["Texture1D", "Texture2D", "Texture2DMS",
"Texture3D", "TextureCube", "Texture1DArray",
"Texture2DArray", "Texture2DMSArray",
"TextureCubeArray", "TypedBuffer", "RawBuffer",
"StructuredBuffer", "CBufferKind", "SamplerKind",
"TBuffer", "RTAccelerationStructure", "FeedbackTexture2D",
"FeedbackTexture2DArray"],
"StructuredBuffer", "CBuffer", "Sampler",
"TBuffer", "RTAccelerationStructure",
"FeedbackTexture2D", "FeedbackTexture2DArray"],
["Texture1D", "Texture2D", "Texture2DMS",
"Texture3D", "TextureCube", "Texture1DArray",
"Texture2DArray", "Texture2DMSArray",
"TextureCubeArray", "TypedBuffer", "RawBuffer",
"StructuredBuffer", "CBufferKind", "SamplerKind",
"TBuffer", "RTAccelerationStructure", "FeedbackTexture2D",
"FeedbackTexture2DArray"]
>
"StructuredBuffer", "CBuffer", "Sampler",
"TBuffer", "RTAccelerationStructure",
"FeedbackTexture2D", "FeedbackTexture2DArray"],
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1>,
DefaultBoolArgument<"isROV", /*default=*/0>
];
let Documentation = [InternalOnly];
}
@ -4155,6 +4275,18 @@ def HLSLGroupSharedAddressSpace : TypeAttr {
let Documentation = [HLSLGroupSharedAddressSpaceDocs];
}
def HLSLParamModifier : TypeAttr {
let Spellings = [CustomKeyword<"in">, CustomKeyword<"inout">, CustomKeyword<"out">];
let Accessors = [Accessor<"isIn", [CustomKeyword<"in">]>,
Accessor<"isInOut", [CustomKeyword<"inout">]>,
Accessor<"isOut", [CustomKeyword<"out">]>,
Accessor<"isAnyOut", [CustomKeyword<"out">, CustomKeyword<"inout">]>,
Accessor<"isAnyIn", [CustomKeyword<"in">, CustomKeyword<"inout">]>];
let Subjects = SubjectList<[ParmVar]>;
let Documentation = [HLSLParamQualifierDocs];
let Args = [DefaultBoolArgument<"MergedSpelling", /*default*/0, /*fake*/1>];
}
def RandomizeLayout : InheritableAttr {
let Spellings = [GCC<"randomize_layout">];
let Subjects = SubjectList<[Record]>;
@ -4199,3 +4331,39 @@ def AvailableOnlyInDefaultEvalMethod : InheritableAttr {
let Documentation = [Undocumented];
}
def CountedBy : InheritableAttr {
let Spellings = [Clang<"counted_by">];
let Subjects = SubjectList<[Field]>;
let Args = [IdentifierArgument<"CountedByField">];
let Documentation = [CountedByDocs];
let LangOpts = [COnly];
// FIXME: This is ugly. Let using a DeclArgument would be nice, but a Decl
// isn't yet available due to the fact that we're still parsing the
// structure. Maybe that code could be changed sometime in the future.
code AdditionalMembers = [{
private:
SourceRange CountedByFieldLoc;
public:
SourceRange getCountedByFieldLoc() const { return CountedByFieldLoc; }
void setCountedByFieldLoc(SourceRange Loc) { CountedByFieldLoc = Loc; }
}];
}
def PreferredType: InheritableAttr {
let Spellings = [Clang<"preferred_type">];
let Subjects = SubjectList<[BitField], ErrorDiag>;
let Args = [TypeArgument<"Type", 1>];
let Documentation = [PreferredTypeDocumentation];
}
def CodeAlign: StmtAttr {
let Spellings = [Clang<"code_align">];
let Subjects = SubjectList<[ForStmt, CXXForRangeStmt, WhileStmt, DoStmt],
ErrorDiag, "'for', 'while', and 'do' statements">;
let Args = [ExprArgument<"Alignment">];
let Documentation = [CodeAlignAttrDocs];
let AdditionalMembers = [{
static constexpr int MinimumAlignment = 1;
static constexpr int MaximumAlignment = 4096;
}];
}

View file

@ -1163,7 +1163,7 @@ caveats to this use of name mangling:
* The ``overloadable`` attribute has almost no meaning when used in C++,
because names will already be mangled and functions are already overloadable.
However, when an ``overloadable`` function occurs within an ``extern "C"``
linkage specification, it's name *will* be mangled in the same way as it
linkage specification, its name *will* be mangled in the same way as it
would in C.
For the purpose of backwards compatibility, at most one function with the same
@ -1405,6 +1405,10 @@ Example usage:
``[[no_unique_address]]`` is a standard C++20 attribute. Clang supports its use
in C++11 onwards.
On MSVC targets, ``[[no_unique_address]]`` is ignored; use
``[[msvc::no_unique_address]]`` instead. Currently there is no guarantee of ABI
compatibility or stability with MSVC.
}];
}
@ -1858,7 +1862,8 @@ The attribute may be applied to the declaration of a class, a typedef, a
variable, a function or method, a function parameter, an enumeration, an
enumerator, a non-static data member, or a label.
.. code-block: c++
.. code-block:: c++
#include <cassert>
[[maybe_unused]] void f([[maybe_unused]] bool thing1,
@ -1887,7 +1892,8 @@ literal contents) are allowed. If there are redeclarations of the entity with
differing string literals, it is unspecified which one will be used by Clang
in any resulting diagnostics.
.. code-block: c++
.. code-block:: c++
struct [[nodiscard]] error_info { /*...*/ };
error_info enable_missile_safety_mode();
@ -1904,7 +1910,8 @@ marked with ``[[nodiscard]]`` or a constructor of a type marked
``[[nodiscard]]`` will also diagnose. This also applies to type conversions that
use the annotated ``[[nodiscard]]`` constructor or result in an annotated type.
.. code-block: c++
.. code-block:: c++
struct [[nodiscard]] marked_type {/*..*/ };
struct marked_ctor {
[[nodiscard]] marked_ctor();
@ -2192,6 +2199,43 @@ preserving struct or union member access debuginfo indices of this
struct or union, similar to clang ``__builtin_preserve_access_index()``.
}];
}
def BPFPreserveStaticOffsetDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Clang supports the ``__attribute__((preserve_static_offset))``
attribute for the BPF target. This attribute may be attached to a
struct or union declaration. Reading or writing fields of types having
such annotation is guaranteed to generate LDX/ST/STX instruction with
offset corresponding to the field.
For example:
.. code-block:: c
struct foo {
int a;
int b;
};
struct bar {
int a;
struct foo b;
} __attribute__((preserve_static_offset));
void buz(struct bar *g) {
g->b.a = 42;
}
The assignment to ``g``'s field would produce an ST instruction with
offset 8: ``*(u32)(r1 + 8) = 42;``.
Without this attribute generated instructions might be different,
depending on optimizations behavior. E.g. the example above could be
rewritten as ``r1 += 8; *(u32)(r1 + 0) = 42;``.
}];
}
def BTFDeclTagDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
@ -2508,6 +2552,13 @@ example, the following will emit 4 versions of the function:
__attribute__((target_clones("arch=atom,avx2","arch=ivybridge","default")))
void foo() {}
For targets that support the GNU indirect function (IFUNC) feature, dispatch
is performed by emitting an indirect function that is resolved to the appropriate
target clone at load time. The indirect function is given the name the
multiversioned function would have if it had been declared without the attribute.
For backward compatibility with earlier Clang releases, a function alias with an
``.ifunc`` suffix is also emitted. The ``.ifunc`` suffixed symbol is a deprecated
feature and support for it may be removed in the future.
}];
}
@ -2608,8 +2659,9 @@ An error will be given if:
- Specified values violate subtarget specifications;
- Specified values are not compatible with values provided through other
attributes;
- The AMDGPU target backend is unable to create machine code that can meet the
request.
The AMDGPU target backend will emit a warning whenever it is unable to
create machine code that meets the request.
}];
}
@ -2774,7 +2826,7 @@ On x86 targets, this attribute changes the calling convention to
as possible in registers. It also tries to utilize registers for the
return value whenever it is possible.
.. _`__regcall`: https://software.intel.com/en-us/node/693069
.. _`__regcall`: https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2023-2/c-c-sycl-calling-conventions.html
}];
}
@ -2818,6 +2870,18 @@ See the documentation for `__vectorcall`_ on MSDN for more details.
}];
}
def M68kRTDDocs : Documentation {
let Category = DocCatCallingConvs;
let Content = [{
On M68k targets, this attribute changes the calling convention of a function
to clear parameters off the stack on return. In other words, callee is
responsible for cleaning out the stack space allocated for incoming paramters.
This convention does not support variadic calls or unprototyped functions in C.
When targeting M68010 or newer CPUs, this calling convention is implemented
using the `rtd` instruction.
}];
}
def DocCatConsumed : DocumentationCategory<"Consumed Annotation Checking"> {
let Content = [{
Clang supports additional attributes for checking basic resource management
@ -3593,6 +3657,21 @@ an error:
}];
}
def MSConstexprDocs : Documentation {
let Category = DocCatStmt;
let Content = [{
The ``[[msvc::constexpr]]`` attribute can be applied only to a function
definition or a ``return`` statement. It does not impact function declarations.
A ``[[msvc::constexpr]]`` function cannot be ``constexpr`` or ``consteval``.
A ``[[msvc::constexpr]]`` function is treated as if it were a ``constexpr`` function
when it is evaluated in a constant context of ``[[msvc::constexpr]] return`` statement.
Otherwise, it is treated as a regular function.
Semantics of this attribute are enabled only under MSVC compatibility
(``-fms-compatibility-version``) 19.33 and later.
}];
}
def MSNoVTableDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
@ -4798,6 +4877,54 @@ Marking virtual functions as ``disable_tail_calls`` is legal.
}];
}
def AnyX86InterruptDocs : Documentation {
let Category = DocCatFunction;
let Heading = "interrupt (X86)";
let Content = [{
Clang supports the GNU style ``__attribute__((interrupt))`` attribute on X86
targets. This attribute may be attached to a function definition and instructs
the backend to generate appropriate function entry/exit code so that it can be
used directly as an interrupt service routine.
Interrupt handlers have access to the stack frame pushed onto the stack by the processor,
and return using the ``IRET`` instruction. All registers in an interrupt handler are callee-saved.
Exception handlers also have access to the error code pushed onto the stack by the processor,
when applicable.
An interrupt handler must take the following arguments:
.. code-block:: c
__attribute__ ((interrupt))
void f (struct stack_frame *frame) {
...
}
Where ``struct stack_frame`` is a suitable struct matching the stack frame pushed by the
processor.
An exception handler must take the following arguments:
.. code-block:: c
__attribute__ ((interrupt))
void g (struct stack_frame *frame, unsigned long code) {
...
}
On 32-bit targets, the ``code`` argument should be of type ``unsigned int``.
Exception handlers should only be used when an error code is pushed by the processor.
Using the incorrect handler type will crash the system.
Interrupt and exception handlers cannot be called by other functions and must have return type ``void``.
Interrupt and exception handlers should only call functions with the 'no_caller_saved_registers'
attribute, or should be compiled with the '-mgeneral-regs-only' flag to avoid saving unused
non-GPR registers.
}];
}
def AnyX86NoCallerSavedRegistersDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
@ -4812,6 +4939,10 @@ The user can call functions specified with the 'no_caller_saved_registers'
attribute from an interrupt handler without saving and restoring all
call-clobbered registers.
Functions specified with the 'no_caller_saved_registers' attribute should only
call other functions with the 'no_caller_saved_registers' attribute, or should be
compiled with the '-mgeneral-regs-only' flag to avoid saving unused non-GPR registers.
Note that 'no_caller_saved_registers' attribute is not a calling convention.
In fact, it only overrides the decision of which registers should be saved by
the caller, but not how the parameters are passed from the caller to the callee.
@ -5136,7 +5267,74 @@ the ``int`` parameter is the one that represents the error.
def SuppressDocs : Documentation {
let Category = DocCatStmt;
let Content = [{
The ``[[gsl::suppress]]`` attribute suppresses specific
The ``suppress`` attribute suppresses unwanted warnings coming from static
analysis tools such as the Clang Static Analyzer. The tool will not report
any issues in source code annotated with the attribute.
The attribute cannot be used to suppress traditional Clang warnings, because
many such warnings are emitted before the attribute is fully parsed.
Consider using ``#pragma clang diagnostic`` to control such diagnostics,
as described in `Controlling Diagnostics via Pragmas
<https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas>`_.
The ``suppress`` attribute can be placed on an individual statement in order to
suppress warnings about undesirable behavior occurring at that statement:
.. code-block:: c++
int foo() {
int *x = nullptr;
...
[[clang::suppress]]
return *x; // null pointer dereference warning suppressed here
}
Putting the attribute on a compound statement suppresses all warnings in scope:
.. code-block:: c++
int foo() {
[[clang::suppress]] {
int *x = nullptr;
...
return *x; // warnings suppressed in the entire scope
}
}
Some static analysis warnings are accompanied by one or more notes, and the
line of code against which the warning is emitted isn't necessarily the best
for suppression purposes. In such cases the tools are allowed to implement
additional ways to suppress specific warnings based on the attribute attached
to a note location.
For example, the Clang Static Analyzer suppresses memory leak warnings when
the suppression attribute is placed at the allocation site (highlited by
a "note: memory is allocated"), which may be different from the line of code
at which the program "loses track" of the pointer (where the warning
is ultimately emitted):
.. code-block:: c
int bar1(bool coin_flip) {
__attribute__((suppress))
int *result = (int *)malloc(sizeof(int));
if (coin_flip)
return 1; // warning about this leak path is suppressed
return *result; // warning about this leak path is also suppressed
}
int bar2(bool coin_flip) {
int *result = (int *)malloc(sizeof(int));
if (coin_flip)
return 1; // leak warning on this path NOT suppressed
__attribute__((suppress))
return *result; // leak warning is suppressed only on this path
}
When written as ``[[gsl::suppress]]``, this attribute suppresses specific
clang-tidy diagnostics for rules of the `C++ Core Guidelines`_ in a portable
way. The attribute can be attached to declarations, statements, and at
namespace scope.
@ -5337,7 +5535,9 @@ considered inline.
Not all targets support this attribute. ELF target support depends on both the
linker and runtime linker, and is available in at least lld 4.0 and later,
binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
Non-ELF targets currently do not support this attribute.
Mach-O targets support it, but with slightly different semantics: the resolver
is run at first call, instead of at load time by the runtime linker. Targets
other than ELF and Mach-O currently do not support this attribute.
}];
}
@ -5685,12 +5885,12 @@ accessed. The following are examples of valid expressions where may not be diagn
``noderef`` is currently only supported for pointers and arrays and not usable
for references or Objective-C object pointers.
.. code-block: c++
.. code-block:: c++
int x = 2;
int __attribute__((noderef)) &y = x; // warning: 'noderef' can only be used on an array or pointer type
.. code-block: objc
.. code-block:: objc
id __attribute__((noderef)) obj = [NSObject new]; // warning: 'noderef' can only be used on an array or pointer type
}];
@ -6578,38 +6778,147 @@ Requirements on Development Tools - Engineering Specification Documentation
}];
}
def ArmStreamingDocs : Documentation {
let Category = DocCatType;
def DocCatArmSmeAttributes : DocumentationCategory<"AArch64 SME Attributes"> {
let Content = [{
.. Note:: This attribute has not been implemented yet, but once it is
implemented, it will behave as described below.
Clang supports a number of AArch64-specific attributes to manage state
added by the Scalable Matrix Extension (SME). This state includes the
runtime mode that the processor is in (e.g. non-streaming or streaming)
as well as the state of the ``ZA`` Matrix Storage.
The ``__arm_streaming`` keyword is only available on AArch64 targets.
It applies to function types and specifies that the function has a
"streaming interface". This means that:
The attributes come in the form of type- and declaration attributes:
* the function requires the Scalable Matrix Extension (SME)
* The SME declaration attributes can appear anywhere that a standard
``[[...]]`` declaration attribute can appear.
* The SME type attributes apply only to prototyped functions and can appear
anywhere that a standard ``[[...]]`` type attribute can appear. The SME
type attributes do not apply to functions having a K&R-style
unprototyped function type.
See `Arm C Language Extensions <https://github.com/ARM-software/acle>`_
for more details about the features related to the SME extension.
See `Procedure Call Standard for the Arm® 64-bit Architecture (AArch64)
<https://github.com/ARM-software/abi-aa>`_ for more details about
streaming-interface functions and shared/private-ZA interface functions.
}];
}
def ArmSmeStreamingDocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_streaming`` keyword applies to prototyped function types and specifies
that the function has a "streaming interface". This means that:
* the function requires that the processor implements the Scalable Matrix
Extension (SME).
* the function must be entered in streaming mode (that is, with PSTATE.SM
set to 1)
* the function must return in streaming mode
See `Procedure Call Standard for the Arm® 64-bit Architecture (AArch64)
<https://github.com/ARM-software/abi-aa>`_ for more details about
streaming-interface functions.
Clang manages PSTATE.SM automatically; it is not the source code's
responsibility to do this. For example, if a normal non-streaming
responsibility to do this. For example, if a non-streaming
function calls an ``__arm_streaming`` function, Clang generates code
that switches into streaming mode before calling the function and
switches back to non-streaming mode on return.
}];
}
``__arm_streaming`` can appear anywhere that a standard ``[[...]]`` type
attribute can appear.
def ArmSmeStreamingCompatibleDocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_streaming_compatible`` keyword applies to prototyped function types and
specifies that the function has a "streaming compatible interface". This
means that:
See `Arm C Language Extensions <https://github.com/ARM-software/acle>`_
for more details about this extension, and for other related SME features.
* the function may be entered in either non-streaming mode (PSTATE.SM=0) or
in streaming mode (PSTATE.SM=1).
* the function must return in the same mode as it was entered.
* the code executed in the function is compatible with either mode.
Clang manages PSTATE.SM automatically; it is not the source code's
responsibility to do this. Clang will ensure that the generated code in
streaming-compatible functions is valid in either mode (PSTATE.SM=0 or
PSTATE.SM=1). For example, if an ``__arm_streaming_compatible`` function calls a
non-streaming function, Clang generates code to temporarily switch out of streaming
mode before calling the function and switch back to streaming-mode on return if
``PSTATE.SM`` is ``1`` on entry of the caller. If ``PSTATE.SM`` is ``0`` on
entry to the ``__arm_streaming_compatible`` function, the call will be executed
without changing modes.
}];
}
def ArmSmeSharedZADocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_shared_za`` keyword applies to prototyped function types and specifies
that the function shares SME's matrix storage (ZA) with its caller. This
means that:
* the function requires that the processor implements the Scalable Matrix
Extension (SME).
* the function enters with ZA in an active state.
* the function returns with ZA in an active state.
}];
}
def ArmSmePreservesZADocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_preserves_za`` keyword applies to prototyped function types and
specifies that the function does not modify ZA state.
}];
}
def ArmSmeLocallyStreamingDocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_locally_streaming`` keyword applies to function declarations
and specifies that all the statements in the function are executed in
streaming mode. This means that:
* the function requires that the target processor implements the Scalable Matrix
Extension (SME).
* the program automatically puts the machine into streaming mode before
executing the statements and automatically restores the previous mode
afterwards.
Clang manages PSTATE.SM automatically; it is not the source code's
responsibility to do this. For example, Clang will emit code to enable
streaming mode at the start of the function, and disable streaming mode
at the end of the function.
}];
}
def ArmSmeNewZADocs : Documentation {
let Category = DocCatArmSmeAttributes;
let Content = [{
The ``__arm_new_za`` keyword applies to function declarations and specifies
that the function will be set up with a fresh ZA context.
This means that:
* the function requires that the target processor implements the Scalable Matrix
Extension (SME).
* the function will commit any lazily saved ZA data.
* the function will create a new ZA context and enable PSTATE.ZA.
* the function will disable PSTATE.ZA (by setting it to 0) before returning.
For ``__arm_new_za`` functions Clang will set up the ZA context automatically
on entry to the function, and disable it before returning. For example, if ZA is
in a dormant state Clang will generate the code to commit a lazy-save and set up
a new ZA state before executing user code.
}];
}
@ -6881,6 +7190,26 @@ The full documentation is available here: https://learn.microsoft.com/en-us/wind
}];
}
def HLSLParamQualifierDocs : Documentation {
let Category = DocCatVariable;
let Heading = "HLSL Parameter Modifiers";
let Content = [{
HLSL function parameters are passed by value. Parameter declarations support
three qualifiers to denote parameter passing behavior. The three qualifiers are
`in`, `out` and `inout`.
Parameters annotated with `in` or with no annotation are passed by value from
the caller to the callee.
Parameters annotated with `out` are written to the argument after the callee
returns (Note: arguments values passed into `out` parameters *are not* copied
into the callee).
Parameters annotated with `inout` are copied into the callee via a temporary,
and copied back to the argument after the callee returns.
}];
}
def AnnotateTypeDocs : Documentation {
let Category = DocCatType;
let Heading = "annotate_type";
@ -7051,8 +7380,71 @@ its underlying representation to be a WebAssembly ``funcref``.
}];
}
def PreferredTypeDocumentation : Documentation {
let Category = DocCatField;
let Content = [{
This attribute allows adjusting the type of a bit-field in debug information.
This can be helpful when a bit-field is intended to store an enumeration value,
but has to be specified as having the enumeration's underlying type in order to
facilitate compiler optimizations or bit-field packing behavior. Normally, the
underlying type is what is emitted in debug information, which can make it hard
for debuggers to know to map a bit-field's value back to a particular enumeration.
.. code-block:: c++
enum Colors { Red, Green, Blue };
struct S {
[[clang::preferred_type(Colors)]] unsigned ColorVal : 2;
[[clang::preferred_type(bool)]] unsigned UseAlternateColorSpace : 1;
} s = { Green, false };
Without the attribute, a debugger is likely to display the value ``1`` for ``ColorVal``
and ``0`` for ``UseAlternateColorSpace``. With the attribute, the debugger may now
display ``Green`` and ``false`` instead.
This can be used to map a bit-field to an arbitrary type that isn't integral
or an enumeration type. For example:
.. code-block:: c++
struct A {
short a1;
short a2;
};
struct B {
[[clang::preferred_type(A)]] unsigned b1 : 32 = 0x000F'000C;
};
will associate the type ``A`` with the ``b1`` bit-field and is intended to display
something like this in the debugger:
.. code-block:: text
Process 2755547 stopped
* thread #1, name = 'test-preferred-', stop reason = step in
frame #0: 0x0000555555555148 test-preferred-type`main at test.cxx:13:14
10 int main()
11 {
12 B b;
-> 13 return b.b1;
14 }
(lldb) v -T
(B) b = {
(A:32) b1 = {
(short) a1 = 12
(short) a2 = 15
}
}
Note that debuggers may not be able to handle more complex mappings, and so
this usage is debugger-dependent.
}];
}
def CleanupDocs : Documentation {
let Category = DocCatType;
let Category = DocCatVariable;
let Content = [{
This attribute allows a function to be run when a local variable goes out of
scope. The attribute takes the identifier of a function with a parameter type
@ -7077,3 +7469,322 @@ the variables were declared in. It is not possible to check the return value
(if any) of these ``cleanup`` callback functions.
}];
}
def CtorDtorDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
The ``constructor`` attribute causes the function to be called before entering
``main()``, and the ``destructor`` attribute causes the function to be called
after returning from ``main()`` or when the ``exit()`` function has been
called. Note, ``quick_exit()``, ``_Exit()``, and ``abort()`` prevent a function
marked ``destructor`` from being called.
The constructor or destructor function should not accept any arguments and its
return type should be ``void``.
The attributes accept an optional argument used to specify the priority order
in which to execute constructor and destructor functions. The priority is
given as an integer constant expression between 101 and 65535 (inclusive).
Priorities outside of that range are reserved for use by the implementation. A
lower value indicates a higher priority of initialization. Note that only the
relative ordering of values is important. For example:
.. code-block:: c++
__attribute__((constructor(200))) void foo(void);
__attribute__((constructor(101))) void bar(void);
``bar()`` will be called before ``foo()``, and both will be called before
``main()``. If no argument is given to the ``constructor`` or ``destructor``
attribute, they default to the value ``65535``.
}];
}
def CountedByDocs : Documentation {
let Category = DocCatField;
let Content = [{
Clang supports the ``counted_by`` attribute on the flexible array member of a
structure in C. The argument for the attribute is the name of a field member in
the same structure holding the count of elements in the flexible array. This
information can be used to improve the results of the array bound sanitizer and
the ``__builtin_dynamic_object_size`` builtin.
For example, the following code:
.. code-block:: c
struct bar;
struct foo {
size_t count;
char other;
struct bar *array[] __attribute__((counted_by(count)));
};
specifies that the flexible array member ``array`` has the number of elements
allocated for it stored in ``count``. This establishes a relationship between
``array`` and ``count``. Specifically, ``p->array`` must have at least
``p->count`` number of elements available. It's the user's responsibility to
ensure that this relationship is maintained through changes to the structure.
In the following example, the allocated array erroneously has fewer elements
than what's specified by ``p->count``. This would result in an out-of-bounds
access not being detected.
.. code-block:: c
#define SIZE_INCR 42
struct foo *p;
void foo_alloc(size_t count) {
p = malloc(MAX(sizeof(struct foo),
offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
p->count = count + SIZE_INCR;
}
The next example updates ``p->count``, breaking the relationship requirement
that ``p->array`` must have at least ``p->count`` number of elements available:
.. code-block:: c
#define SIZE_INCR 42
struct foo *p;
void foo_alloc(size_t count) {
p = malloc(MAX(sizeof(struct foo),
offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
p->count = count;
}
void use_foo(int index) {
p->count += SIZE_INCR + 1; /* 'count' is now larger than the number of elements of 'array'. */
p->array[index] = 0; /* the sanitizer can't properly check if this is an out-of-bounds access. */
}
}];
}
def CoroOnlyDestroyWhenCompleteDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
The `coro_only_destroy_when_complete` attribute should be marked on a C++ class. The coroutines
whose return type is marked with the attribute are assumed to be destroyed only after the coroutine has
reached the final suspend point.
This is helpful for the optimizers to reduce the size of the destroy function for the coroutines.
For example,
.. code-block:: c++
A foo() {
dtor d;
co_await something();
dtor d1;
co_await something();
dtor d2;
co_return 43;
}
The compiler may generate the following pseudocode:
.. code-block:: c++
void foo.destroy(foo.Frame *frame) {
switch(frame->suspend_index()) {
case 1:
frame->d.~dtor();
break;
case 2:
frame->d.~dtor();
frame->d1.~dtor();
break;
case 3:
frame->d.~dtor();
frame->d1.~dtor();
frame->d2.~dtor();
break;
default: // coroutine completed or haven't started
break;
}
frame->promise.~promise_type();
delete frame;
}
The `foo.destroy()` function's purpose is to release all of the resources
initialized for the coroutine when it is destroyed in a suspended state.
However, if the coroutine is only ever destroyed at the final suspend state,
the rest of the conditions are superfluous.
The user can use the `coro_only_destroy_when_complete` attributo suppress
generation of the other destruction cases, optimizing the above `foo.destroy` to:
.. code-block:: c++
void foo.destroy(foo.Frame *frame) {
frame->promise.~promise_type();
delete frame;
}
}];
}
def CoroReturnTypeAndWrapperDoc : Documentation {
let Category = DocCatDecl;
let Content = [{
The ``[[clang::coro_return_type]]`` attribute is used to help static analyzers to recognize
coroutines from the function signatures.
The ``coro_return_type`` attribute should be marked on a C++ class to mark it as
a **coroutine return type (CRT)**.
A function ``R func(P1, .., PN)`` has a coroutine return type (CRT) ``R`` if ``R``
is marked by ``[[clang::coro_return_type]]`` and ``R`` has a promise type associated to it
(i.e., std::coroutine_traits<R, P1, .., PN>::promise_type is a valid promise type).
If the return type of a function is a ``CRT`` then the function must be a coroutine.
Otherwise the program is invalid. It is allowed for a non-coroutine to return a ``CRT``
if the function is marked with ``[[clang::coro_wrapper]]``.
The ``[[clang::coro_wrapper]]`` attribute should be marked on a C++ function to mark it as
a **coroutine wrapper**. A coroutine wrapper is a function which returns a ``CRT``,
is not a coroutine itself and is marked with ``[[clang::coro_wrapper]]``.
Clang will enforce that all functions that return a ``CRT`` are either coroutines or marked
with ``[[clang::coro_wrapper]]``. Clang will enforce this with an error.
From a language perspective, it is not possible to differentiate between a coroutine and a
function returning a CRT by merely looking at the function signature.
Coroutine wrappers, in particular, are susceptible to capturing
references to temporaries and other lifetime issues. This allows to avoid such lifetime
issues with coroutine wrappers.
For example,
.. code-block:: c++
// This is a CRT.
template <typename T> struct [[clang::coro_return_type]] Task {
using promise_type = some_promise_type;
};
Task<int> increment(int a) { co_return a + 1; } // Fine. This is a coroutine.
Task<int> foo() { return increment(1); } // Error. foo is not a coroutine.
// Fine for a coroutine wrapper to return a CRT.
[[clang::coro_wrapper]] Task<int> foo() { return increment(1); }
void bar() {
// Invalid. This intantiates a function which returns a CRT but is not marked as
// a coroutine wrapper.
std::function<Task<int>(int)> f = increment;
}
Note: ``a_promise_type::get_return_object`` is exempted from this analysis as it is a necessary
implementation detail of any coroutine library.
}];
}
def CodeAlignAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "clang::code_align";
let Content = [{
The ``clang::code_align(N)`` attribute applies to a loop and specifies the byte
alignment for a loop. The attribute accepts a positive integer constant
initialization expression indicating the number of bytes for the minimum
alignment boundary. Its value must be a power of 2, between 1 and 4096
(inclusive).
.. code-block:: c++
void foo() {
int var = 0;
[[clang::code_align(16)]] for (int i = 0; i < 10; ++i) var++;
}
void Array(int *array, size_t n) {
[[clang::code_align(64)]] for (int i = 0; i < n; ++i) array[i] = 0;
}
void count () {
int a1[10], int i = 0;
[[clang::code_align(32)]] while (i < 10) { a1[i] += 3; }
}
void check() {
int a = 10;
[[clang::code_align(8)]] do {
a = a + 1;
} while (a < 20);
}
template<int A>
void func() {
[[clang::code_align(A)]] for(;;) { }
}
}];
}
def CoroLifetimeBoundDoc : Documentation {
let Category = DocCatDecl;
let Content = [{
The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied
to a coroutine return type (`CRT`_) (i.e.
it should also be annotated with ``[[clang::coro_return_type]]``).
All parameters of a function are considered to be lifetime bound. See `documentation`_
of ``[[clang::lifetimebound]]`` for more details.
if the function returns a coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``.
Reference parameters of a coroutine are susceptible to capturing references to temporaries or local variables.
For example,
.. code-block:: c++
task<int> coro(const int& a) { co_return a + 1; }
task<int> dangling_refs(int a) {
// `coro` captures reference to a temporary. `foo` would now contain a dangling reference to `a`.
auto foo = coro(1);
// `coro` captures reference to local variable `a` which is destroyed after the return.
return coro(a);
}
Lifetime bound static analysis can be used to detect such instances when coroutines capture references
which may die earlier than the coroutine frame itself. In the above example, if the CRT `task` is annotated with
``[[clang::coro_lifetimebound]]``, then lifetime bound analysis would detect capturing reference to
temporaries or return address of a local variable.
Both coroutines and coroutine wrappers are part of this analysis.
.. code-block:: c++
template <typename T> struct [[clang::coro_return_type, clang::coro_lifetimebound]] Task {
using promise_type = some_promise_type;
};
Task<int> coro(const int& a) { co_return a + 1; }
Task<int> [[clang::coro_wrapper]] coro_wrapper(const int& a, const int& b) {
return a > b ? coro(a) : coro(b);
}
Task<int> temporary_reference() {
auto foo = coro(1); // warning: capturing reference to a temporary which would die after the expression.
int a = 1;
auto bar = coro_wrapper(a, 0); // warning: `b` captures reference to a temporary.
co_return co_await coro(1); // fine.
}
[[clang::coro_wrapper]] Task<int> stack_reference(int a) {
return coro(a); // warning: returning address of stack variable `a`.
}
.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
}];
}

View file

@ -9,10 +9,12 @@
#ifndef LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H
#define LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseMap.h"
namespace clang {
class SourceRange;
namespace attr {
/// A list of all the recognized kinds of attributes.

View file

@ -13,12 +13,14 @@
#ifndef LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
#define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TokenKinds.h"
namespace clang {
class IdentifierInfo;
class ASTRecordWriter;
class IdentifierInfo;
class AttributeCommonInfo {
public:
@ -31,7 +33,7 @@ public:
AS_CXX11,
/// [[...]]
AS_C2x,
AS_C23,
/// __declspec(...)
AS_Declspec,
@ -72,11 +74,16 @@ private:
SourceRange AttrRange;
const SourceLocation ScopeLoc;
// Corresponds to the Kind enum.
LLVM_PREFERRED_TYPE(Kind)
unsigned AttrKind : 16;
/// Corresponds to the Syntax enum.
LLVM_PREFERRED_TYPE(Syntax)
unsigned SyntaxUsed : 4;
LLVM_PREFERRED_TYPE(bool)
unsigned SpellingIndex : 4;
LLVM_PREFERRED_TYPE(bool)
unsigned IsAlignas : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IsRegularKeywordAttribute : 1;
protected:
@ -104,7 +111,7 @@ public:
static Form GNU() { return AS_GNU; }
static Form CXX11() { return AS_CXX11; }
static Form C2x() { return AS_C2x; }
static Form C23() { return AS_C23; }
static Form Declspec() { return AS_Declspec; }
static Form Microsoft() { return AS_Microsoft; }
static Form Keyword(bool IsAlignas, bool IsRegularKeywordAttribute) {
@ -121,9 +128,12 @@ public:
: SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingNotCalculated),
IsAlignas(0), IsRegularKeywordAttribute(0) {}
LLVM_PREFERRED_TYPE(Syntax)
unsigned SyntaxUsed : 4;
unsigned SpellingIndex : 4;
LLVM_PREFERRED_TYPE(bool)
unsigned IsAlignas : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IsRegularKeywordAttribute : 1;
};
@ -167,6 +177,7 @@ public:
IsRegularKeywordAttribute);
}
const IdentifierInfo *getAttrName() const { return AttrName; }
void setAttrName(const IdentifierInfo *AttrNameII) { AttrName = AttrNameII; }
SourceLocation getLoc() const { return AttrRange.getBegin(); }
SourceRange getRange() const { return AttrRange; }
void setRange(SourceRange R) { AttrRange = R; }
@ -188,12 +199,21 @@ public:
bool isCXX11Attribute() const { return SyntaxUsed == AS_CXX11 || IsAlignas; }
bool isC2xAttribute() const { return SyntaxUsed == AS_C2x; }
bool isC23Attribute() const { return SyntaxUsed == AS_C23; }
bool isAlignas() const {
// FIXME: In the current state, the IsAlignas member variable is only true
// with the C++ `alignas` keyword but not `_Alignas`. The following
// expression works around the otherwise lost information so it will return
// true for `alignas` or `_Alignas` while still returning false for things
// like `__attribute__((aligned))`.
return (getParsedKind() == AT_Aligned && isKeywordAttribute());
}
/// The attribute is spelled [[]] in either C or C++ mode, including standard
/// attributes spelled with a keyword, like alignas.
bool isStandardAttributeSyntax() const {
return isCXX11Attribute() || isC2xAttribute();
return isCXX11Attribute() || isC23Attribute();
}
bool isGNUAttribute() const { return SyntaxUsed == AS_GNU; }

View file

@ -10,12 +10,12 @@
#define LLVM_CLANG_BASIC_ATTRIBUTES_H
#include "clang/Basic/AttributeCommonInfo.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/TargetInfo.h"
namespace clang {
class IdentifierInfo;
class LangOptions;
class TargetInfo;
/// Return the version number associated with the attribute if we
/// recognize and implement the attribute specified by the given information.

View file

@ -245,6 +245,11 @@ BUILTIN(__builtin_exp2f, "ff" , "Fne")
BUILTIN(__builtin_exp2f16, "hh" , "Fne")
BUILTIN(__builtin_exp2l, "LdLd", "Fne")
BUILTIN(__builtin_exp2f128, "LLdLLd" , "Fne")
BUILTIN(__builtin_exp10 , "dd" , "Fne")
BUILTIN(__builtin_exp10f, "ff" , "Fne")
BUILTIN(__builtin_exp10f16, "hh" , "Fne")
BUILTIN(__builtin_exp10l, "LdLd", "Fne")
BUILTIN(__builtin_exp10f128, "LLdLLd" , "Fne")
BUILTIN(__builtin_expm1 , "dd", "Fne")
BUILTIN(__builtin_expm1f, "ff", "Fne")
BUILTIN(__builtin_expm1l, "LdLd", "Fne")
@ -489,6 +494,9 @@ BUILTIN(__builtin_isinf, "i.", "FnctE")
BUILTIN(__builtin_isinf_sign, "i.", "FnctE")
BUILTIN(__builtin_isnan, "i.", "FnctE")
BUILTIN(__builtin_isnormal, "i.", "FnctE")
BUILTIN(__builtin_issubnormal,"i.", "FnctE")
BUILTIN(__builtin_iszero, "i.", "FnctE")
BUILTIN(__builtin_issignaling,"i.", "FnctE")
BUILTIN(__builtin_isfpclass, "i.", "nctE")
// FP signbit builtins
@ -560,7 +568,7 @@ BUILTIN(__builtin_va_copy, "vAA", "n")
BUILTIN(__builtin_stdarg_start, "vA.", "nt")
BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nctE")
BUILTIN(__builtin_bcmp, "ivC*vC*z", "FnE")
BUILTIN(__builtin_bcopy, "vv*v*z", "n")
BUILTIN(__builtin_bcopy, "vvC*v*z", "nF")
BUILTIN(__builtin_bzero, "vv*z", "nF")
BUILTIN(__builtin_free, "vv*", "nF")
BUILTIN(__builtin_malloc, "v*z", "nF")
@ -669,6 +677,7 @@ BUILTIN(__builtin_debugtrap, "v", "n")
BUILTIN(__builtin_unreachable, "v", "nr")
BUILTIN(__builtin_shufflevector, "v." , "nct")
BUILTIN(__builtin_convertvector, "v." , "nct")
BUILTIN(__builtin_vectorelements, "v." , "nct")
BUILTIN(__builtin_alloca, "v*z" , "Fn")
BUILTIN(__builtin_alloca_uninitialized, "v*z", "Fn")
BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn")
@ -677,6 +686,7 @@ BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
BUILTIN(__builtin_nondeterministic_value, "v.", "nt")
BUILTIN(__builtin_elementwise_abs, "v.", "nct")
BUILTIN(__builtin_elementwise_bitreverse, "v.", "nct")
BUILTIN(__builtin_elementwise_max, "v.", "nct")
BUILTIN(__builtin_elementwise_min, "v.", "nct")
BUILTIN(__builtin_elementwise_ceil, "v.", "nct")
@ -693,6 +703,7 @@ BUILTIN(__builtin_elementwise_round, "v.", "nct")
BUILTIN(__builtin_elementwise_rint, "v.", "nct")
BUILTIN(__builtin_elementwise_nearbyint, "v.", "nct")
BUILTIN(__builtin_elementwise_sin, "v.", "nct")
BUILTIN(__builtin_elementwise_sqrt, "v.", "nct")
BUILTIN(__builtin_elementwise_trunc, "v.", "nct")
BUILTIN(__builtin_elementwise_canonicalize, "v.", "nct")
BUILTIN(__builtin_elementwise_copysign, "v.", "nct")
@ -893,6 +904,32 @@ BUILTIN(__atomic_signal_fence, "vi", "n")
BUILTIN(__atomic_always_lock_free, "bzvCD*", "nE")
BUILTIN(__atomic_is_lock_free, "bzvCD*", "nE")
// GNU atomic builtins with atomic scopes.
ATOMIC_BUILTIN(__scoped_atomic_load, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_load_n, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_store, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_store_n, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_exchange, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_exchange_n, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_compare_exchange, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_compare_exchange_n, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_add, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_sub, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_and, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_or, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_xor, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_nand, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_add_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_sub_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_and_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_or_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_xor_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_max_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_min_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_nand_fetch, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_min, "v.", "t")
ATOMIC_BUILTIN(__scoped_atomic_fetch_max, "v.", "t")
// OpenCL 2.0 atomic builtins.
ATOMIC_BUILTIN(__opencl_atomic_init, "v.", "t")
ATOMIC_BUILTIN(__opencl_atomic_load, "v.", "t")
@ -1015,12 +1052,12 @@ LANGBUILTIN(__iso_volatile_store16, "vsD*s", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_store32, "viD*i", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt16, "UsUs", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt, "UiUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt64, "UWiUWi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt16, "UsUs", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt, "UiUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt64, "UWiUWi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt16, "UsUs", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt, "UiUi", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt64, "UWiUWi", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt16, "UsUs", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt, "UiUi", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(__popcnt64, "UWiUWi", "ncE", ALL_MS_LANGUAGES)
LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(_rotl8, "UcUcUc", "nE", ALL_MS_LANGUAGES)
LANGBUILTIN(_rotl16, "UsUsUc", "nE", ALL_MS_LANGUAGES)
@ -1154,6 +1191,7 @@ LIBBUILTIN(strndup, "c*cC*z", "f", STRING_H, ALL_GNU_LANGUAGES)
LIBBUILTIN(index, "c*cC*i", "f", STRINGS_H, ALL_GNU_LANGUAGES)
LIBBUILTIN(rindex, "c*cC*i", "f", STRINGS_H, ALL_GNU_LANGUAGES)
LIBBUILTIN(bzero, "vv*z", "f", STRINGS_H, ALL_GNU_LANGUAGES)
LIBBUILTIN(bcopy, "vvC*v*z", "f", STRINGS_H, ALL_GNU_LANGUAGES)
LIBBUILTIN(bcmp, "ivC*vC*z", "fE", STRINGS_H, ALL_GNU_LANGUAGES)
// In some systems str[n]casejmp is a macro that expands to _str[n]icmp.
// We undefine then here to avoid wrong name.

View file

@ -259,7 +259,6 @@ TARGET_HEADER_BUILTIN(__umulh, "ULLiULLiULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES,
TARGET_HEADER_BUILTIN(__break, "vi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__writex18byte, "vUNiUc", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__writex18word, "vUNiUs", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__writex18dword, "vUNiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
@ -270,6 +269,22 @@ TARGET_HEADER_BUILTIN(__readx18word, "UsUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES,
TARGET_HEADER_BUILTIN(__readx18dword, "UNiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__readx18qword, "ULLiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CopyDoubleFromInt64, "dSLLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CopyFloatFromInt32, "fSi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CopyInt32FromFloat, "Sif", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CopyInt64FromDouble, "SLLid", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingOnes, "UiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingOnes64, "UiULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingSigns, "UiSNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingSigns64, "UiSLLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingZeros, "UiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountLeadingZeros64, "UiULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountOneBits, "UiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_CountOneBits64, "UiULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__prefetch, "vv*", "nh", INTRIN_H, ALL_MS_LANGUAGES, "")
#undef BUILTIN
#undef LANGBUILTIN
#undef TARGET_BUILTIN

View file

@ -67,11 +67,6 @@ BUILTIN(__builtin_amdgcn_sched_group_barrier, "vIiIiIi", "n")
BUILTIN(__builtin_amdgcn_iglp_opt, "vIi", "n")
BUILTIN(__builtin_amdgcn_s_dcache_inv, "v", "n")
BUILTIN(__builtin_amdgcn_buffer_wbinvl1, "v", "n")
BUILTIN(__builtin_amdgcn_ds_gws_init, "vUiUi", "n")
BUILTIN(__builtin_amdgcn_ds_gws_barrier, "vUiUi", "n")
BUILTIN(__builtin_amdgcn_ds_gws_sema_v, "vUi", "n")
BUILTIN(__builtin_amdgcn_ds_gws_sema_br, "vUiUi", "n")
BUILTIN(__builtin_amdgcn_ds_gws_sema_p, "vUi", "n")
BUILTIN(__builtin_amdgcn_fence, "vUicC*", "n")
BUILTIN(__builtin_amdgcn_groupstaticsize, "Ui", "n")
@ -155,8 +150,8 @@ BUILTIN(__builtin_amdgcn_mqsad_u32_u8, "V4UiWUiUiV4Ui", "nc")
// Ballot builtins.
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_amdgcn_ballot_w32, "Uib", "nc", "wavefrontsize32")
TARGET_BUILTIN(__builtin_amdgcn_ballot_w64, "LUib", "nc", "wavefrontsize64")
TARGET_BUILTIN(__builtin_amdgcn_ballot_w32, "ZUib", "nc", "wavefrontsize32")
TARGET_BUILTIN(__builtin_amdgcn_ballot_w64, "WUib", "nc", "wavefrontsize64")
// Deprecated intrinsics in favor of __builtin_amdgn_ballot_{w32|w64}
BUILTIN(__builtin_amdgcn_uicmp, "WUiUiUiIi", "nc")
@ -172,6 +167,15 @@ BUILTIN(__builtin_amdgcn_fcmpf, "WUiffIi", "nc")
BUILTIN(__builtin_amdgcn_is_shared, "bvC*0", "nc")
BUILTIN(__builtin_amdgcn_is_private, "bvC*0", "nc")
//===----------------------------------------------------------------------===//
// GWS builtins.
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_init, "vUiUi", "n", "gws")
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_barrier, "vUiUi", "n", "gws")
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_sema_v, "vUi", "n", "gws")
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_sema_br, "vUiUi", "n", "gws")
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_sema_p, "vUi", "n", "gws")
//===----------------------------------------------------------------------===//
// CI+ only builtins.
//===----------------------------------------------------------------------===//
@ -288,6 +292,8 @@ TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x16_f16_w32, "V8fV16hV16hV8f", "nc
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x16_bf16_w32, "V8fV16sV16sV8f", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_f16_16x16x16_f16_w32, "V16hV16hV16hV16hIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_bf16_16x16x16_bf16_w32, "V16sV16sV16sV16sIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_f16_16x16x16_f16_tied_w32, "V16hV16hV16hV16hIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_bf16_16x16x16_bf16_tied_w32, "V16sV16sV16sV16sIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_i32_16x16x16_iu8_w32, "V8iIbV4iIbV4iV8iIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_i32_16x16x16_iu4_w32, "V8iIbV2iIbV2iV8iIb", "nc", "gfx11-insts")
@ -295,6 +301,8 @@ TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x16_f16_w64, "V4fV16hV16hV4f", "nc
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x16_bf16_w64, "V4fV16sV16sV4f", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_f16_16x16x16_f16_w64, "V8hV16hV16hV8hIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_bf16_16x16x16_bf16_w64, "V8sV16sV16sV8sIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_f16_16x16x16_f16_tied_w64, "V8hV16hV16hV8hIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_bf16_16x16x16_bf16_tied_w64, "V8sV16sV16sV8sIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_i32_16x16x16_iu8_w64, "V4iIbV4iIbV4iV4iIb", "nc", "gfx11-insts")
TARGET_BUILTIN(__builtin_amdgcn_wmma_i32_16x16x16_iu4_w64, "V4iIbV2iIbV2iV4iIb", "nc", "gfx11-insts")
@ -398,5 +406,23 @@ TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_fp8_f32, "iffiIb", "nc", "fp8-insts")
TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_bf8_f32, "ifiiIi", "nc", "fp8-insts")
TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_fp8_f32, "ifiiIi", "nc", "fp8-insts")
//===----------------------------------------------------------------------===//
// GFX12+ only builtins.
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_amdgcn_permlane16_var, "UiUiUiUiIbIb", "nc", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_permlanex16_var, "UiUiUiUiIbIb", "nc", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal, "vIi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal_var, "vi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_wait, "vIs", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal_isfirst, "bIi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal_isfirst_var, "bi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_init, "vii", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_join, "vi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_wakeup_barrier, "vi", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_leave, "b", "n", "gfx12-insts")
TARGET_BUILTIN(__builtin_amdgcn_s_get_barrier_state, "Uii", "n", "gfx12-insts")
#undef BUILTIN
#undef TARGET_BUILTIN

View file

@ -15,47 +15,14 @@
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
#endif
// TODO: Support more builtins.
// TODO: Added feature constraints.
TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vLiULiLi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vLiLi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vLiLi", "nc", "64bit")
// Definition of LoongArch basic builtins.
#include "clang/Basic/BuiltinsLoongArchBase.def"
TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iLii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iLii", "nc", "64bit")
// Definition of LSX builtins.
#include "clang/Basic/BuiltinsLoongArchLSX.def"
TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "ULiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "ULiULiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "ULiULiULiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "ULiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vULiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_lddir_d, "LiLiIULi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vLiIULi", "nc", "64bit")
// Definition of LASX builtins.
#include "clang/Basic/BuiltinsLoongArchLASX.def"
#undef BUILTIN
#undef TARGET_BUILTIN

View file

@ -0,0 +1,53 @@
//============------------ BuiltinsLoongArchBase.def -------------*- C++ -*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the LoongArch-specific basic builtin function database.
// Users of this file must define the BUILTIN macro to make use of this
// information.
//
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vWiUWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iWii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iWii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "UWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "UWiUWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "UWiUWiUWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "UWiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vUWiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_lddir_d, "WiWiIUWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vWiIUWi", "nc", "64bit")

View file

@ -0,0 +1,982 @@
//=BuiltinsLoongArchLASX.def - LoongArch Builtin function database -- C++ -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the LoongArch-specific LASX builtin function database.
// Users of this file must define the BUILTIN macro to make use of this
// information.
//
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_lasx_xvadd_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadd_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadd_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadd_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadd_q, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsub_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsub_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsub_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsub_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsub_q, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddi_bu, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddi_hu, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddi_wu, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddi_du, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubi_bu, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubi_hu, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubi_wu, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubi_du, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvneg_b, "V32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvneg_h, "V16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvneg_w, "V8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvneg_d, "V4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsadd_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssub_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_h_b, "V16SsV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_w_h, "V8SiV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_d_w, "V4SLLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_hu_bu, "V16UsV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_wu_hu, "V8UiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_du_wu, "V4ULLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhaddw_qu_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_h_b, "V16SsV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_w_h, "V8SiV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_d_w, "V4SLLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_hu_bu, "V16UsV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_wu_hu, "V8UiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_du_wu, "V4ULLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvhsubw_qu_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwev_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsubwod_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_h_bu_b, "V16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_w_hu_h, "V8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_d_wu_w, "V4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwev_q_du_d, "V4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_h_bu_b, "V16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_w_hu_h, "V8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_d_wu_w, "V4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvaddwod_q_du_d, "V4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavg_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvavgr_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvabsd_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadda_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadda_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadda_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvadda_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_b, "V32ScV32ScIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_h, "V16SsV16SsIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_w, "V8SiV8SiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_d, "V4SLLiV4SLLiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmax_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_bu, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_hu, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_wu, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaxi_du, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_b, "V32ScV32ScIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_h, "V16SsV16SsIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_w, "V8SiV8SiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_d, "V4SLLiV4SLLiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmin_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_bu, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_hu, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_wu, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmini_du, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmul_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmul_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmul_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmul_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmuh_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_h_b, "V16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_w_h, "V8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_d_w, "V4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_q_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_h_bu, "V16sV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_w_hu, "V8SiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_d_wu, "V4LLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_q_du, "V4LLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_h_bu_b, "V16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_w_hu_h, "V8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_d_wu_w, "V4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwev_q_du_d, "V4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_h_bu_b, "V16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_w_hu_h, "V8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_d_wu_w, "V4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmulwod_q_du_d, "V4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmadd_b, "V32ScV32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmadd_h, "V16SsV16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmadd_w, "V8SiV8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmadd_d, "V4SLLiV4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmsub_b, "V32ScV32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmsub_h, "V16SsV16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmsub_w, "V8SiV8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmsub_d, "V4SLLiV4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_h_b, "V16sV16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_w_h, "V8SiV8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_d_w, "V4LLiV4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_q_d, "V4LLiV4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_h_b, "V16sV16sV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_w_h, "V8SiV8SiV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_d_w, "V4LLiV4LLiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_q_d, "V4LLiV4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_h_bu, "V16UsV16UsV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_w_hu, "V8UiV8UiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_d_wu, "V4ULLiV4ULLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_q_du, "V4ULLiV4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_h_bu, "V16UsV16UsV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_w_hu, "V8UiV8UiV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_d_wu, "V4ULLiV4ULLiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_q_du, "V4ULLiV4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_h_bu_b, "V16sV16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_w_hu_h, "V8SiV8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_d_wu_w, "V4LLiV4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwev_q_du_d, "V4LLiV4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_h_bu_b, "V16sV16sV32UcV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_w_hu_h, "V8SiV8SiV16UsV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_d_wu_w, "V4LLiV4LLiV8UiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmaddwod_q_du_d, "V4LLiV4LLiV4ULLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvdiv_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_bu, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_hu, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_wu, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmod_du, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_b, "V32ScV32ScIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_h, "V16SsV16SsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_w, "V8SiV8SiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_d, "V4SLLiV4SLLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_bu, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_hu, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_wu, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsat_du, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_h_b, "V16sV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_w_h, "V8SiV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_d_w, "V4LLiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_q_d, "V4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_hu_bu, "V16UsV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_wu_hu, "V8UiV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_du_wu, "V4ULLiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvexth_qu_du, "V4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_h_b, "V16sV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_w_b, "V8SiV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_d_b, "V4LLiV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_w_h, "V8SiV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_d_h, "V4LLiV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_d_w, "V4LLiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_hu_bu, "V16sV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_wu_bu, "V8SiV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_du_bu, "V4LLiV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_wu_hu, "V8SiV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_du_hu, "V4LLiV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_vext2xv_du_wu, "V4LLiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsigncov_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsigncov_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsigncov_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsigncov_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmskltz_b, "V32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmskltz_h, "V16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmskltz_w, "V8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmskltz_d, "V4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmskgez_b, "V32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvmsknz_b, "V16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldi, "V4LLiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepli_b, "V32cIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepli_h, "V16sIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepli_w, "V8iIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepli_d, "V4LLiIi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvand_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvor_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvxor_v, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvnor_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvandn_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvorn_v, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvandi_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvori_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvxori_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvnori_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsll_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsll_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsll_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsll_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslli_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslli_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslli_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslli_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrl_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrl_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrl_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrl_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrli_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrli_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrli_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrli_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsra_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsra_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsra_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsra_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrai_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrai_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrai_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrai_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotr_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotr_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotr_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotr_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotri_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotri_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotri_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrotri_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_h_b, "V16sV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_w_h, "V8SiV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_d_w, "V4LLiV8SiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextl_q_d, "V4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_hu_bu, "V16UsV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_wu_hu, "V8UiV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsllwil_du_wu, "V4ULLiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextl_qu_du, "V4LLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlr_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlr_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlr_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlr_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlri_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlri_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlri_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlri_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrar_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrar_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrar_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrar_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrari_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrari_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrari_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrari_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrln_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrln_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrln_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsran_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsran_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsran_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrani_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrani_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrani_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrani_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrn_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrn_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrn_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarn_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarn_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarn_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrlrni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsrarni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_bu_h, "V32UcV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_hu_w, "V16UsV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrln_wu_d, "V8UiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_bu_h, "V32UcV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_hu_w, "V16UsV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssran_wu_d, "V8UiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_bu_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_hu_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_wu_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_du_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_bu_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_hu_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_wu_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrani_du_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_b_h, "V32ScV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_h_w, "V16sV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_w_d, "V8SiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_bu_h, "V32UcV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_hu_w, "V16UsV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrn_wu_d, "V8UiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_bu_h, "V32UcV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_hu_w, "V16UsV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarn_wu_d, "V8UiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlrni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_b_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_h_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_w_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_d_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_bu_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_hu_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_wu_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrlni_du_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_bu_h, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_hu_w, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_wu_d, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvssrarni_du_q, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclo_b, "V32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclo_h, "V16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclo_w, "V8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclo_d, "V4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclz_b, "V32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclz_h, "V16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclz_w, "V8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvclz_d, "V4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpcnt_b, "V32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpcnt_h, "V16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpcnt_w, "V8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpcnt_d, "V4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclr_b, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclr_h, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclr_w, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclr_d, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclri_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclri_h, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclri_w, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitclri_d, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitset_b, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitset_h, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitset_w, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitset_d, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitseti_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitseti_h, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitseti_w, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitseti_d, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrev_b, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrev_h, "V16UsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrev_w, "V8UiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrev_d, "V4ULLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrevi_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrevi_h, "V16UsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrevi_w, "V8UiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitrevi_d, "V4ULLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrstp_b, "V32ScV32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrstp_h, "V16SsV16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrstpi_b, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrstpi_h, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfadd_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfadd_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfsub_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfsub_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmul_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmul_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfdiv_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfdiv_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmadd_s, "V8fV8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmadd_d, "V4dV4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmsub_s, "V8fV8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmsub_d, "V4dV4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfnmadd_s, "V8fV8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfnmadd_d, "V4dV4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfnmsub_s, "V8fV8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfnmsub_d, "V4dV4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmax_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmax_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmin_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmin_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmaxa_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmaxa_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmina_s, "V8fV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfmina_d, "V4dV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvflogb_s, "V8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvflogb_d, "V4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfclass_s, "V8iV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfclass_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfsqrt_s, "V8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfsqrt_d, "V4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrecip_s, "V8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrecip_d, "V4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrsqrt_s, "V8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrsqrt_d, "V4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvtl_s_h, "V8fV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvth_s_h, "V8fV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvtl_d_s, "V4dV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvth_d_s, "V4dV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvt_h_s, "V16sV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcvt_s_d, "V8fV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrne_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrne_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrz_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrz_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrp_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrp_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrm_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrintrm_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrint_s, "V8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfrint_d, "V4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrne_w_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrne_l_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrz_w_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrz_l_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrp_w_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrp_l_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrm_w_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrm_l_d, "V4LLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftint_w_s, "V8SiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftint_l_d, "V4SLLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrz_wu_s, "V8UiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrz_lu_d, "V4ULLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftint_wu_s, "V8UiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftint_lu_d, "V4ULLiV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrne_w_d, "V8SiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrz_w_d, "V8SiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrp_w_d, "V8SiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrm_w_d, "V8SiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftint_w_d, "V8SiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrnel_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrneh_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrzl_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrzh_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrpl_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrph_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrml_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintrmh_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftintl_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvftinth_l_s, "V4LLiV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffint_s_w, "V8fV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffint_d_l, "V4dV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffint_s_wu, "V8fV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffint_d_lu, "V4dV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffintl_d_w, "V4dV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffinth_d_w, "V4dV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvffint_s_l, "V8fV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseq_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseq_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseq_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseq_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseqi_b, "V32ScV32ScISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseqi_h, "V16SsV16SsISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseqi_w, "V8SiV8SiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvseqi_d, "V4SLLiV4SLLiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_b, "V32ScV32ScISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_h, "V16SsV16SsISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_w, "V8SiV8SiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_d, "V4SLLiV4SLLiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_bu, "V32ScV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_hu, "V16SsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_wu, "V8SiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvsle_du, "V4SLLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_bu, "V32ScV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_hu, "V16SsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_wu, "V8SiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslei_du, "V4SLLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_b, "V32ScV32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_h, "V16SsV16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_w, "V8SiV8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_d, "V4SLLiV4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_b, "V32ScV32ScISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_h, "V16SsV16SsISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_w, "V8SiV8SiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_d, "V4SLLiV4SLLiISi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_bu, "V32ScV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_hu, "V16SsV16UsV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_wu, "V8SiV8UiV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslt_du, "V4SLLiV4ULLiV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_bu, "V32ScV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_hu, "V16SsV16UsIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_wu, "V8SiV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvslti_du, "V4SLLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_caf_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_caf_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cun_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cun_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_ceq_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_ceq_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cueq_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cueq_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_clt_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_clt_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cult_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cult_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cle_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cle_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cule_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cule_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cne_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cne_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cor_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cor_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cune_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_cune_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_saf_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_saf_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sun_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sun_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_seq_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_seq_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sueq_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sueq_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_slt_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_slt_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sult_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sult_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sle_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sle_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sule_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sule_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sne_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sne_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sor_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sor_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sune_s, "V8SiV8fV8f", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvfcmp_sune_d, "V4SLLiV4dV4d", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitsel_v, "V32UcV32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbitseli_b, "V32UcV32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplgr2vr_b, "V32Sci", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplgr2vr_h, "V16Ssi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplgr2vr_w, "V8Sii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplgr2vr_d, "V4SLLiLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvinsgr2vr_w, "V8SiV8SiiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvinsgr2vr_d, "V4SLLiV4SLLiLLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve2gr_w, "iV8SiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve2gr_d, "LLiV4SLLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve2gr_wu, "iV8UiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve2gr_du, "LLiV4ULLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve_b, "V32cV32cUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve_h, "V16sV16sUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve_w, "V8iV8iUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve_d, "V4LLiV4LLiUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepl128vei_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepl128vei_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepl128vei_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvrepl128vei_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve0_b, "V32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve0_h, "V16SsV16Ss", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve0_w, "V8SiV8Si", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve0_d, "V4SLLiV4SLLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvreplve0_q, "V32ScV32Sc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvinsve0_w, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvinsve0_d, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve_w_f, "V8fV8fIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickve_d_f, "V4dV4dIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbsll_v, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvbsrl_v, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackev_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackev_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackev_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackev_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackod_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackod_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackod_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpackod_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickev_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickev_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickev_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickev_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickod_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickod_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickod_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpickod_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvl_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvl_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvl_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvl_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvh_b, "V32cV32cV32c", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvh_h, "V16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvh_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvilvh_d, "V4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf_b, "V32UcV32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf_h, "V16sV16sV16sV16s", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf_w, "V8iV8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf_d, "V4LLiV4LLiV4LLiV4LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvperm_w, "V8iV8iV8i", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf4i_b, "V32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf4i_h, "V16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf4i_w, "V8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvshuf4i_d, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpermi_w, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpermi_d, "V4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvpermi_q, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextrins_b, "V32cV32cV32cIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextrins_h, "V16sV16sV16sIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextrins_w, "V8iV8iV8iIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvextrins_d, "V4LLiV4LLiV4LLiIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvld, "V32ScvC*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvst, "vV32Scv*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldx, "V32ScvC*LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvstx, "vV32Scv*LLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldrepl_b, "V32cvC*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldrepl_h, "V16svC*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldrepl_w, "V8ivC*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvldrepl_d, "V4LLivC*Ii", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvstelm_b, "vV32Scv*IiUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvstelm_h, "vV16Ssv*IiUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvstelm_w, "vV8Siv*IiUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvstelm_d, "vV4SLLiv*IiUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbz_v, "iV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbnz_v, "iV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbz_b, "iV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbz_h, "iV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbz_w, "iV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbz_d, "iV4ULLi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbnz_b, "iV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbnz_h, "iV16Us", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbnz_w, "iV8Ui", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xbnz_d, "iV4ULLi", "nc", "lasx")

View file

@ -0,0 +1,953 @@
//=============------------- BuiltinsLoongArchLSX.def --------------- C++ -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the LoongArch-specific LSX builtin function database.
// Users of this file must define the BUILTIN macro to make use of this
// information.
//
//===----------------------------------------------------------------------===//
TARGET_BUILTIN(__builtin_lsx_vadd_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadd_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadd_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadd_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadd_q, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsub_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsub_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsub_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsub_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsub_q, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddi_bu, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddi_hu, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddi_wu, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddi_du, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubi_bu, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubi_hu, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubi_wu, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubi_du, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vneg_b, "V16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vneg_h, "V8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vneg_w, "V4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vneg_d, "V2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsadd_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssub_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_h_b, "V8SsV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_w_h, "V4SiV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_d_w, "V2SLLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_hu_bu, "V8UsV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_wu_hu, "V4UiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_du_wu, "V2ULLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhaddw_qu_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_h_b, "V8SsV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_w_h, "V4SiV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_d_w, "V2SLLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_hu_bu, "V8UsV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_wu_hu, "V4UiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_du_wu, "V2ULLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vhsubw_qu_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwev_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsubwod_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_h_bu_b, "V8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_w_hu_h, "V4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_d_wu_w, "V2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwev_q_du_d, "V2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_h_bu_b, "V8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_w_hu_h, "V4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_d_wu_w, "V2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vaddwod_q_du_d, "V2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavg_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vavgr_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vabsd_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadda_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadda_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadda_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vadda_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_b, "V16ScV16ScIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_h, "V8SsV8SsIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_w, "V4SiV4SiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_d, "V2SLLiV2SLLiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmax_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_bu, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_hu, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_wu, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaxi_du, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_b, "V16ScV16ScIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_h, "V8SsV8SsIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_w, "V4SiV4SiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_d, "V2SLLiV2SLLiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmin_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_bu, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_hu, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_wu, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmini_du, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmul_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmul_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmul_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmul_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmuh_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_h_b, "V8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_w_h, "V4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_d_w, "V2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_q_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_h_bu, "V8sV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_w_hu, "V4SiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_d_wu, "V2LLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_q_du, "V2LLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_h_bu_b, "V8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_w_hu_h, "V4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_d_wu_w, "V2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwev_q_du_d, "V2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_h_bu_b, "V8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_w_hu_h, "V4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_d_wu_w, "V2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmulwod_q_du_d, "V2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmadd_b, "V16ScV16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmadd_h, "V8SsV8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmadd_w, "V4SiV4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmadd_d, "V2SLLiV2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmsub_b, "V16ScV16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmsub_h, "V8SsV8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmsub_w, "V4SiV4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmsub_d, "V2SLLiV2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_h_b, "V8sV8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_w_h, "V4SiV4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_d_w, "V2LLiV2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_q_d, "V2LLiV2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_h_b, "V8sV8sV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_w_h, "V4SiV4SiV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_d_w, "V2LLiV2LLiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_q_d, "V2LLiV2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_h_bu, "V8UsV8UsV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_w_hu, "V4UiV4UiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_d_wu, "V2ULLiV2ULLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_q_du, "V2ULLiV2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_h_bu, "V8UsV8UsV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_w_hu, "V4UiV4UiV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_d_wu, "V2ULLiV2ULLiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_q_du, "V2ULLiV2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_h_bu_b, "V8sV8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_w_hu_h, "V4SiV4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_d_wu_w, "V2LLiV2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwev_q_du_d, "V2LLiV2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_h_bu_b, "V8sV8sV16UcV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_w_hu_h, "V4SiV4SiV8UsV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_d_wu_w, "V2LLiV2LLiV4UiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmaddwod_q_du_d, "V2LLiV2LLiV2ULLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vdiv_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_bu, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_hu, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_wu, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmod_du, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_b, "V16ScV16ScIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_h, "V8SsV8SsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_w, "V4SiV4SiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_d, "V2SLLiV2SLLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_bu, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_hu, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_wu, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsat_du, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_h_b, "V8sV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_w_h, "V4SiV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_d_w, "V2LLiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_q_d, "V2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_hu_bu, "V8UsV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_wu_hu, "V4UiV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_du_wu, "V2ULLiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vexth_qu_du, "V2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsigncov_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsigncov_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsigncov_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsigncov_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmskltz_b, "V16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmskltz_h, "V8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmskltz_w, "V4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmskltz_d, "V2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmskgez_b, "V16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vmsknz_b, "V8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldi, "V2LLiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrepli_b, "V16cIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrepli_h, "V8sIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrepli_w, "V4iIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrepli_d, "V2LLiIi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vand_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vor_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vxor_v, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vnor_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vandn_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vorn_v, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vandi_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vori_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vxori_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vnori_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsll_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsll_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsll_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsll_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslli_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslli_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslli_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslli_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrl_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrl_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrl_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrl_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrli_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrli_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrli_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrli_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsra_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsra_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsra_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsra_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrai_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrai_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrai_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrai_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotr_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotr_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotr_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotr_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotri_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotri_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotri_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vrotri_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_h_b, "V8sV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_w_h, "V4SiV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_d_w, "V2LLiV4SiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextl_q_d, "V2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_hu_bu, "V8UsV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_wu_hu, "V4UiV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsllwil_du_wu, "V2ULLiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextl_qu_du, "V2LLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlr_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlr_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlr_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlr_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlri_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlri_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlri_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlri_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrar_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrar_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrar_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrar_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrari_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrari_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrari_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrari_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrln_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrln_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrln_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsran_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsran_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsran_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrani_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrani_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrani_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrani_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrn_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrn_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrn_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarn_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarn_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarn_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrlrni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsrarni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_bu_h, "V16UcV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_hu_w, "V8UsV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrln_wu_d, "V4UiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_bu_h, "V16UcV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_hu_w, "V8UsV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssran_wu_d, "V4UiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_bu_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_hu_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_wu_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_du_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_bu_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_hu_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_wu_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrani_du_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_b_h, "V16ScV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_h_w, "V8sV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_w_d, "V4SiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_bu_h, "V16UcV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_hu_w, "V8UsV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrn_wu_d, "V4UiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_bu_h, "V16UcV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_hu_w, "V8UsV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarn_wu_d, "V4UiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlrni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_b_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_h_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_w_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_d_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_bu_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_hu_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_wu_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrlni_du_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_bu_h, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_hu_w, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_wu_d, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vssrarni_du_q, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclo_b, "V16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclo_h, "V8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclo_w, "V4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclo_d, "V2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclz_b, "V16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclz_h, "V8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclz_w, "V4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vclz_d, "V2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpcnt_b, "V16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpcnt_h, "V8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpcnt_w, "V4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpcnt_d, "V2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclr_b, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclr_h, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclr_w, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclr_d, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclri_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclri_h, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclri_w, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitclri_d, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitset_b, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitset_h, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitset_w, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitset_d, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitseti_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitseti_h, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitseti_w, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitseti_d, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrev_b, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrev_h, "V8UsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrev_w, "V4UiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrev_d, "V2ULLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrevi_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrevi_h, "V8UsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrevi_w, "V4UiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitrevi_d, "V2ULLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrstp_b, "V16ScV16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrstp_h, "V8SsV8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrstpi_b, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrstpi_h, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfadd_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfadd_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfsub_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfsub_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmul_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmul_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfdiv_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfdiv_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmadd_s, "V4fV4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmadd_d, "V2dV2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmsub_s, "V4fV4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmsub_d, "V2dV2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfnmadd_s, "V4fV4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfnmadd_d, "V2dV2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfnmsub_s, "V4fV4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfnmsub_d, "V2dV2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmax_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmax_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmin_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmin_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmaxa_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmaxa_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmina_s, "V4fV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfmina_d, "V2dV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vflogb_s, "V4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vflogb_d, "V2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfclass_s, "V4iV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfclass_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfsqrt_s, "V4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfsqrt_d, "V2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrecip_s, "V4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrecip_d, "V2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrsqrt_s, "V4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrsqrt_d, "V2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvtl_s_h, "V4fV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvtl_d_s, "V2dV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvth_s_h, "V4fV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvth_d_s, "V2dV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvt_h_s, "V8sV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcvt_s_d, "V4fV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrne_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrne_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrz_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrz_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrp_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrp_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrm_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrintrm_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrint_s, "V4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfrint_d, "V2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrne_w_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrne_l_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrz_w_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrz_l_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrp_w_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrp_l_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrm_w_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrm_l_d, "V2LLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftint_w_s, "V4SiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftint_l_d, "V2SLLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrz_wu_s, "V4UiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrz_lu_d, "V2ULLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftint_wu_s, "V4UiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftint_lu_d, "V2ULLiV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrne_w_d, "V4SiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrz_w_d, "V4SiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrp_w_d, "V4SiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrm_w_d, "V4SiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftint_w_d, "V4SiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrnel_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrneh_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrzl_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrzh_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrpl_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrph_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrml_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintrmh_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftintl_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vftinth_l_s, "V2LLiV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffint_s_w, "V4fV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffint_d_l, "V2dV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffint_s_wu, "V4fV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffint_d_lu, "V2dV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffintl_d_w, "V2dV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffinth_d_w, "V2dV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vffint_s_l, "V4fV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseq_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseq_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseq_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseq_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseqi_b, "V16ScV16ScISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseqi_h, "V8SsV8SsISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseqi_w, "V4SiV4SiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vseqi_d, "V2SLLiV2SLLiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_b, "V16ScV16ScISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_h, "V8SsV8SsISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_w, "V4SiV4SiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_d, "V2SLLiV2SLLiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_bu, "V16ScV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_hu, "V8SsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_wu, "V4SiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vsle_du, "V2SLLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_bu, "V16ScV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_hu, "V8SsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_wu, "V4SiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslei_du, "V2SLLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_b, "V16ScV16ScV16Sc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_h, "V8SsV8SsV8Ss", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_w, "V4SiV4SiV4Si", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_d, "V2SLLiV2SLLiV2SLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_b, "V16ScV16ScISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_h, "V8SsV8SsISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_w, "V4SiV4SiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_d, "V2SLLiV2SLLiISi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_bu, "V16ScV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_hu, "V8SsV8UsV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_wu, "V4SiV4UiV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslt_du, "V2SLLiV2ULLiV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_bu, "V16ScV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_hu, "V8SsV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_wu, "V4SiV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vslti_du, "V2SLLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_caf_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_caf_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cun_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cun_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_ceq_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_ceq_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cueq_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cueq_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_clt_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_clt_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cult_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cult_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cle_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cle_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cule_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cule_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cne_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cne_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cor_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cor_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cune_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_cune_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_saf_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_saf_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sun_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sun_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_seq_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_seq_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sueq_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sueq_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_slt_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_slt_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sult_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sult_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sle_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sle_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sule_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sule_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sne_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sne_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sor_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sor_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sune_s, "V4SiV4fV4f", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vfcmp_sune_d, "V2SLLiV2dV2d", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitsel_v, "V16UcV16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbitseli_b, "V16UcV16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplgr2vr_b, "V16Sci", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplgr2vr_h, "V8Ssi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplgr2vr_w, "V4Sii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplgr2vr_d, "V2SLLiLLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vinsgr2vr_b, "V16ScV16SciIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vinsgr2vr_h, "V8SsV8SsiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vinsgr2vr_w, "V4SiV4SiiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vinsgr2vr_d, "V2SLLiV2SLLiLLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_b, "iV16ScIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_h, "iV8SsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_w, "iV4SiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_d, "LLiV2SLLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_bu, "iV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_hu, "iV8UsIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_wu, "iV4UiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickve2gr_du, "LLiV2ULLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplve_b, "V16cV16cUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplve_h, "V8sV8sUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplve_w, "V4iV4iUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplve_d, "V2LLiV2LLiUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplvei_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplvei_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplvei_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vreplvei_d, "V2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbsll_v, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vbsrl_v, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackev_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackev_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackev_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackev_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackod_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackod_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackod_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpackod_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickev_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickev_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickev_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickev_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickod_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickod_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickod_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpickod_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvl_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvl_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvl_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvl_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvh_b, "V16cV16cV16c", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvh_h, "V8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvh_w, "V4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vilvh_d, "V2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf_b, "V16UcV16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf_h, "V8sV8sV8sV8s", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf_w, "V4iV4iV4iV4i", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf_d, "V2LLiV2LLiV2LLiV2LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf4i_b, "V16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf4i_h, "V8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf4i_w, "V4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vshuf4i_d, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vpermi_w, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextrins_b, "V16cV16cV16cIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextrins_h, "V8sV8sV8sIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextrins_w, "V4iV4iV4iIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vextrins_d, "V2LLiV2LLiV2LLiIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vld, "V16ScvC*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vst, "vV16Scv*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldx, "V16ScvC*LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vstx, "vV16Scv*LLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldrepl_b, "V16cvC*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldrepl_h, "V8svC*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldrepl_w, "V4ivC*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vldrepl_d, "V2LLivC*Ii", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vstelm_b, "vV16Scv*IiUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vstelm_h, "vV8Ssv*IiUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vstelm_w, "vV4Siv*IiUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vstelm_d, "vV2SLLiv*IiUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bz_v, "iV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bnz_v, "iV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bz_b, "iV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bz_h, "iV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bz_w, "iV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bz_d, "iV2ULLi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bnz_b, "iV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bnz_h, "iV8Us", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bnz_w, "iV4Ui", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_bnz_d, "iV2ULLi", "nc", "lsx")

View file

@ -26,7 +26,9 @@
#pragma push_macro("SM_87")
#pragma push_macro("SM_89")
#pragma push_macro("SM_90")
#define SM_90 "sm_90"
#pragma push_macro("SM_90a")
#define SM_90a "sm_90a"
#define SM_90 "sm_90|" SM_90a
#define SM_89 "sm_89|" SM_90
#define SM_87 "sm_87|" SM_89
#define SM_86 "sm_86|" SM_87
@ -56,7 +58,11 @@
#pragma push_macro("PTX78")
#pragma push_macro("PTX80")
#pragma push_macro("PTX81")
#define PTX81 "ptx81"
#pragma push_macro("PTX82")
#pragma push_macro("PTX83")
#define PTX83 "ptx83"
#define PTX82 "ptx82|" PTX83
#define PTX81 "ptx81|" PTX82
#define PTX80 "ptx80|" PTX81
#define PTX78 "ptx78|" PTX80
#define PTX77 "ptx77|" PTX78
@ -920,22 +926,22 @@ TARGET_BUILTIN(__hmma_m16n16k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m32n8k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f16, "vi*iC*iC*iC*IiIi", "", AND(SM_70,PTX60))
TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f16, "vf*iC*iC*iC*IiIi", "", AND(SM_70,PTX60))
@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78))
#pragma pop_macro("SM_87")
#pragma pop_macro("SM_89")
#pragma pop_macro("SM_90")
#pragma pop_macro("SM_90a")
#pragma pop_macro("PTX42")
#pragma pop_macro("PTX60")
#pragma pop_macro("PTX61")
@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78))
#pragma pop_macro("PTX78")
#pragma pop_macro("PTX80")
#pragma pop_macro("PTX81")
#pragma pop_macro("PTX82")
#pragma pop_macro("PTX83")

View file

@ -151,8 +151,11 @@ TARGET_BUILTIN(__builtin_ppc_extract_exp, "Uid", "", "power9-vector")
TARGET_BUILTIN(__builtin_ppc_extract_sig, "ULLid", "", "power9-vector")
BUILTIN(__builtin_ppc_mtfsb0, "vUIi", "")
BUILTIN(__builtin_ppc_mtfsb1, "vUIi", "")
BUILTIN(__builtin_ppc_mffs, "d", "")
TARGET_BUILTIN(__builtin_ppc_mffsl, "d", "", "isa-v30-instructions")
BUILTIN(__builtin_ppc_mtfsf, "vUIiUi", "")
BUILTIN(__builtin_ppc_mtfsfi, "vUIiUIi", "")
BUILTIN(__builtin_ppc_set_fpscr_rn, "di", "")
TARGET_BUILTIN(__builtin_ppc_insert_exp, "ddULLi", "", "power9-vector")
BUILTIN(__builtin_ppc_fmsub, "dddd", "")
BUILTIN(__builtin_ppc_fmsubs, "ffff", "")

View file

@ -86,8 +86,8 @@ TARGET_BUILTIN(__builtin_riscv_sm3p0, "UiUi", "nc", "zksh")
TARGET_BUILTIN(__builtin_riscv_sm3p1, "UiUi", "nc", "zksh")
// Zihintntl extension
TARGET_BUILTIN(__builtin_riscv_ntl_load, "v.", "t", "experimental-zihintntl")
TARGET_BUILTIN(__builtin_riscv_ntl_store, "v.", "t", "experimental-zihintntl")
TARGET_BUILTIN(__builtin_riscv_ntl_load, "v.", "t", "zihintntl")
TARGET_BUILTIN(__builtin_riscv_ntl_store, "v.", "t", "zihintntl")
#undef BUILTIN
#undef TARGET_BUILTIN

View file

@ -64,14 +64,14 @@ TARGET_BUILTIN(__builtin_s390_vupllh, "V4UiV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vupllf, "V2ULLiV4Ui", "nc", "vector")
// Vector integer instructions (chapter 22 of the PoP)
TARGET_BUILTIN(__builtin_s390_vaq, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vacq, "V16UcV16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaq, "SLLLiSLLLiSLLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vacq, "ULLLiULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaccb, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vacch, "V8UsV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaccf, "V4UiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaccg, "V2ULLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaccq, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vacccq, "V16UcV16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vaccq, "ULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vacccq, "ULLLiULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavgb, "V16ScV16ScV16Sc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavgh, "V8SsV8SsV8Ss", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavgf, "V4SiV4SiV4Si", "nc", "vector")
@ -80,10 +80,10 @@ TARGET_BUILTIN(__builtin_s390_vavglb, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavglh, "V8UsV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavglf, "V4UiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vavglg, "V2ULLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqbs, "V16ScV16ScV16Sci*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqhs, "V8SsV8SsV8Ssi*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqfs, "V4SiV4SiV4Sii*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqgs, "V2SLLiV2SLLiV2SLLii*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqbs, "V16ScV16UcV16Uci*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqhs, "V8SsV8UsV8Usi*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqfs, "V4SiV4UiV4Uii*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vceqgs, "V2SLLiV2ULLiV2ULLii*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vchbs, "V16ScV16ScV16Sci*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vchhs, "V8SsV8SsV8Ssi*", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vchfs, "V4SiV4SiV4Sii*", "nc", "vector")
@ -105,10 +105,10 @@ TARGET_BUILTIN(__builtin_s390_verimb, "V16UcV16UcV16UcV16UcIi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verimh, "V8UsV8UsV8UsV8UsIi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verimf, "V4UiV4UiV4UiV4UiIi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verimg, "V2ULLiV2ULLiV2ULLiV2ULLiIi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllb, "V16UcV16UcUi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllh, "V8UsV8UsUi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllf, "V4UiV4UiUi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllg, "V2ULLiV2ULLiUi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllb, "V16UcV16UcUc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllh, "V8UsV8UsUc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllf, "V4UiV4UiUc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllg, "V2ULLiV2ULLiUc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllvb, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllvh, "V8UsV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_verllvf, "V4UiV4UiV4Ui", "nc", "vector")
@ -116,11 +116,11 @@ TARGET_BUILTIN(__builtin_s390_verllvg, "V2ULLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmb, "V8UsV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmh, "V4UiV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmf, "V2ULLiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmg, "V16UcV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmg, "ULLLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmab, "V8UsV16UcV16UcV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmah, "V4UiV8UsV8UsV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmaf, "V2ULLiV4UiV4UiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmag, "V16UcV2ULLiV2ULLiV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vgfmag, "ULLLiV2ULLiV2ULLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vmahb, "V16ScV16ScV16ScV16Sc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vmahh, "V8SsV8SsV8SsV8Ss", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vmahf, "V4SiV4SiV4SiV4Si", "nc", "vector")
@ -161,14 +161,14 @@ TARGET_BUILTIN(__builtin_s390_vpopctb, "V16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vpopcth, "V8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vpopctf, "V4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vpopctg, "V2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsq, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsbcbiq, "V16UcV16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsbiq, "V16UcV16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsq, "SLLLiSLLLiSLLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsbcbiq, "ULLLiULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsbiq, "ULLLiULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbib, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbih, "V8UsV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbif, "V4UiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbig, "V2ULLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbiq, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vscbiq, "ULLLiULLLiULLLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsl, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vslb, "V16UcV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsldb, "V16UcV16UcV16UcIi", "nc", "vector")
@ -180,8 +180,8 @@ TARGET_BUILTIN(__builtin_s390_vsumb, "V4UiV16UcV16Uc", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumh, "V4UiV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumgh, "V2ULLiV8UsV8Us", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumgf, "V2ULLiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumqf, "V16UcV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumqg, "V16UcV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumqf, "ULLLiV4UiV4Ui", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vsumqg, "ULLLiV2ULLiV2ULLi", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vtm, "iV16UcV16Uc", "nc", "vector")
// Vector string instructions (chapter 23 of the PoP)
@ -253,10 +253,10 @@ TARGET_BUILTIN(__builtin_s390_vfsqdb, "V2dV2d", "nc", "vector")
TARGET_BUILTIN(__builtin_s390_vftcidb, "V2SLLiV2dIii*", "nc", "vector")
// Vector-enhancements facility 1 intrinsics.
TARGET_BUILTIN(__builtin_s390_vlrl, "V16ScUivC*", "", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vstrl, "vV16ScUiv*", "", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vlrlr, "V16ScUivC*", "", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vstrlr, "vV16ScUiv*", "", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vbperm, "V2ULLiV16UcV16Uc", "nc", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vmslg, "V16UcV2ULLiV2ULLiV16UcIi", "nc", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vmslg, "ULLLiV2ULLiV2ULLiULLLiIi", "nc", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vfmaxdb, "V2dV2dV2dIi", "nc", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vfmindb, "V2dV2dV2dIi", "nc", "vector-enhancements-1")
TARGET_BUILTIN(__builtin_s390_vfnmadb, "V2dV2dV2dV2d", "nc", "vector-enhancements-1")

View file

@ -104,6 +104,9 @@ TARGET_BUILTIN(__builtin_ia32_clui, "v", "n", "uintr")
TARGET_BUILTIN(__builtin_ia32_stui, "v", "n", "uintr")
TARGET_BUILTIN(__builtin_ia32_testui, "Uc", "n", "uintr")
TARGET_BUILTIN(__builtin_ia32_senduipi, "vUWi", "n", "uintr")
// USERMSR
TARGET_BUILTIN(__builtin_ia32_urdmsr, "ULLiULLi", "n", "usermsr")
TARGET_BUILTIN(__builtin_ia32_uwrmsr, "vULLiULLi", "n", "usermsr")
// AMX internal builtin
TARGET_BUILTIN(__builtin_ia32_tile_loadconfig_internal, "vvC*", "n", "amx-tile")

View file

@ -28,16 +28,13 @@ CODEGENOPT(Name, Bits, Default)
#endif
CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
ENUM_CODEGENOPT(CompressDebugSections, llvm::DebugCompressionType, 2,
llvm::DebugCompressionType::None)
CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm.
CODEGENOPT(Dwarf64 , 1, 0) ///< -gdwarf64.
CODEGENOPT(Dwarf32 , 1, 1) ///< -gdwarf32.
CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments.
CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new
CODEGENOPT(AssumeUniqueVTables , 1, 1) ///< Assume a class has only one vtable.
CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink
CODEGENOPT(AutoImport , 1, 1) ///< -fno-auto-import
CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe.
CODEGENOPT(Backchain , 1, 0) ///< -mbackchain
CODEGENOPT(ControlFlowGuardNoChecks , 1, 0) ///< -cfguard-no-checks
@ -72,10 +69,6 @@ CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled.
CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info only in the case of
///< '-g' + 'O>0' level.
CODEGENOPT(EnableDIPreservationVerify, 1, 0) ///< Enable di preservation verify
///< each (it means check
///< the original debug info
///< metadata preservation).
CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
///< is specified.
CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls.
@ -112,16 +105,10 @@ CODEGENOPT(IndirectBranchCSPrefix, 1, 0) ///< if -mindirect-branch-cs-prefix
CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is
///< enabled.
CODEGENOPT(StackSizeSection , 1, 0) ///< Set when -fstack-size-section is enabled.
CODEGENOPT(ForceDwarfFrameSection , 1, 0) ///< Set when -fforce-dwarf-frame is
///< enabled.
///< Set when -femit-compact-unwind-non-canonical is enabled.
CODEGENOPT(EmitCompactUnwindNonCanonical, 1, 0)
///< Set when -femit-dwarf-unwind is passed.
ENUM_CODEGENOPT(EmitDwarfUnwind, llvm::EmitDwarfUnwindType, 2,
llvm::EmitDwarfUnwindType::Default)
///< Set when -fxray-always-emit-customevents is enabled.
CODEGENOPT(XRayAlwaysEmitCustomEvents , 1, 0)
@ -165,6 +152,7 @@ CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the
///< compile step.
CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole
///< program vtable opt).
CODEGENOPT(FatLTO, 1, 0) ///< Set when -ffat-lto-objects is enabled.
CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support
/// CFI and traditional whole program
/// devirtualization that require whole
@ -176,8 +164,6 @@ CODEGENOPT(IncrementalLinkerCompatible, 1, 0) ///< Emit an object file which can
CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.
CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled.
CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled.
CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
///< enabled.
CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is
///< enabled.
@ -185,8 +171,6 @@ CODEGENOPT(NoWarn , 1, 0) ///< Set when -Wa,--no-warn is enabled.
CODEGENOPT(NoTypeCheck , 1, 0) ///< Set when -Wa,--no-type-check is enabled.
CODEGENOPT(MisExpect , 1, 0) ///< Set when -Wmisexpect is enabled
CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
CODEGENOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
///< inline line tables.
CODEGENOPT(StackClashProtector, 1, 0) ///< Set when -fstack-clash-protection is enabled.
CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled.
CODEGENOPT(NullPointerIsValid , 1, 0) ///< Assume Null pointer deference is defined.
@ -195,13 +179,13 @@ CODEGENOPT(HIPCorrectlyRoundedDivSqrt, 1, 1) ///< -fno-hip-fp32-correctly-rounde
CODEGENOPT(HIPSaveKernelArgName, 1, 0) ///< Set when -fhip-kernel-arg-name is enabled.
CODEGENOPT(UniqueInternalLinkageNames, 1, 0) ///< Internal Linkage symbols get unique names.
CODEGENOPT(SplitMachineFunctions, 1, 0) ///< Split machine functions using profile information.
CODEGENOPT(PPCUseFullRegisterNames, 1, 0) ///< Print full register names in assembly
/// When false, this attempts to generate code as if the result of an
/// overflowing conversion matches the overflowing behavior of a target's native
/// float-to-int conversion instructions.
CODEGENOPT(StrictFloatCastOverflow, 1, 1)
CODEGENOPT(UniformWGSize , 1, 0) ///< -cl-uniform-work-group-size
CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss.
/// Method of Objective-C dispatch to use.
ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
@ -339,37 +323,6 @@ VALUE_CODEGENOPT(StackProbeSize , 32, 4096) ///< Overrides default stack
///< probe size, even if 0.
VALUE_CODEGENOPT(WarnStackSize , 32, UINT_MAX) ///< Set via -fwarn-stack-size.
CODEGENOPT(NoStackArgProbe, 1, 0) ///< Set when -mno-stack-arg-probe is used
CODEGENOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
/// Control the Assignment Tracking debug info feature.
ENUM_CODEGENOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2, AssignmentTrackingOpts::Disabled)
CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information
///< in debug info.
CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain
///< external references to a PCH or module.
CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should
///< contain explicit imports for
///< anonymous namespaces
/// Set debug info source file hashing algorithm.
ENUM_CODEGENOPT(DebugSrcHash, DebugSrcHashKind, 2, DSH_MD5)
CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the
///< skeleton CU to allow for symbolication
///< of inline stack frames without .dwo files.
CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete
///< template parameter descriptions in
///< forward declarations (versus just
///< including them in the name).
ENUM_CODEGENOPT(DebugSimpleTemplateNames, llvm::codegenoptions::DebugTemplateNamesKind, 2, llvm::codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit template parameters
///< in the textual names of template
///< specializations.
///< Implies DebugFwdTemplateNames to
///< allow decorated names to be
///< reconstructed when needed.
CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
@ -393,30 +346,6 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0)
/// The lower bound for a buffer to be considered for stack protection.
VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
/// The kind of generated debug info.
ENUM_CODEGENOPT(DebugInfo, llvm::codegenoptions::DebugInfoKind, 4, llvm::codegenoptions::NoDebugInfo)
/// Whether to generate macro debug info.
CODEGENOPT(MacroDebugInfo, 1, 0)
/// Tune the debug info for this debugger.
ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 3,
llvm::DebuggerKind::Default)
/// Dwarf version. Version zero indicates to LLVM that no DWARF should be
/// emitted.
VALUE_CODEGENOPT(DwarfVersion, 3, 0)
/// Whether we should emit CodeView debug information. It's possible to emit
/// CodeView and DWARF into the same object.
CODEGENOPT(EmitCodeView, 1, 0)
/// Whether to emit the .debug$H section containing hashes of CodeView types.
CODEGENOPT(CodeViewGHash, 1, 0)
/// Whether to emit the compiler path and command line into the CodeView debug information.
CODEGENOPT(CodeViewCommandLine, 1, 0)
/// The kind of inlining to perform.
ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining)
@ -424,7 +353,7 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining)
VALUE_CODEGENOPT(InlineMaxStackSize, 32, UINT_MAX)
// Vector functions library to use.
ENUM_CODEGENOPT(VecLib, VectorLibrary, 3, NoLibrary)
ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, llvm::driver::VectorLibrary::NoLibrary)
/// The default TLS model to use.
ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)
@ -449,26 +378,14 @@ CODEGENOPT(DirectAccessExternalData, 1, 0)
/// paths that reach the end of a function without executing a required return.
CODEGENOPT(StrictReturn, 1, 1)
/// Whether emit extra debug info for sample pgo profile collection.
CODEGENOPT(DebugInfoForProfiling, 1, 0)
/// Whether emit pseudo probes for sample pgo profile collection.
CODEGENOPT(PseudoProbeForProfiling, 1, 0)
/// Whether 3-component vector type is preserved.
CODEGENOPT(PreserveVec3Type, 1, 0)
/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
CODEGENOPT(DebugNameTable, 2, 0)
/// Whether to use DWARF base address specifiers in .debug_ranges.
CODEGENOPT(DebugRangesBaseAddress, 1, 0)
CODEGENOPT(NoPLT, 1, 0)
/// Whether to embed source in DWARF debug line section.
CODEGENOPT(EmbedSource, 1, 0)
/// Whether to emit all vtables
CODEGENOPT(ForceEmitVTables, 1, 0)
@ -513,6 +430,9 @@ ENUM_CODEGENOPT(ZeroCallUsedRegs, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind,
/// non-deleting destructors. (No effect on Microsoft ABI.)
CODEGENOPT(CtorDtorReturnThis, 1, 0)
/// FIXME: Make DebugOptions its own top-level .def file.
#include "DebugOptions.def"
#undef CODEGENOPT
#undef ENUM_CODEGENOPT
#undef VALUE_CODEGENOPT

Some files were not shown because too many files have changed in this diff Show more