diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support')
20 files changed, 218 insertions, 79 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S index 1da950cb4f7d..e05d3c5a99db 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S @@ -1,5 +1,7 @@ #if defined(__x86_64__) +#include "llvm_blake3_prefix.h" + #if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__)) .section .note.GNU-stack,"",%progbits #endif diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_gnu.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_gnu.S index bb58d2ae64b1..5ad1c641a7fc 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_gnu.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_gnu.S @@ -1,3 +1,5 @@ +#include "llvm_blake3_prefix.h" + .intel_syntax noprefix .global _blake3_hash_many_avx2 .global blake3_hash_many_avx2 diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_msvc.asm b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_msvc.asm index 352298edd2e8..46bad1d98f38 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_msvc.asm +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_msvc.asm @@ -1,11 +1,11 @@ -public _blake3_hash_many_avx2 -public blake3_hash_many_avx2 +public _llvm_blake3_hash_many_avx2 +public llvm_blake3_hash_many_avx2 _TEXT SEGMENT ALIGN(16) 'CODE' ALIGN 16 -blake3_hash_many_avx2 PROC -_blake3_hash_many_avx2 PROC +llvm_blake3_hash_many_avx2 PROC +_llvm_blake3_hash_many_avx2 PROC push r15 push r14 push r13 @@ -1785,8 +1785,8 @@ endroundloop1: vmovdqu xmmword ptr [rbx+10H], xmm1 jmp unwind -_blake3_hash_many_avx2 ENDP -blake3_hash_many_avx2 ENDP +_llvm_blake3_hash_many_avx2 ENDP +llvm_blake3_hash_many_avx2 ENDP _TEXT ENDS _RDATA SEGMENT READONLY PAGE ALIAS(".rdata") 'CONST' diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S index df92148fd46c..a7931e81035e 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S @@ -1,5 +1,7 @@ #if defined(__x86_64__) +#include "llvm_blake3_prefix.h" + #if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__)) .section .note.GNU-stack,"",%progbits #endif diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_gnu.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_gnu.S index e10b9f36cbcc..53c586141fbe 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_gnu.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_gnu.S @@ -1,3 +1,5 @@ +#include "llvm_blake3_prefix.h" + .intel_syntax noprefix .global _blake3_hash_many_avx512 diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_msvc.asm b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_msvc.asm index b19efbaaeb36..f13d1b260ab8 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_msvc.asm +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_msvc.asm @@ -1,15 +1,15 @@ -public _blake3_hash_many_avx512 -public blake3_hash_many_avx512 -public blake3_compress_in_place_avx512 -public _blake3_compress_in_place_avx512 -public blake3_compress_xof_avx512 -public _blake3_compress_xof_avx512 +public _llvm_blake3_hash_many_avx512 +public llvm_blake3_hash_many_avx512 +public llvm_blake3_compress_in_place_avx512 +public _llvm_blake3_compress_in_place_avx512 +public llvm_blake3_compress_xof_avx512 +public _llvm_blake3_compress_xof_avx512 _TEXT SEGMENT ALIGN(16) 'CODE' ALIGN 16 -blake3_hash_many_avx512 PROC -_blake3_hash_many_avx512 PROC +llvm_blake3_hash_many_avx512 PROC +_llvm_blake3_hash_many_avx512 PROC push r15 push r14 push r13 @@ -2404,12 +2404,12 @@ endroundloop1: vmovdqu xmmword ptr [rbx+10H], xmm1 jmp unwind -_blake3_hash_many_avx512 ENDP -blake3_hash_many_avx512 ENDP +_llvm_blake3_hash_many_avx512 ENDP +llvm_blake3_hash_many_avx512 ENDP ALIGN 16 -blake3_compress_in_place_avx512 PROC -_blake3_compress_in_place_avx512 PROC +llvm_blake3_compress_in_place_avx512 PROC +_llvm_blake3_compress_in_place_avx512 PROC sub rsp, 72 vmovdqa xmmword ptr [rsp], xmm6 vmovdqa xmmword ptr [rsp+10H], xmm7 @@ -2498,12 +2498,12 @@ _blake3_compress_in_place_avx512 PROC vmovdqa xmm9, xmmword ptr [rsp+30H] add rsp, 72 ret -_blake3_compress_in_place_avx512 ENDP -blake3_compress_in_place_avx512 ENDP +_llvm_blake3_compress_in_place_avx512 ENDP +llvm_blake3_compress_in_place_avx512 ENDP ALIGN 16 -blake3_compress_xof_avx512 PROC -_blake3_compress_xof_avx512 PROC +llvm_blake3_compress_xof_avx512 PROC +_llvm_blake3_compress_xof_avx512 PROC sub rsp, 72 vmovdqa xmmword ptr [rsp], xmm6 vmovdqa xmmword ptr [rsp+10H], xmm7 @@ -2597,8 +2597,8 @@ _blake3_compress_xof_avx512 PROC vmovdqa xmm9, xmmword ptr [rsp+30H] add rsp, 72 ret -_blake3_compress_xof_avx512 ENDP -blake3_compress_xof_avx512 ENDP +_llvm_blake3_compress_xof_avx512 ENDP +llvm_blake3_compress_xof_avx512 ENDP _TEXT ENDS diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h index 180d0a6eeda8..8e5456d745cd 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h @@ -11,15 +11,7 @@ // For \p LLVM_LIBRARY_VISIBILITY #include "llvm/Support/Compiler.h" -// Remove the 'llvm_' prefix for the rest of the internal implementation. -#define BLAKE3_VERSION_STRING LLVM_BLAKE3_VERSION_STRING -#define BLAKE3_KEY_LEN LLVM_BLAKE3_KEY_LEN -#define BLAKE3_OUT_LEN LLVM_BLAKE3_OUT_LEN -#define BLAKE3_BLOCK_LEN LLVM_BLAKE3_BLOCK_LEN -#define BLAKE3_CHUNK_LEN LLVM_BLAKE3_CHUNK_LEN -#define BLAKE3_MAX_DEPTH LLVM_BLAKE3_MAX_DEPTH -#define blake3_hasher llvm_blake3_hasher -#define blake3_chunk_state llvm_blake3_chunk_state +#include "llvm_blake3_prefix.h" // internal flags enum blake3_flags { diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S index e058faf0df2f..765cd31754b9 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S @@ -1,5 +1,7 @@ #if defined(__x86_64__) +#include "llvm_blake3_prefix.h" + #if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__)) .section .note.GNU-stack,"",%progbits #endif diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_gnu.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_gnu.S index 8852ba5976e1..bf3b4523a9f1 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_gnu.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_gnu.S @@ -1,3 +1,5 @@ +#include "llvm_blake3_prefix.h" + .intel_syntax noprefix .global blake3_hash_many_sse2 .global _blake3_hash_many_sse2 diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm index 507502f11a80..1069c8df4ed6 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm @@ -1,15 +1,15 @@ -public _blake3_hash_many_sse2 -public blake3_hash_many_sse2 -public blake3_compress_in_place_sse2 -public _blake3_compress_in_place_sse2 -public blake3_compress_xof_sse2 -public _blake3_compress_xof_sse2 +public _llvm_blake3_hash_many_sse2 +public llvm_blake3_hash_many_sse2 +public llvm_blake3_compress_in_place_sse2 +public _llvm_blake3_compress_in_place_sse2 +public llvm_blake3_compress_xof_sse2 +public _llvm_blake3_compress_xof_sse2 _TEXT SEGMENT ALIGN(16) 'CODE' ALIGN 16 -blake3_hash_many_sse2 PROC -_blake3_hash_many_sse2 PROC +llvm_blake3_hash_many_sse2 PROC +_llvm_blake3_hash_many_sse2 PROC push r15 push r14 push r13 @@ -2034,11 +2034,11 @@ endroundloop1: movups xmmword ptr [rbx], xmm0 movups xmmword ptr [rbx+10H], xmm1 jmp unwind -_blake3_hash_many_sse2 ENDP -blake3_hash_many_sse2 ENDP +_llvm_blake3_hash_many_sse2 ENDP +llvm_blake3_hash_many_sse2 ENDP -blake3_compress_in_place_sse2 PROC -_blake3_compress_in_place_sse2 PROC +llvm_blake3_compress_in_place_sse2 PROC +_llvm_blake3_compress_in_place_sse2 PROC sub rsp, 120 movdqa xmmword ptr [rsp], xmm6 movdqa xmmword ptr [rsp+10H], xmm7 @@ -2164,12 +2164,12 @@ _blake3_compress_in_place_sse2 PROC movdqa xmm15, xmmword ptr [rsp+60H] add rsp, 120 ret -_blake3_compress_in_place_sse2 ENDP -blake3_compress_in_place_sse2 ENDP +_llvm_blake3_compress_in_place_sse2 ENDP +llvm_blake3_compress_in_place_sse2 ENDP ALIGN 16 -blake3_compress_xof_sse2 PROC -_blake3_compress_xof_sse2 PROC +llvm_blake3_compress_xof_sse2 PROC +_llvm_blake3_compress_xof_sse2 PROC sub rsp, 120 movdqa xmmword ptr [rsp], xmm6 movdqa xmmword ptr [rsp+10H], xmm7 @@ -2302,8 +2302,8 @@ _blake3_compress_xof_sse2 PROC movdqa xmm15, xmmword ptr [rsp+60H] add rsp, 120 ret -_blake3_compress_xof_sse2 ENDP -blake3_compress_xof_sse2 ENDP +_llvm_blake3_compress_xof_sse2 ENDP +llvm_blake3_compress_xof_sse2 ENDP _TEXT ENDS diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S index 2f75acf2bbce..70cc27452ede 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S @@ -1,5 +1,7 @@ #if defined(__x86_64__) +#include "llvm_blake3_prefix.h" + #if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__)) .section .note.GNU-stack,"",%progbits #endif diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_gnu.S b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_gnu.S index 60d0a4042e71..28bdf3890a29 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_gnu.S +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_gnu.S @@ -1,3 +1,5 @@ +#include "llvm_blake3_prefix.h" + .intel_syntax noprefix .global blake3_hash_many_sse41 .global _blake3_hash_many_sse41 diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_msvc.asm b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_msvc.asm index 8966c7b84406..770935372cd9 100644 --- a/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_msvc.asm +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_msvc.asm @@ -1,15 +1,15 @@ -public _blake3_hash_many_sse41 -public blake3_hash_many_sse41 -public blake3_compress_in_place_sse41 -public _blake3_compress_in_place_sse41 -public blake3_compress_xof_sse41 -public _blake3_compress_xof_sse41 +public _llvm_blake3_hash_many_sse41 +public llvm_blake3_hash_many_sse41 +public llvm_blake3_compress_in_place_sse41 +public _llvm_blake3_compress_in_place_sse41 +public llvm_blake3_compress_xof_sse41 +public _llvm_blake3_compress_xof_sse41 _TEXT SEGMENT ALIGN(16) 'CODE' ALIGN 16 -blake3_hash_many_sse41 PROC -_blake3_hash_many_sse41 PROC +llvm_blake3_hash_many_sse41 PROC +_llvm_blake3_hash_many_sse41 PROC push r15 push r14 push r13 @@ -1797,11 +1797,11 @@ endroundloop1: movups xmmword ptr [rbx], xmm0 movups xmmword ptr [rbx+10H], xmm1 jmp unwind -_blake3_hash_many_sse41 ENDP -blake3_hash_many_sse41 ENDP +_llvm_blake3_hash_many_sse41 ENDP +llvm_blake3_hash_many_sse41 ENDP -blake3_compress_in_place_sse41 PROC -_blake3_compress_in_place_sse41 PROC +llvm_blake3_compress_in_place_sse41 PROC +_llvm_blake3_compress_in_place_sse41 PROC sub rsp, 120 movdqa xmmword ptr [rsp], xmm6 movdqa xmmword ptr [rsp+10H], xmm7 @@ -1916,12 +1916,12 @@ _blake3_compress_in_place_sse41 PROC movdqa xmm15, xmmword ptr [rsp+60H] add rsp, 120 ret -_blake3_compress_in_place_sse41 ENDP -blake3_compress_in_place_sse41 ENDP +_llvm_blake3_compress_in_place_sse41 ENDP +llvm_blake3_compress_in_place_sse41 ENDP ALIGN 16 -blake3_compress_xof_sse41 PROC -_blake3_compress_xof_sse41 PROC +llvm_blake3_compress_xof_sse41 PROC +_llvm_blake3_compress_xof_sse41 PROC sub rsp, 120 movdqa xmmword ptr [rsp], xmm6 movdqa xmmword ptr [rsp+10H], xmm7 @@ -2043,8 +2043,8 @@ _blake3_compress_xof_sse41 PROC movdqa xmm15, xmmword ptr [rsp+60H] add rsp, 120 ret -_blake3_compress_xof_sse41 ENDP -blake3_compress_xof_sse41 ENDP +_llvm_blake3_compress_xof_sse41 ENDP +llvm_blake3_compress_xof_sse41 ENDP _TEXT ENDS diff --git a/contrib/llvm-project/llvm/lib/Support/BLAKE3/llvm_blake3_prefix.h b/contrib/llvm-project/llvm/lib/Support/BLAKE3/llvm_blake3_prefix.h new file mode 100644 index 000000000000..3cee3691e4cf --- /dev/null +++ b/contrib/llvm-project/llvm/lib/Support/BLAKE3/llvm_blake3_prefix.h @@ -0,0 +1,41 @@ +#ifndef LLVM_BLAKE3_PREFIX_H +#define LLVM_BLAKE3_PREFIX_H + +#define BLAKE3_VERSION_STRING LLVM_BLAKE3_VERSION_STRING +#define BLAKE3_KEY_LEN LLVM_BLAKE3_KEY_LEN +#define BLAKE3_OUT_LEN LLVM_BLAKE3_OUT_LEN +#define BLAKE3_BLOCK_LEN LLVM_BLAKE3_BLOCK_LEN +#define BLAKE3_CHUNK_LEN LLVM_BLAKE3_CHUNK_LEN +#define BLAKE3_MAX_DEPTH LLVM_BLAKE3_MAX_DEPTH +#define blake3_hasher llvm_blake3_hasher +#define blake3_chunk_state llvm_blake3_chunk_state +#define blake3_compress_in_place llvm_blake3_compress_in_place +#define blake3_compress_xof llvm_blake3_compress_xof +#define blake3_hash_many llvm_blake3_hash_many +#define blake3_simd_degree llvm_blake3_simd_degree +#define blake3_compress_in_place_portable llvm_blake3_compress_in_place_portable +#define blake3_compress_xof_portable llvm_blake3_compress_xof_portable +#define blake3_hash_many_portable llvm_blake3_hash_many_portable +#define blake3_compress_in_place_sse2 llvm_blake3_compress_in_place_sse2 +#define _blake3_compress_in_place_sse2 _llvm_blake3_compress_in_place_sse2 +#define blake3_compress_xof_sse2 llvm_blake3_compress_xof_sse2 +#define _blake3_compress_xof_sse2 _llvm_blake3_compress_xof_sse2 +#define blake3_hash_many_sse2 llvm_blake3_hash_many_sse2 +#define _blake3_hash_many_sse2 _llvm_blake3_hash_many_sse2 +#define blake3_compress_in_place_sse41 llvm_blake3_compress_in_place_sse41 +#define _blake3_compress_in_place_sse41 _llvm_blake3_compress_in_place_sse41 +#define blake3_compress_xof_sse41 llvm_blake3_compress_xof_sse41 +#define _blake3_compress_xof_sse41 _llvm_blake3_compress_xof_sse41 +#define blake3_hash_many_sse41 llvm_blake3_hash_many_sse41 +#define _blake3_hash_many_sse41 _llvm_blake3_hash_many_sse41 +#define blake3_hash_many_avx2 llvm_blake3_hash_many_avx2 +#define _blake3_hash_many_avx2 _llvm_blake3_hash_many_avx2 +#define blake3_compress_in_place_avx512 llvm_blake3_compress_in_place_avx512 +#define _blake3_compress_in_place_avx512 _llvm_blake3_compress_in_place_avx512 +#define blake3_compress_xof_avx512 llvm_blake3_compress_xof_avx512 +#define _blake3_compress_xof_avx512 _llvm_blake3_compress_xof_avx512 +#define blake3_hash_many_avx512 llvm_blake3_hash_many_avx512 +#define _blake3_hash_many_avx512 _llvm_blake3_hash_many_avx512 +#define blake3_hash_many_neon llvm_blake3_hash_many_neon + +#endif /* LLVM_BLAKE3_PREFIX_H */ diff --git a/contrib/llvm-project/llvm/lib/Support/Parallel.cpp b/contrib/llvm-project/llvm/lib/Support/Parallel.cpp index 23ed9d813548..c256d256be4f 100644 --- a/contrib/llvm-project/llvm/lib/Support/Parallel.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Parallel.cpp @@ -214,8 +214,12 @@ void llvm::parallelFor(size_t Begin, size_t End, Fn(I); }); } - for (; Begin != End; ++Begin) - Fn(Begin); + if (Begin != End) { + TG.spawn([=, &Fn] { + for (size_t I = Begin; I != End; ++I) + Fn(I); + }); + } return; } #endif diff --git a/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp b/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp index 1b1bff023d2f..7cb1147d4265 100644 --- a/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp @@ -503,6 +503,67 @@ RISCVISAInfo::parseFeatures(unsigned XLen, } llvm::Expected<std::unique_ptr<RISCVISAInfo>> +RISCVISAInfo::parseNormalizedArchString(StringRef Arch) { + if (llvm::any_of(Arch, isupper)) { + return createStringError(errc::invalid_argument, + "string must be lowercase"); + } + // Must start with a valid base ISA name. + unsigned XLen; + if (Arch.startswith("rv32i") || Arch.startswith("rv32e")) + XLen = 32; + else if (Arch.startswith("rv64i") || Arch.startswith("rv64e")) + XLen = 64; + else + return createStringError(errc::invalid_argument, + "arch string must begin with valid base ISA"); + std::unique_ptr<RISCVISAInfo> ISAInfo(new RISCVISAInfo(XLen)); + // Discard rv32/rv64 prefix. + Arch = Arch.substr(4); + + // Each extension is of the form ${name}${major_version}p${minor_version} + // and separated by _. Split by _ and then extract the name and version + // information for each extension. + SmallVector<StringRef, 8> Split; + Arch.split(Split, '_'); + for (StringRef Ext : Split) { + StringRef Prefix, MinorVersionStr; + std::tie(Prefix, MinorVersionStr) = Ext.rsplit('p'); + if (MinorVersionStr.empty()) + return createStringError(errc::invalid_argument, + "extension lacks version in expected format"); + unsigned MajorVersion, MinorVersion; + if (MinorVersionStr.getAsInteger(10, MinorVersion)) + return createStringError(errc::invalid_argument, + "failed to parse minor version number"); + + // Split Prefix into the extension name and the major version number + // (the trailing digits of Prefix). + int TrailingDigits = 0; + StringRef ExtName = Prefix; + while (!ExtName.empty()) { + if (!isDigit(ExtName.back())) + break; + ExtName = ExtName.drop_back(1); + TrailingDigits++; + } + if (!TrailingDigits) + return createStringError(errc::invalid_argument, + "extension lacks version in expected format"); + + StringRef MajorVersionStr = Prefix.take_back(TrailingDigits); + if (MajorVersionStr.getAsInteger(10, MajorVersion)) + return createStringError(errc::invalid_argument, + "failed to parse major version number"); + ISAInfo->addExtension(ExtName, MajorVersion, MinorVersion); + } + ISAInfo->updateFLen(); + ISAInfo->updateMinVLen(); + ISAInfo->updateMaxELen(); + return std::move(ISAInfo); +} + +llvm::Expected<std::unique_ptr<RISCVISAInfo>> RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck, bool IgnoreUnknown) { @@ -999,6 +1060,8 @@ std::vector<std::string> RISCVISAInfo::toFeatureVector() const { std::string ExtName = Ext.first; if (ExtName == "i") // i is not recognized in clang -cc1 continue; + if (!isSupportedExtension(ExtName)) + continue; std::string Feature = isExperimentalExtension(ExtName) ? "+experimental-" + ExtName : "+" + ExtName; diff --git a/contrib/llvm-project/llvm/lib/Support/Windows/Path.inc b/contrib/llvm-project/llvm/lib/Support/Windows/Path.inc index 92cf4fcda5a6..7106a67b576a 100644 --- a/contrib/llvm-project/llvm/lib/Support/Windows/Path.inc +++ b/contrib/llvm-project/llvm/lib/Support/Windows/Path.inc @@ -650,8 +650,6 @@ bool equivalent(file_status A, file_status B) { return A.FileIndexHigh == B.FileIndexHigh && A.FileIndexLow == B.FileIndexLow && A.FileSizeHigh == B.FileSizeHigh && A.FileSizeLow == B.FileSizeLow && - A.LastAccessedTimeHigh == B.LastAccessedTimeHigh && - A.LastAccessedTimeLow == B.LastAccessedTimeLow && A.LastWriteTimeHigh == B.LastWriteTimeHigh && A.LastWriteTimeLow == B.LastWriteTimeLow && A.VolumeSerialNumber == B.VolumeSerialNumber; diff --git a/contrib/llvm-project/llvm/lib/Support/Windows/Signals.inc b/contrib/llvm-project/llvm/lib/Support/Windows/Signals.inc index ba93afe0803b..cb82f55fc38b 100644 --- a/contrib/llvm-project/llvm/lib/Support/Windows/Signals.inc +++ b/contrib/llvm-project/llvm/lib/Support/Windows/Signals.inc @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/ExitCodes.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" @@ -204,6 +205,9 @@ static bool RegisteredUnhandledExceptionFilter = false; static bool CleanupExecuted = false; static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL; +/// The function to call on "SIGPIPE" (one-time use only). +static std::atomic<void (*)()> OneShotPipeSignalFunction(nullptr); + // Windows creates a new thread to execute the console handler when an event // (such as CTRL/C) occurs. This causes concurrency issues with the above // globals which this critical section addresses. @@ -575,11 +579,16 @@ void llvm::sys::SetInfoSignalFunction(void (*Handler)()) { } void llvm::sys::SetOneShotPipeSignalFunction(void (*Handler)()) { - // Unimplemented. + OneShotPipeSignalFunction.exchange(Handler); } void llvm::sys::DefaultOneShotPipeSignalHandler() { - // Unimplemented. + llvm::sys::Process::Exit(EX_IOERR, /*NoCleanup=*/true); +} + +void llvm::sys::CallOneShotPipeSignalHandler() { + if (auto OldOneShotPipeFunction = OneShotPipeSignalFunction.exchange(nullptr)) + OldOneShotPipeFunction(); } /// Add a function to be called when a signal is delivered to the process. The @@ -816,7 +825,15 @@ WriteWindowsDumpFile(PMINIDUMP_EXCEPTION_INFORMATION ExceptionInfo) { } void sys::CleanupOnSignal(uintptr_t Context) { - LLVMUnhandledExceptionFilter((LPEXCEPTION_POINTERS)Context); + LPEXCEPTION_POINTERS EP = (LPEXCEPTION_POINTERS)Context; + // Broken pipe is not a crash. + // + // 0xE0000000 is combined with the return code in the exception raised in + // CrashRecoveryContext::HandleExit(). + unsigned RetCode = EP->ExceptionRecord->ExceptionCode; + if (RetCode == (0xE0000000 | EX_IOERR)) + return; + LLVMUnhandledExceptionFilter(EP); } static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) { diff --git a/contrib/llvm-project/llvm/lib/Support/Z3Solver.cpp b/contrib/llvm-project/llvm/lib/Support/Z3Solver.cpp index a49bedcfd2b0..eb671fe2596d 100644 --- a/contrib/llvm-project/llvm/lib/Support/Z3Solver.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Z3Solver.cpp @@ -729,7 +729,7 @@ public: const Z3_sort Z3Sort = toZ3Sort(*getBitvectorSort(BitWidth)).Sort; // Slow path, when 64 bits are not enough. - if (LLVM_UNLIKELY(Int.getBitWidth() > 64u)) { + if (LLVM_UNLIKELY(!Int.isRepresentableByInt64())) { SmallString<40> Buffer; Int.toString(Buffer, 10); return newExprRef(Z3Expr( diff --git a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp index 92b15f14c62f..7b9b8b2f53fb 100644 --- a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp +++ b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp @@ -56,6 +56,7 @@ #ifdef _WIN32 #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/Signals.h" #include "llvm/Support/Windows/WindowsSupport.h" #endif @@ -775,6 +776,15 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) { ) continue; +#ifdef _WIN32 + // Windows equivalents of SIGPIPE/EPIPE. + DWORD WinLastError = GetLastError(); + if (WinLastError == ERROR_BROKEN_PIPE || + (WinLastError == ERROR_NO_DATA && errno == EINVAL)) { + llvm::sys::CallOneShotPipeSignalHandler(); + errno = EPIPE; + } +#endif // Otherwise it's a non-recoverable error. Note it and quit. error_detected(std::error_code(errno, std::generic_category())); break; @@ -802,8 +812,6 @@ uint64_t raw_fd_ostream::seek(uint64_t off) { flush(); #ifdef _WIN32 pos = ::_lseeki64(FD, off, SEEK_SET); -#elif defined(HAVE_LSEEK64) - pos = ::lseek64(FD, off, SEEK_SET); #else pos = ::lseek(FD, off, SEEK_SET); #endif |