1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/include/llvm
Pavel Labath f85485df31 Resubmit r325107 (case folding DJB hash)
The issue was that the has function was generating different results depending
on the signedness of char on the host platform. This commit fixes the issue by
explicitly using an unsigned char type to prevent sign extension and
adds some extra tests.

The original commit message was:

This patch implements a variant of the DJB hash function which folds the
input according to the algorithm in the Dwarf 5 specification (Section
6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18,
"Case Mappings").

To achieve this, I have added a llvm::sys::unicode::foldCharSimple
function, which performs this mapping. The implementation of this
function was generated from the CaseMatching.txt file from the Unicode
spec using a python script (which is also included in this patch). The
script tries to optimize the function by coalescing adjecant mappings
with the same shift and stride (terms I made up). Theoretically, it
could be made a bit smarter and merge adjecant blocks that were
interrupted by only one or two characters with exceptional mapping, but
this would save only a couple of branches, while it would greatly
complicate the implementation, so I deemed it was not worth it.

Since we assume that the vast majority of the input characters will be
US-ASCII, the folding hash function has a fast-path for handling these,
and only whips out the full decode+fold+encode logic if we encounter a
character outside of this range. It might be possible to implement the
folding directly on utf8 sequences, but this would also bring a lot of
complexity for the few cases where we will actually need to process
non-ascii characters.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits

Differential Revision: https://reviews.llvm.org/D42740

llvm-svn: 325732
2018-02-21 22:36:31 +00:00
..
ADT Report fatal error in the case of out of memory 2018-02-20 05:41:26 +00:00
Analysis [JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis 2018-02-16 16:35:17 +00:00
AsmParser LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
BinaryFormat RISCV: Add COFF address space 2018-02-21 06:42:38 +00:00
Bitcode bitcode support change for fast flags compatibility 2018-02-19 19:22:28 +00:00
CodeGen revert r325515: [TTI CostModel] change default cost of FP ops to 1 (PR36280) 2018-02-21 01:42:52 +00:00
Config [dump] Make LLVM_ENABLE_DUMP independent, and move to llvm-config.h 2017-12-07 22:55:40 +00:00
DebugInfo Try again to fix the build. 2018-02-16 21:10:34 +00:00
Demangle
ExecutionEngine [ORC] Switch to shared_ptr ownership for SymbolSources in VSOs. 2018-02-21 21:55:57 +00:00
FuzzMutate [llvm-opt-fuzzer] Avoid adding incorrect inputs to the fuzzer corpus 2018-02-05 11:05:47 +00:00
IR [InstCombine] add and use Create*FMF functions; NFC 2018-02-21 22:18:55 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LineEditor
Linker Revert "[IRMover] Implement name based structure type mapping" 2018-02-21 20:12:18 +00:00
LTO [LTO] Remove unused Path parameter to AddBufferFn 2018-02-20 20:21:53 +00:00
MC Removed superfluous semicolon to fix -Wpedantic gcc warning. NFCI. 2018-02-14 20:43:47 +00:00
Object AMDGPU: Bring elf flags in sync with the spec 2018-02-16 22:33:59 +00:00
ObjectYAML [WebAssembly] Add COMDAT support 2018-01-09 23:43:14 +00:00
Option [COFF] Process /EXPORT option in fastpath 2018-01-09 20:36:42 +00:00
Passes NewPM: Add an extension point for the start of the pipeline. 2018-01-23 01:25:20 +00:00
ProfileData [NFC] fix trivial typos in comments 2018-01-23 05:49:30 +00:00
Support Resubmit r325107 (case folding DJB hash) 2018-02-21 22:36:31 +00:00
TableGen [TableGen] Make sure !if is evaluated throughout class inheritance. 2018-01-30 19:29:21 +00:00
Target [AArch64] Improve v8.1-A code-gen for atomic load-and 2018-02-12 17:03:11 +00:00
Testing/Support [Testing/Support] Make the HasValue matcher composable 2017-12-13 10:00:38 +00:00
ToolDrivers llvm: add llvm-dlltool support to the archiver 2017-07-18 21:26:38 +00:00
Transforms Pass a module reference to CloneModule. 2018-02-14 19:50:40 +00:00
WindowsManifest Fix bug 34608 by moving private header out of public header. 2017-09-14 23:01:13 +00:00
WindowsResource [llvm-readobj] Teach readobj to dump .res files (WindowsResource). 2017-09-20 18:33:35 +00:00
XRay XRayRecord.h: Add missing #include 2017-11-21 00:23:19 +00:00
CMakeLists.txt Support: Add a VCSRevision.h header file. 2017-04-13 01:26:12 +00:00
InitializePasses.h Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LinkAllIR.h Sink some IntrinsicInst.h and Intrinsics.h out of llvm/include 2017-09-07 23:27:44 +00:00
LinkAllPasses.h Rename CountingFunctionInserter and use for both mcount and cygprofile calls, before and after inlining 2017-11-14 21:09:45 +00:00
module.modulemap [WebAssembly] Remove unneeded sub-directory 2017-12-21 03:16:34 +00:00
module.modulemap.build [Modules] Add module for Config/llvm-config.h 2017-10-24 06:18:52 +00:00
Pass.h IR printing improvement for function passes - introducing -print-module-scope 2017-12-01 17:42:46 +00:00
PassAnalysisSupport.h [NFC] fix trivial typos in comments 2018-01-23 05:49:30 +00:00
PassInfo.h [Pass] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-06 23:05:38 +00:00
PassRegistry.h [Pass] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-06 23:05:38 +00:00
PassSupport.h [Pass] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-06 23:05:38 +00:00