Projects
Mega:24.03:SP1:Everything
llvm
_service:tar_scm:0017-Add-the-support-for-class...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0017-Add-the-support-for-classic-flang.patch of Package llvm
From b297f30783da0dfb3098fe6d39b209caacd45691 Mon Sep 17 00:00:00 2001 From: luofeng14 <luofeng13@huawei.com> Date: Fri, 1 Mar 2024 18:39:52 +0800 Subject: [PATCH] sync classic flang patch --- llvm/cmake/modules/HandleLLVMOptions.cmake | 8 + llvm/include/llvm-c/DebugInfo.h | 5 +- .../include/llvm/Analysis/TargetLibraryInfo.h | 6 +- llvm/include/llvm/Analysis/VecFuncs.def | 592 ++++++++++++++++++ llvm/include/llvm/IR/DIBuilder.h | 28 +- llvm/include/llvm/IR/DebugInfoMetadata.h | 32 +- llvm/lib/Analysis/TargetLibraryInfo.cpp | 38 +- llvm/lib/AsmParser/LLParser.cpp | 22 +- llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 42 +- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 3 +- llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h | 54 ++ .../lib/CodeGen/AsmPrinter/DebugLocStream.cpp | 5 + llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h | 6 + .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 3 + llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 4 + llvm/lib/IR/AsmWriter.cpp | 1 + llvm/lib/IR/DIBuilder.cpp | 12 +- llvm/lib/IR/DebugInfo.cpp | 10 +- llvm/lib/IR/DebugInfoMetadata.cpp | 12 +- llvm/lib/IR/LLVMContextImpl.h | 11 +- .../Instrumentation/InstrProfiling.cpp | 4 +- .../invalid-diglobalvariable-empty-name.ll | 1 + .../Generic/fortran-subprogram-at.ll | 24 + .../DebugInfo/Generic/more-subprogram-attr.ll | 38 ++ llvm/test/DebugInfo/X86/DICommonBlock.ll | 36 ++ llvm/test/lit.cfg.py | 3 + llvm/test/lit.site.cfg.py.in | 1 + llvm/tools/llvm-c-test/debuginfo.c | 4 +- llvm/unittests/IR/MetadataTest.cpp | 47 +- llvm/utils/lit/lit/TestingConfig.py | 1 + llvm/utils/lit/lit/llvm/config.py | 10 + 31 files changed, 983 insertions(+), 80 deletions(-) create mode 100644 llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll create mode 100644 llvm/test/DebugInfo/Generic/more-subprogram-attr.ll create mode 100644 llvm/test/DebugInfo/X86/DICommonBlock.ll diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 76723be696e5..492ea25b179b 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -89,6 +89,14 @@ if( LLVM_ENABLE_ASSERTIONS ) add_compile_definitions(_LIBCPP_ENABLE_HARDENED_MODE) endif() +option(LLVM_ENABLE_CLASSIC_FLANG "Build support for classic Flang instead of the new built-in Flang" OFF) +if(LLVM_ENABLE_CLASSIC_FLANG) + set(LLVM_ENABLE_CLASSIC_FLANG 1) + add_definitions( -DENABLE_CLASSIC_FLANG ) +else() + set(LLVM_ENABLE_CLASSIC_FLANG 0) +endif() + if(LLVM_ENABLE_EXPENSIVE_CHECKS) add_compile_definitions(EXPENSIVE_CHECKS) diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h index 5924294708cc..09d584c24711 100644 --- a/llvm/include/llvm-c/DebugInfo.h +++ b/llvm/include/llvm-c/DebugInfo.h @@ -1148,7 +1148,8 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, - LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits); + LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags, + uint32_t AlignInBits); /** @@ -1246,7 +1247,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, - LLVMMetadataRef Decl, uint32_t AlignInBits); + LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits); /** * Insert a new llvm.dbg.declare intrinsic call before the given instruction. diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h index 5d62e837c1f3..490252cd018a 100644 --- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h +++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -22,7 +22,6 @@ namespace llvm { template <typename T> class ArrayRef; class Function; class Module; -class Triple; /// Describes a possible vectorization of a function. /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized @@ -81,6 +80,8 @@ class TargetLibraryInfoImpl { bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F, const Module &M) const; + Triple T; + public: /// List of known vector-functions libraries. /// @@ -95,6 +96,9 @@ public: DarwinLibSystemM, // Use Darwin's libsystem_m. LIBMVEC_X86, // GLIBC Vector Math library. MASSV, // IBM MASS vector library. +#ifdef ENABLE_CLASSIC_FLANG + PGMATH, // PGI math library. +#endif SVML, // Intel short vector math library. SLEEFGNUABI, // SLEEF - SIMD Library for Evaluating Elementary Functions. ArmPL // Arm Performance Libraries. diff --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def index b884c1e3911e..d1712d158423 100644 --- a/llvm/include/llvm/Analysis/VecFuncs.def +++ b/llvm/include/llvm/Analysis/VecFuncs.def @@ -909,6 +909,596 @@ TLI_DEFINE_VECFUNC("tgammaf", "armpl_vtgammaq_f32", FIXED(4), NOMASK) TLI_DEFINE_VECFUNC("tgamma", "armpl_svtgamma_f64_x", SCALABLE(2), MASKED) TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED) +#elif defined(TLI_DEFINE_PGMATH_AARCH64_VECFUNCS) +// Classic flang libpgmath library's Vector Functions for AArch64 + +TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__fd_exp_1", "__fd_exp_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_4", FIXED(4)) + +TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4)) + +#elif defined(TLI_DEFINE_PGMATH_X86_VECFUNCS) +// Classic flang libpgmath library's Vector Functions for X86 + +TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_16", FIXED(16)) + +TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_2", FIXED(2)) +TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_8", FIXED(8)) + +TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4)) +TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_8", FIXED(8)) +TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_16", FIXED(16)) + #else #error "Must choose which vector library functions are to be defined." #endif @@ -929,3 +1519,5 @@ TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED) #undef TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS #undef TLI_DEFINE_MASSV_VECFUNCS_NAMES #undef TLI_DEFINE_ARMPL_VECFUNCS +#undef TLI_DEFINE_PGMATH_AARCH64_VECFUNCS +#undef TLI_DEFINE_PGMATH_X86_VECFUNCS diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h index ecd6dd7b0a4f..e0e64c662f18 100644 --- a/llvm/include/llvm/IR/DIBuilder.h +++ b/llvm/include/llvm/IR/DIBuilder.h @@ -681,15 +681,22 @@ namespace llvm { DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true, DIExpression *Expr = nullptr, MDNode *Decl = nullptr, - MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0, - DINodeArray Annotations = nullptr); + MDTuple *TemplateParams = nullptr, +#ifdef ENABLE_CLASSIC_FLANG + DINode::DIFlags Flags = DINode::FlagZero, +#endif + uint32_t AlignInBits = 0, DINodeArray Annotations = nullptr); /// Identical to createGlobalVariable /// except that the resulting DbgNode is temporary and meant to be RAUWed. DIGlobalVariable *createTempGlobalVariableFwdDecl( DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, - unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr, - MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0); + unsigned LineNo, DIType *Ty, bool isLocalToUnit, MDNode *Decl = nullptr, + MDTuple *TemplateParams = nullptr, +#ifdef ENABLE_CLASSIC_FLANG + DINode::DIFlags Flags = DINode::FlagZero, +#endif + uint32_t AlignInBits = 0); /// Create a new descriptor for an auto variable. This is a local variable /// that is not a subprogram parameter. @@ -820,6 +827,19 @@ namespace llvm { StringRef Name, DIFile *File, unsigned LineNo); +#ifdef ENABLE_CLASSIC_FLANG + /// Create common block entry for a Fortran common block + /// \param Scope Scope of this common block + /// \param Name The name of this common block + /// \param File The file this common block is defined + /// \param LineNo Line number + /// \param VarList List of variables that a located in common block + /// \param AlignInBits Common block alignment + DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, + StringRef Name, DIFile *File, + unsigned LineNo, uint32_t AlignInBits = 0); + +#endif /// This creates new descriptor for a namespace with the specified /// parent scope. /// \param Scope Namespace scope diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index 656122405209..9bd86172a4c0 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -3062,12 +3062,14 @@ class DIGlobalVariable : public DIVariable { bool IsLocalToUnit; bool IsDefinition; + DIFlags Flags; DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line, - bool IsLocalToUnit, bool IsDefinition, uint32_t AlignInBits, - ArrayRef<Metadata *> Ops) + bool IsLocalToUnit, bool IsDefinition, DIFlags Flags, + uint32_t AlignInBits, ArrayRef<Metadata *> Ops) : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits), - IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {} + IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), + Flags(Flags) {} ~DIGlobalVariable() = default; static DIGlobalVariable * @@ -3075,12 +3077,12 @@ class DIGlobalVariable : public DIVariable { StringRef LinkageName, DIFile *File, unsigned Line, DIType *Type, bool IsLocalToUnit, bool IsDefinition, DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams, - uint32_t AlignInBits, DINodeArray Annotations, StorageType Storage, - bool ShouldCreate = true) { + DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations, + StorageType Storage, bool ShouldCreate = true) { return getImpl(Context, Scope, getCanonicalMDString(Context, Name), getCanonicalMDString(Context, LinkageName), File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - cast_or_null<Metadata>(TemplateParams), AlignInBits, + cast_or_null<Metadata>(TemplateParams), Flags, AlignInBits, Annotations.get(), Storage, ShouldCreate); } static DIGlobalVariable * @@ -3088,14 +3090,14 @@ class DIGlobalVariable : public DIVariable { MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams, - uint32_t AlignInBits, Metadata *Annotations, StorageType Storage, - bool ShouldCreate = true); + DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations, + StorageType Storage, bool ShouldCreate = true); TempDIGlobalVariable cloneImpl() const { return getTemporary(getContext(), getScope(), getName(), getLinkageName(), getFile(), getLine(), getType(), isLocalToUnit(), isDefinition(), getStaticDataMemberDeclaration(), - getTemplateParams(), getAlignInBits(), + getTemplateParams(), getFlags(), getAlignInBits(), getAnnotations()); } @@ -3105,22 +3107,26 @@ public: (DIScope * Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned Line, DIType *Type, bool IsLocalToUnit, bool IsDefinition, DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams, - uint32_t AlignInBits, DINodeArray Annotations), + DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations), (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, - StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations)) + StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits, + Annotations)) DEFINE_MDNODE_GET( DIGlobalVariable, (Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams, - uint32_t AlignInBits, Metadata *Annotations), + DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations), (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, - StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations)) + StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits, + Annotations)) TempDIGlobalVariable clone() const { return cloneImpl(); } bool isLocalToUnit() const { return IsLocalToUnit; } bool isDefinition() const { return IsDefinition; } + DIFlags getFlags() const { return Flags; } + bool isArtificial() const { return getFlags() & FlagArtificial; } StringRef getDisplayName() const { return getStringOperand(4); } StringRef getLinkageName() const { return getStringOperand(5); } DIDerivedType *getStaticDataMemberDeclaration() const { diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 05fa67d0bbf1..a6593f6b3757 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -30,6 +30,10 @@ static cl::opt<TargetLibraryInfoImpl::VectorLibrary> ClVectorLibrary( "GLIBC Vector Math library"), clEnumValN(TargetLibraryInfoImpl::MASSV, "MASSV", "IBM MASS vector library"), +#ifdef ENABLE_CLASSIC_FLANG + clEnumValN(TargetLibraryInfoImpl::PGMATH, "PGMATH", + "PGI math library"), +#endif clEnumValN(TargetLibraryInfoImpl::SVML, "SVML", "Intel SVML library"), clEnumValN(TargetLibraryInfoImpl::SLEEFGNUABI, "sleefgnuabi", @@ -867,14 +871,14 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T); } -TargetLibraryInfoImpl::TargetLibraryInfoImpl() { +TargetLibraryInfoImpl::TargetLibraryInfoImpl() : T(Triple()) { // Default to everything being available. memset(AvailableArray, -1, sizeof(AvailableArray)); - initialize(*this, Triple(), StandardNames); + initialize(*this, T, StandardNames); } -TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) { +TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) : T(T) { // Default to everything being available. memset(AvailableArray, -1, sizeof(AvailableArray)); @@ -886,7 +890,7 @@ TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI) ShouldExtI32Return(TLI.ShouldExtI32Return), ShouldSignExtI32Param(TLI.ShouldSignExtI32Param), ShouldSignExtI32Return(TLI.ShouldSignExtI32Return), - SizeOfInt(TLI.SizeOfInt) { + SizeOfInt(TLI.SizeOfInt), T(TLI.T) { memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray)); VectorDescs = TLI.VectorDescs; ScalarDescs = TLI.ScalarDescs; @@ -898,7 +902,7 @@ TargetLibraryInfoImpl::TargetLibraryInfoImpl(TargetLibraryInfoImpl &&TLI) ShouldExtI32Return(TLI.ShouldExtI32Return), ShouldSignExtI32Param(TLI.ShouldSignExtI32Param), ShouldSignExtI32Return(TLI.ShouldSignExtI32Return), - SizeOfInt(TLI.SizeOfInt) { + SizeOfInt(TLI.SizeOfInt), T(TLI.T) { std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray), AvailableArray); VectorDescs = TLI.VectorDescs; @@ -912,6 +916,7 @@ TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(const TargetLibraryInfoI ShouldSignExtI32Param = TLI.ShouldSignExtI32Param; ShouldSignExtI32Return = TLI.ShouldSignExtI32Return; SizeOfInt = TLI.SizeOfInt; + T = TLI.T; memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray)); return *this; } @@ -923,6 +928,7 @@ TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(TargetLibraryInfoImpl && ShouldSignExtI32Param = TLI.ShouldSignExtI32Param; ShouldSignExtI32Return = TLI.ShouldSignExtI32Return; SizeOfInt = TLI.SizeOfInt; + T = TLI.T; std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray), AvailableArray); return *this; @@ -1234,6 +1240,28 @@ void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib( } break; } +#ifdef ENABLE_CLASSIC_FLANG + // NOTE: All routines listed here are not available on all the architectures. + // Based on the size of vector registers available and the size of data, the + // vector width should be chosen correctly. + case PGMATH: { + if (T.getArch() == Triple::aarch64) { + const VecDesc VecFuncs[] = { + #define TLI_DEFINE_PGMATH_AARCH64_VECFUNCS + #include "llvm/Analysis/VecFuncs.def" + }; + addVectorizableFunctions(VecFuncs); + } else if (T.getArch() == Triple::x86_64) { + const VecDesc VecFuncs[] = { + #define TLI_DEFINE_PGMATH_X86_VECFUNCS + #include "llvm/Analysis/VecFuncs.def" + }; + addVectorizableFunctions(VecFuncs); + } + break; + } +#endif + case NoLibrary: break; } diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 5f0d1a76de79..d7eb34e3d148 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -5405,6 +5405,22 @@ bool LLParser::parseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) { /// isDefinition: true, templateParams: !3, /// declaration: !4, align: 8) bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) { +#ifdef ENABLE_CLASSIC_FLANG +#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ + OPTIONAL(name, MDStringField, (/* AllowEmpty */ true)); \ + OPTIONAL(scope, MDField, ); \ + OPTIONAL(linkageName, MDStringField, ); \ + OPTIONAL(file, MDField, ); \ + OPTIONAL(line, LineField, ); \ + OPTIONAL(type, MDField, ); \ + OPTIONAL(isLocal, MDBoolField, ); \ + OPTIONAL(isDefinition, MDBoolField, (true)); \ + OPTIONAL(templateParams, MDField, ); \ + OPTIONAL(declaration, MDField, ); \ + OPTIONAL(flags, DIFlagField, ); \ + OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \ + OPTIONAL(annotations, MDField, ); +#else #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(name, MDStringField, (/* AllowEmpty */ false)); \ OPTIONAL(scope, MDField, ); \ @@ -5416,8 +5432,10 @@ bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) { OPTIONAL(isDefinition, MDBoolField, (true)); \ OPTIONAL(templateParams, MDField, ); \ OPTIONAL(declaration, MDField, ); \ + OPTIONAL(flags, DIFlagField, ); \ OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \ OPTIONAL(annotations, MDField, ); +#endif PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS @@ -5425,8 +5443,8 @@ bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) { GET_OR_DISTINCT(DIGlobalVariable, (Context, scope.Val, name.Val, linkageName.Val, file.Val, line.Val, type.Val, isLocal.Val, isDefinition.Val, - declaration.Val, templateParams.Val, align.Val, - annotations.Val)); + declaration.Val, templateParams.Val, flags.Val, + align.Val, annotations.Val)); return false; } diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 0a9a80688a41..c21e5e5dba97 100644 --- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1979,25 +1979,43 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( break; } case bitc::METADATA_GLOBAL_VAR: { - if (Record.size() < 11 || Record.size() > 13) + if (Record.size() < 11 || Record.size() > 14) return error("Invalid record"); IsDistinct = Record[0] & 1; unsigned Version = Record[0] >> 1; - if (Version == 2) { + if (Version == 3) { + // Add support for DIFlags + Metadata *Annotations = nullptr; + if (Record.size() > 13) + Annotations = getMDOrNull(Record[13]); + + MetadataList.assignValue( + GET_OR_DISTINCT( + DIGlobalVariable, + (Context, getMDOrNull(Record[1]), getMDString(Record[2]), + getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], + getDITypeRefOrNull(Record[6]), Record[7], Record[8], + getMDOrNull(Record[9]), getMDOrNull(Record[10]), + static_cast<DINode::DIFlags>(Record[11]), Record[12], + Annotations)), + NextMetadataNo); + + NextMetadataNo++; + } else if (Version == 2) { Metadata *Annotations = nullptr; if (Record.size() > 12) Annotations = getMDOrNull(Record[12]); MetadataList.assignValue( - GET_OR_DISTINCT(DIGlobalVariable, - (Context, getMDOrNull(Record[1]), - getMDString(Record[2]), getMDString(Record[3]), - getMDOrNull(Record[4]), Record[5], - getDITypeRefOrNull(Record[6]), Record[7], Record[8], - getMDOrNull(Record[9]), getMDOrNull(Record[10]), - Record[11], Annotations)), + GET_OR_DISTINCT( + DIGlobalVariable, + (Context, getMDOrNull(Record[1]), getMDString(Record[2]), + getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], + getDITypeRefOrNull(Record[6]), Record[7], Record[8], + getMDOrNull(Record[9]), getMDOrNull(Record[10]), + DINode::FlagZero, Record[11], Annotations)), NextMetadataNo); NextMetadataNo++; @@ -2010,7 +2028,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( (Context, getMDOrNull(Record[1]), getMDString(Record[2]), getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], getDITypeRefOrNull(Record[6]), Record[7], Record[8], - getMDOrNull(Record[10]), nullptr, Record[11], nullptr)), + getMDOrNull(Record[10]), nullptr, DINode::FlagZero, Record[11], + nullptr)), NextMetadataNo); NextMetadataNo++; @@ -2043,7 +2062,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( (Context, getMDOrNull(Record[1]), getMDString(Record[2]), getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], getDITypeRefOrNull(Record[6]), Record[7], Record[8], - getMDOrNull(Record[10]), nullptr, AlignInBits, nullptr)); + getMDOrNull(Record[10]), nullptr, DINode::FlagZero, AlignInBits, + nullptr)); DIGlobalVariableExpression *DGVE = nullptr; if (Attach || Expr) diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 9416c7f5a03e..013e7ce2d425 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -2014,7 +2014,7 @@ void ModuleBitcodeWriter::writeDITemplateValueParameter( void ModuleBitcodeWriter::writeDIGlobalVariable( const DIGlobalVariable *N, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { - const uint64_t Version = 2 << 1; + const uint64_t Version = 3 << 1; Record.push_back((uint64_t)N->isDistinct() | Version); Record.push_back(VE.getMetadataOrNullID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getRawName())); @@ -2026,6 +2026,7 @@ void ModuleBitcodeWriter::writeDIGlobalVariable( Record.push_back(N->isDefinition()); Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration())); Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams())); + Record.push_back(N->getFlags()); Record.push_back(N->getAlignInBits()); Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get())); diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h index 726aba18bb80..ee8be3921ab7 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h +++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h @@ -115,6 +115,29 @@ class DbgValueLoc { SmallVector<DbgValueLocEntry, 2> ValueLocEntries; bool IsVariadic; + /// Type of entry that this represents. + enum EntryType { + E_Location, + E_Integer, + E_ConstantFP, + E_ConstantInt, + E_TargetIndexLocation + }; + enum EntryType EntryKind; + + /// Either a constant, + union { + int64_t Int; + const ConstantFP *CFP; + const ConstantInt *CIP; + } Constant; + + union { + /// Or a location in the machine frame. + MachineLocation Loc; + /// Or a location from target specific location. + TargetIndexLocation TIL; + }; public: DbgValueLoc(const DIExpression *Expr, ArrayRef<DbgValueLocEntry> Locs) @@ -139,6 +162,37 @@ public: assert(((Expr && Expr->isValid()) || !Loc.isLocation()) && "DBG_VALUE with a machine location must have a valid expression."); } + DbgValueLoc(const DIExpression *Expr, int64_t i) + : Expression(Expr), EntryKind(E_Integer) { + Constant.Int = i; + } + DbgValueLoc(const DIExpression *Expr, const ConstantFP *CFP) + : Expression(Expr), EntryKind(E_ConstantFP) { + Constant.CFP = CFP; + } + DbgValueLoc(const DIExpression *Expr, const ConstantInt *CIP) + : Expression(Expr), EntryKind(E_ConstantInt) { + Constant.CIP = CIP; + } + DbgValueLoc(const DIExpression *Expr, MachineLocation Loc) + : Expression(Expr), EntryKind(E_Location), Loc(Loc) { + assert(cast<DIExpression>(Expr)->isValid()); + } + DbgValueLoc(const DIExpression *Expr, TargetIndexLocation Loc) + : Expression(Expr), EntryKind(E_TargetIndexLocation), TIL(Loc) {} + + bool isLocation() const { return EntryKind == E_Location; } + bool isTargetIndexLocation() const { + return EntryKind == E_TargetIndexLocation; + } + bool isInt() const { return EntryKind == E_Integer; } + bool isConstantFP() const { return EntryKind == E_ConstantFP; } + bool isConstantInt() const { return EntryKind == E_ConstantInt; } + int64_t getInt() const { return Constant.Int; } + const ConstantFP *getConstantFP() const { return Constant.CFP; } + const ConstantInt *getConstantInt() const { return Constant.CIP; } + MachineLocation getLoc() const { return Loc; } + TargetIndexLocation getTargetIndexLocation() const { return TIL; } bool isFragment() const { return getExpression()->isFragment(); } bool isEntryVal() const { return getExpression()->isEntryValue(); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp index 8c6109880afc..fbfcf65a34ec 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp @@ -38,6 +38,11 @@ void DebugLocStream::finalizeEntry() { } DebugLocStream::ListBuilder::~ListBuilder() { +#ifdef ENABLE_CLASSIC_FLANG + if (Finalized) + return; + Finalized = true; +#endif if (!Locs.finalizeList(Asm)) return; V.initializeDbgValue(&MI); diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h index a96bdd034918..0600f4f09d5e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h +++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h @@ -158,12 +158,18 @@ class DebugLocStream::ListBuilder { DbgVariable &V; const MachineInstr &MI; size_t ListIndex; +#ifdef ENABLE_CLASSIC_FLANG + bool Finalized; +#endif std::optional<uint8_t> TagOffset; public: ListBuilder(DebugLocStream &Locs, DwarfCompileUnit &CU, AsmPrinter &Asm, DbgVariable &V, const MachineInstr &MI) : Locs(Locs), Asm(Asm), V(V), MI(MI), ListIndex(Locs.startList(&CU)), +#ifdef ENABLE_CLASSIC_FLANG + Finalized(false), +#endif TagOffset(std::nullopt) {} void setTagOffset(uint8_t TO) { diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 58ed21379d29..78ff0d351492 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -185,6 +185,9 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( else addGlobalName(GV->getName(), *VariableDIE, DeclContext); + if (GV->isArtificial()) + addFlag(*VariableDIE, dwarf::DW_AT_artificial); + addAnnotation(*VariableDIE, GV->getAnnotations()); if (uint32_t AlignInBytes = GV->getAlignInBytes()) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 1af4b643eb17..e526614792c7 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -284,6 +284,8 @@ struct SymbolCU { DwarfCompileUnit *CU; }; +class DummyDwarfExpression; + /// The kind of accelerator tables we should emit. enum class AccelTableKind { Default, ///< Platform default. @@ -437,6 +439,8 @@ private: /// Map for tracking Fortran deferred CHARACTER lengths. DenseMap<const DIStringType *, unsigned> StringTypeLocMap; + DenseMap<const DIVariable*,const DIType*> VariableInDependentType; + AddressPool AddrPool; /// Accelerator tables. diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index be4a3ed79d88..c47dd4664ea6 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -2281,6 +2281,7 @@ static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N, Printer.printBool("isDefinition", N->isDefinition()); Printer.printMetadata("declaration", N->getRawStaticDataMemberDeclaration()); Printer.printMetadata("templateParams", N->getRawTemplateParams()); + Printer.printDIFlags("flags", N->getFlags()); Printer.printInt("align", N->getAlignInBits()); Printer.printMetadata("annotations", N->getRawAnnotations()); Out << ")"; diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 1ce8c17f8a88..af6ebf702165 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -725,14 +725,14 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression( DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F, unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined, DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams, - uint32_t AlignInBits, DINodeArray Annotations) { + DINode::DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations) { checkGlobalVariableScope(Context); auto *GV = DIGlobalVariable::getDistinct( VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F, LineNumber, Ty, IsLocalToUnit, isDefined, - cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits, - Annotations); + cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags, + AlignInBits, Annotations); if (!Expr) Expr = createExpression(); auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr); @@ -743,14 +743,14 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression( DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl( DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F, unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl, - MDTuple *TemplateParams, uint32_t AlignInBits) { + MDTuple *TemplateParams, DINode::DIFlags Flags, uint32_t AlignInBits) { checkGlobalVariableScope(Context); return DIGlobalVariable::getTemporary( VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F, LineNumber, Ty, IsLocalToUnit, false, - cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits, - nullptr) + cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags, + AlignInBits, nullptr) .release(); } diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 48b5501c55ba..3696beccdd0c 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -1547,12 +1547,13 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, - LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits) { + LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags, + uint32_t AlignInBits) { return wrap(unwrap(Builder)->createGlobalVariableExpression( unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LinkLen}, unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit, true, unwrap<DIExpression>(Expr), unwrapDI<MDNode>(Decl), - nullptr, AlignInBits)); + nullptr, map_from_llvmDIFlags(Flags), AlignInBits)); } LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE) { @@ -1597,11 +1598,12 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, - LLVMMetadataRef Decl, uint32_t AlignInBits) { + LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits) { return wrap(unwrap(Builder)->createTempGlobalVariableFwdDecl( unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LnkLen}, unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit, - unwrapDI<MDNode>(Decl), nullptr, AlignInBits)); + unwrapDI<MDNode>(Decl), nullptr, map_from_llvmDIFlags(Flags), + AlignInBits)); } LLVMValueRef diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 4933b6032688..d599896ee456 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -1258,15 +1258,16 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *StaticDataMemberDeclaration, - Metadata *TemplateParams, uint32_t AlignInBits, - Metadata *Annotations, StorageType Storage, - bool ShouldCreate) { + Metadata *TemplateParams, DIFlags Flags, + uint32_t AlignInBits, Metadata *Annotations, + StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); assert(isCanonical(LinkageName) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP( DIGlobalVariable, (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, - StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations)); + StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits, + Annotations)); Metadata *Ops[] = {Scope, Name, File, @@ -1277,7 +1278,8 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, TemplateParams, Annotations}; DEFINE_GETIMPL_STORE(DIGlobalVariable, - (Line, IsLocalToUnit, IsDefinition, AlignInBits), Ops); + (Line, IsLocalToUnit, IsDefinition, Flags, AlignInBits), + Ops); } DILocalVariable * diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 4cc3f8da6b75..8a621725f55e 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -1055,6 +1055,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> { bool IsDefinition; Metadata *StaticDataMemberDeclaration; Metadata *TemplateParams; + unsigned Flags; uint32_t AlignInBits; Metadata *Annotations; @@ -1062,20 +1063,21 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> { Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams, + unsigned Flags, uint32_t AlignInBits, Metadata *Annotations) : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File), Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), StaticDataMemberDeclaration(StaticDataMemberDeclaration), - TemplateParams(TemplateParams), AlignInBits(AlignInBits), - Annotations(Annotations) {} + TemplateParams(TemplateParams), Flags(Flags), + AlignInBits(AlignInBits), Annotations(Annotations) {} MDNodeKeyImpl(const DIGlobalVariable *N) : Scope(N->getRawScope()), Name(N->getRawName()), LinkageName(N->getRawLinkageName()), File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()), StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()), - TemplateParams(N->getRawTemplateParams()), + TemplateParams(N->getRawTemplateParams()), Flags(N->getFlags()), AlignInBits(N->getAlignInBits()), Annotations(N->getRawAnnotations()) {} bool isKeyOf(const DIGlobalVariable *RHS) const { @@ -1087,6 +1089,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> { StaticDataMemberDeclaration == RHS->getRawStaticDataMemberDeclaration() && TemplateParams == RHS->getRawTemplateParams() && + Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits() && Annotations == RHS->getRawAnnotations(); } @@ -1101,7 +1104,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> { // TODO: make hashing work fine with such situations return hash_combine(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, /* AlignInBits, */ - StaticDataMemberDeclaration, Annotations); + StaticDataMemberDeclaration, Flags, Annotations); } }; diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index a7b1953ce81c..136132d7e65a 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -1052,8 +1052,8 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfInstBase *Inc) { SP, CounterPtr->getName(), /*LinkageName=*/StringRef(), SP->getFile(), /*LineNo=*/0, DB.createUnspecifiedType("Profile Data Type"), CounterPtr->hasLocalLinkage(), /*IsDefined=*/true, /*Expr=*/nullptr, - /*Decl=*/nullptr, /*TemplateParams=*/nullptr, /*AlignInBits=*/0, - Annotations); + /*Decl=*/nullptr, /*TemplateParams=*/nullptr, + /*Flags=*/DINode::FlagZero, /*AlignInBits=*/0, Annotations); CounterPtr->addDebugInfo(DICounter); DB.finalize(); } else { diff --git a/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll b/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll index a4e69f3c8b75..d3c476a03198 100644 --- a/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll +++ b/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll @@ -1,4 +1,5 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s +; UNSUPPORTED: classic_flang ; CHECK: <stdin>:[[@LINE+1]]:30: error: 'name' cannot be empty !0 = !DIGlobalVariable(name: "") diff --git a/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll new file mode 100644 index 000000000000..988c388fe218 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll @@ -0,0 +1,24 @@ +; Test for DIFlagPure, DIFlagElement and DIFlagRecursive. These three +; DIFlags are used to attach DW_AT_pure, DW_AT_element, and DW_AT_recursive +; attributes to DW_TAG_subprogram DIEs. + +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s +; CHECK: !DISubprogram({{.*}}, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, + +!llvm.module.flags = !{!0, !1} +!llvm.dbg.cu = !{!2} + +define void @subprgm() !dbg !6 { +L: + ret void +} + +!0 = !{i32 2, !"Dwarf Version", i32 2} +!1 = !{i32 1, !"Debug Info Version", i32 3} +!2 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: "Flang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !4, imports: !4) +!3 = !DIFile(filename: "fortran-subprogram-at.f", directory: "/") +!4 = !{} +!5 = !DIBasicType(name: "real", size: 32, align: 32, encoding: DW_ATE_float) +!6 = distinct !DISubprogram(name: "subprgm", scope: !2, file: !3, line: 256, type: !7, scopeLine: 256, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !2) +!7 = !DISubroutineType(types: !8) +!8 = !{null, !5} diff --git a/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll new file mode 100644 index 000000000000..0533cf6b2367 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll @@ -0,0 +1,38 @@ +; REQUIRES: object-emission + +; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t +; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s + +; Make sure we're emitting DW_AT_{pure,elemental,recursive}. +; CHECK: DW_TAG_subprogram +; CHECK-NOT: {{DW_TAG|NULL}} +; CHECK: DW_AT_name {{.*}} "main" +; CHECK-NOT: {{DW_TAG|NULL}} +; CHECK: DW_AT_pure [DW_FORM_flag_present] (true) +; CHECK: DW_AT_elemental [DW_FORM_flag_present] (true) +; CHECK: DW_AT_recursive [DW_FORM_flag_present] (true) + +define dso_local i32 @main() !dbg !7 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + ret i32 0, !dbg !12 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) +!1 = !DIFile(filename: "x.c", directory: "/tmp") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang"} +!7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !9, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !0, retainedNodes: !2) +!8 = !DIFile(filename: "x.c", directory: "/tmp") +!9 = !DISubroutineType(types: !10) +!10 = !{!11} +!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!12 = !DILocation(line: 3, column: 3, scope: !7) diff --git a/llvm/test/DebugInfo/X86/DICommonBlock.ll b/llvm/test/DebugInfo/X86/DICommonBlock.ll new file mode 100644 index 000000000000..6cfb7a90640d --- /dev/null +++ b/llvm/test/DebugInfo/X86/DICommonBlock.ll @@ -0,0 +1,36 @@ +; ModuleID = 'none.f90' +; RUN: llc %s -o %t -filetype=obj +; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s +; CHECK: DW_TAG_common_block + +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx" + +@common_a = common global [32 x i8] zeroinitializer, align 8, !dbg !13 + +define i32 @subr() !dbg !9 { + %1 = getelementptr inbounds [32 x i8], [32 x i8]* @common_a, i64 0, i32 8 + %2 = bitcast i8* %1 to i32* + %3 = load i32, i32* %2 + ret i32 %3 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!6, !7} +!llvm.ident = !{!8} + +!0 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !1, producer: "PGI Fortran", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, retainedTypes: !14, globals: !2) +!1 = !DIFile(filename: "none.f90", directory: "/not/here/") +!2 = !{!13} +!3 = !{} +!4 = !DIGlobalVariable(name: "common /a/", scope: !5, file: !1, line: 4, isLocal: false, isDefinition: true, type: !12) +!5 = !DICommonBlock(scope: !9, declaration: !4, name: "a", file: !1, line: 4) +!6 = !{i32 2, !"Dwarf Version", i32 4} +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !{!"PGI Fortran"} +!9 = distinct !DISubprogram(name: "subrtn", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, unit: !0) +!10 = !DISubroutineType(types: !11) +!11 = !{!12, !12} +!12 = !DIBasicType(name: "int", size: 32) +!13 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression()) +!14 = !{!12, !10} diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index 4114bf7f54b2..9cc8520960c2 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -645,3 +645,6 @@ if "aix" in config.target_triple: # "OBJECT_MODE" to 'any' by default on AIX OS. if "system-aix" in config.available_features: config.environment["OBJECT_MODE"] = "any" + +if config.use_classic_flang: + config.available_features.add("classic_flang") diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in index 57ee2100dfb7..fc7ab6536309 100644 --- a/llvm/test/lit.site.cfg.py.in +++ b/llvm/test/lit.site.cfg.py.in @@ -61,6 +61,7 @@ config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@ config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@ config.dxil_tests = @LLVM_INCLUDE_DXIL_TESTS@ config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@ +config.use_classic_flang = @LLVM_ENABLE_CLASSIC_FLANG@ import lit.llvm lit.llvm.initialize(lit_config, config) diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c index a3e41be12e95..906c96f1c24b 100644 --- a/llvm/tools/llvm-c-test/debuginfo.c +++ b/llvm/tools/llvm-c-test/debuginfo.c @@ -64,7 +64,7 @@ int llvm_test_dibuilder(void) { LLVMDIBuilderCreateConstantValueExpression(DIB, 0); LLVMDIBuilderCreateGlobalVariableExpression( DIB, Module, "globalClass", 11, "", 0, File, 1, ClassTy, true, - GlobalClassValueExpr, NULL, 0); + GlobalClassValueExpr, NULL, LLVMDIFlagZero, 0); LLVMMetadataRef Int64Ty = LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero); @@ -75,7 +75,7 @@ int llvm_test_dibuilder(void) { LLVMDIBuilderCreateConstantValueExpression(DIB, 0); LLVMDIBuilderCreateGlobalVariableExpression( DIB, Module, "global", 6, "", 0, File, 1, Int64TypeDef, true, - GlobalVarValueExpr, NULL, 0); + GlobalVarValueExpr, NULL, LLVMDIFlagZero, 0); LLVMMetadataRef NameSpace = LLVMDIBuilderCreateNameSpace(DIB, Module, "NameSpace", 9, false); diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 5342360109d0..4bce26851d2f 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -2896,12 +2896,13 @@ TEST_F(DIGlobalVariableTest, get) { DIDerivedType *StaticDataMemberDeclaration = cast<DIDerivedType>(getDerivedType()); + DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7); uint32_t AlignInBits = 8; auto *N = DIGlobalVariable::get( Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, - IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits, - nullptr); + IsDefinition, StaticDataMemberDeclaration, templateParams, Flags, + AlignInBits, nullptr); EXPECT_EQ(dwarf::DW_TAG_variable, N->getTag()); EXPECT_EQ(Scope, N->getScope()); @@ -2914,57 +2915,66 @@ TEST_F(DIGlobalVariableTest, get) { EXPECT_EQ(IsDefinition, N->isDefinition()); EXPECT_EQ(StaticDataMemberDeclaration, N->getStaticDataMemberDeclaration()); EXPECT_EQ(templateParams, N->getTemplateParams()); + EXPECT_EQ(Flags, N->getFlags()); EXPECT_EQ(AlignInBits, N->getAlignInBits()); EXPECT_EQ(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, + nullptr)); EXPECT_NE(N, DIGlobalVariable::get( Context, getSubprogram(), Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, - StaticDataMemberDeclaration, templateParams, AlignInBits, - nullptr)); + StaticDataMemberDeclaration, templateParams, Flags, + AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, "other", LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, + nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, "other", File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, getFile(), Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line + 1, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, getDerivedType(), IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, !IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, !IsDefinition, StaticDataMemberDeclaration, - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, cast<DIDerivedType>(getDerivedType()), - templateParams, AlignInBits, nullptr)); + templateParams, Flags, AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, nullptr, + Flags, AlignInBits, nullptr)); + EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, + Line, Type, IsLocalToUnit, IsDefinition, + StaticDataMemberDeclaration, + templateParams, + static_cast<DINode::DIFlags>(Flags + 1), AlignInBits, nullptr)); EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, - templateParams, (AlignInBits << 1), + templateParams, Flags, (AlignInBits << 1), nullptr)); TempDIGlobalVariable Temp = N->clone(); @@ -2987,16 +2997,17 @@ TEST_F(DIGlobalVariableExpressionTest, get) { auto *Expr2 = DIExpression::get(Context, {1, 2, 3}); DIDerivedType *StaticDataMemberDeclaration = cast<DIDerivedType>(getDerivedType()); + DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7); uint32_t AlignInBits = 8; auto *Var = DIGlobalVariable::get( Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, - IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits, - nullptr); + IsDefinition, StaticDataMemberDeclaration, templateParams, Flags, + AlignInBits, nullptr); auto *Var2 = DIGlobalVariable::get( Context, Scope, "other", LinkageName, File, Line, Type, IsLocalToUnit, - IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits, - nullptr); + IsDefinition, StaticDataMemberDeclaration, templateParams, Flags, + AlignInBits, nullptr); auto *N = DIGlobalVariableExpression::get(Context, Var, Expr); EXPECT_EQ(Var, N->getVariable()); diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py index 76fd66502009..399b74c4f00d 100644 --- a/llvm/utils/lit/lit/TestingConfig.py +++ b/llvm/utils/lit/lit/TestingConfig.py @@ -26,6 +26,7 @@ class TestingConfig(object): "SYSTEMROOT", "TERM", "CLANG", + "FLANG", "LLDB", "LD_PRELOAD", "LLVM_SYMBOLIZER_PATH", diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py index 16cc2968034b..d8dec6160071 100644 --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -500,6 +500,8 @@ class LLVMConfig(object): just-built or optionally an installed clang, and add a set of standard substitutions useful to any test suite that makes use of clang. + Also sets up use of flang + """ # Clear some environment variables that might affect Clang. # @@ -631,6 +633,14 @@ class LLVMConfig(object): self.add_tool_substitutions(tool_substitutions) self.config.substitutions.append(("%resource_dir", builtin_include_dir)) + self.config.flang = self.use_llvm_tool( + 'flang', search_env='FLANG', required=required) + if self.config.flang: + tool_substitutions = [ + ToolSubst('%flang', command=self.config.flang) + ] + self.add_tool_substitutions(tool_substitutions) + self.config.substitutions.append( ( "%itanium_abi_triple", -- 2.24.3 (Apple Git-128)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2