llvm-6502/lib/VMCore
Chandler Carruth 0b66c6fca2 Rewrite LLVM's generalized support library for hashing to follow the API
of the proposed standard hashing interfaces (N3333), and to use
a modified and tuned version of the CityHash algorithm.

Some of the highlights of this change:
 -- Significantly higher quality hashing algorithm with very well
    distributed results, and extremely few collisions. Should be close to
    a checksum for up to 64-bit keys. Very little clustering or clumping of
    hash codes, to better distribute load on probed hash tables.
 -- Built-in support for reserved values.
 -- Simplified API that composes cleanly with other C++ idioms and APIs.
 -- Better scaling performance as keys grow. This is the fastest
    algorithm I've found and measured for moderately sized keys (such as
    show up in some of the uniquing and folding use cases)
 -- Support for enabling per-execution seeds to prevent table ordering
    or other artifacts of hashing algorithms to impact the output of
    LLVM. The seeding would make each run different and highlight these
    problems during bootstrap.

This implementation was tested extensively using the SMHasher test
suite, and pased with flying colors, doing better than the original
CityHash algorithm even.

I've included a unittest, although it is somewhat minimal at the moment.
I've also added (or refactored into the proper location) type traits
necessary to implement this, and converted users of GeneralHash over.

My only immediate concerns with this implementation is the performance
of hashing small keys. I've already started working to improve this, and
will continue to do so. Currently, the only algorithms faster produce
lower quality results, but it is likely there is a better compromise
than the current one.

Many thanks to Jeffrey Yasskin who did most of the work on the N3333
paper, pair-programmed some of this code, and reviewed much of it. Many
thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original
authors of CityHash on which this is heavily based, and Austin Appleby
who created MurmurHash and the SMHasher test suite.

Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for
all of the review comments! If there are further comments or concerns,
please let me know and I'll jump on 'em.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 18:55:25 +00:00
..
AsmWriter.cpp VMCore/AsmWriter.cpp: Tweak to check #INF and #NAN earlier. 2012-02-16 08:12:24 +00:00
Attributes.cpp Extend Attributes to 64 bits 2012-01-20 17:56:17 +00:00
AutoUpgrade.cpp Add auto upgrade support for x86 pcmpgt/pcmpeq intrinics removed in r149367. 2012-02-03 06:10:55 +00:00
BasicBlock.cpp Add a constified getLandingPad() method. 2012-01-31 00:26:24 +00:00
CMakeLists.txt build/CMake: Finish removal of add_llvm_library_dependencies. 2011-11-29 19:25:30 +00:00
ConstantFold.cpp Remove some dead code and tidy things up now that vectors use ConstantDataVector 2012-02-06 21:56:39 +00:00
ConstantFold.h Convert ConstantFoldGetElementPtr to use ArrayRef. 2011-07-19 15:30:30 +00:00
Constants.cpp Reserve space in these vectors to prevent having to grow the array too 2012-02-07 01:27:51 +00:00
ConstantsContext.h Efficient Constant Uniquing. 2012-02-05 20:54:10 +00:00
Core.cpp Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
DebugInfoProbe.cpp Revert unintentional check-in. 2011-06-24 20:48:14 +00:00
DebugLoc.cpp Spacing. 2011-10-11 22:58:58 +00:00
Dominators.cpp Change the implementation of dominates(inst, inst) to one based on what the 2012-02-26 02:19:19 +00:00
Function.cpp Emit the "is an intrinsic overloaded" table as a bitfield. 2012-03-01 02:16:57 +00:00
GCOV.cpp Remove extra semi-colons. 2012-02-22 17:25:00 +00:00
Globals.cpp Micro-optimisation in getAliasedGlobal. 2011-08-01 12:28:01 +00:00
GVMaterializer.cpp Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
InlineAsm.cpp land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Instruction.cpp [unwind removal] Remove all of the code for the dead 'unwind' instruction. There 2012-02-06 21:44:22 +00:00
Instructions.cpp Remove dead code. Improve llvm_unreachable text. Simplify some control flow. 2012-02-19 11:37:01 +00:00
IntrinsicInst.cpp warmup ritual: use high-level argument accessors 2010-06-22 19:46:37 +00:00
IRBuilder.cpp reapply the patches reverted in r149470 that reenable ConstantDataArray, 2012-02-05 02:29:43 +00:00
LeakDetector.cpp Merge System into Support. 2010-11-29 18:16:10 +00:00
LeaksContext.h Fix a bunch of namespace polution. 2010-04-15 17:08:50 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
LLVMContext.cpp generalize LLVMContext::emitError to take a twine instead of a StringRef. 2012-01-03 23:47:05 +00:00
LLVMContextImpl.cpp Efficient Constant Uniquing. 2012-02-05 20:54:10 +00:00
LLVMContextImpl.h Rewrite LLVM's generalized support library for hashing to follow the API 2012-03-01 18:55:25 +00:00
Makefile Build system infrastructure for multiple tblgens. 2011-10-06 01:51:51 +00:00
Metadata.cpp Add a way to replace a field inside a metadata node. This can be 2012-02-15 09:09:29 +00:00
Module.cpp s/ModAttrBehavior/ModFlagBehavior/g to be consistent with how module flags are named elsewhere. 2012-02-16 10:28:10 +00:00
Pass.cpp Added TargetPassConfig::disablePass/substitutePass as a general mechanism to override specific passes. 2012-02-15 03:21:47 +00:00
PassManager.cpp Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
PassRegistry.cpp Cosmetic changes, as per Nick's review. 2011-09-29 16:46:47 +00:00
PrintModulePass.cpp Now with fewer extraneous semicolons! 2010-10-07 22:25:06 +00:00
SymbolTableListTraitsImpl.h
Type.cpp Reinstate r151049 now that GeneralHash is fixed. 2012-02-23 09:17:40 +00:00
Use.cpp Remove the AugmentedUse struct. 2011-06-20 14:12:33 +00:00
User.cpp Add some missing anchors. 2011-12-01 08:00:17 +00:00
Value.cpp Make Value::isDereferenceablePointer() handle unreachable code blocks. (This 2012-01-23 00:05:17 +00:00
ValueSymbolTable.cpp eliminate the Type::getDescription() method, using "<<" instead. This 2011-06-18 21:18:23 +00:00
ValueTypes.cpp Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
Verifier.cpp Use the DT dominates function in the verifier. 2012-02-26 02:23:37 +00:00