summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/LLVMContextImpl.h
Commit message (Collapse)AuthorAgeFilesLines
* Cache the hash value of the operands in the MDNode.Benjamin Kramer2012-04-111-0/+20
| | | | | | | | | | | | | | | | | | FoldingSet is implemented as a chained hash table. When there is a hash collision during insertion, which is common as we fill the table until a load factor of 2.0 is hit, we walk the chained elements, comparing every operand with the new element's operands. This can be very expensive if the MDNode has many operands. We sacrifice a word of space in MDNode to cache the full hash value, reducing compares on collision to a minimum. MDNode grows from 28 to 32 bytes + operands on x86. On x86_64 the new bits fit nicely into existing padding, not growing the struct at all. The actual speedup depends a lot on the test case and is typically between 1% and 2% for C++ code with clang -c -O0 -g. llvm-svn: 154497
* The MDString class stored a StringRef to the string which was already in aBill Wendling2012-04-101-1/+1
| | | | | | | | | | | | | StringMap. This was redundant and unnecessarily bloated the MDString class. Because the MDString class is a "Value" and will never have a "name", and because the Name field in the Value class is a pointer to a StringMap entry, we repurpose the Name field for an MDString. It stores the StringMap entry in the Name field, and uses the normal methods to get the string (name) back. PR12474 llvm-svn: 154429
* Replace the hashing functions on APInt and APFloat with overloads of theChandler Carruth2012-03-041-3/+8
| | | | | | | | | | | | | | new hash_value infrastructure, and replace their implementations using hash_combine. This removes a complete copy of Jenkin's lookup3 hash function (which is both significantly slower and lower quality than the one implemented in hash_combine) along with a somewhat scary xor-only hash function. Now that APInt and APFloat can be passed directly to hash_combine, simplify the rest of the LLVMContextImpl hashing to use the new infrastructure. llvm-svn: 152004
* Rewrite LLVM's generalized support library for hashing to follow the APIChandler Carruth2012-03-011-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 151822
* Reinstate r151049 now that GeneralHash is fixed.Jay Foad2012-02-231-3/+106
| | | | llvm-svn: 151248
* Revert r151049 cos it broke the buildbots.Jay Foad2012-02-211-106/+3
| | | | llvm-svn: 151052
* PR1210: make uniquing of struct and function types more efficient byJay Foad2012-02-211-3/+106
| | | | | | | | | using a DenseMap and Talin's new GeneralHash, avoiding the need for a temporary std::vector on every lookup. Patch by Meador Inge! llvm-svn: 151049
* Efficient Constant Uniquing.Talin2012-02-051-6/+3
| | | | llvm-svn: 149848
* start the implementation of a new ConstantDataVector and ConstantDataArrayChris Lattner2012-01-231-0/+3
| | | | | | | classes, per PR1324. Not all of their helper functions are implemented, nothing creates them, and the rest of the compiler doesn't handle them yet. llvm-svn: 148741
* convert CAZ, UndefValue, and CPN to use DenseMap's again, this time withoutChris Lattner2012-01-231-4/+4
| | | | | | | | using OwningPtr. OwningPtr would barf when the densemap had to reallocate, which doesn't appear to happen on the regression test suite, but obviously happens in real life :) llvm-svn: 148700
* revert r148691 and 148693Chris Lattner2012-01-231-8/+4
| | | | llvm-svn: 148698
* switch UndefValue and ConstantPointerNull over to DenseMap's for uniquing.Chris Lattner2012-01-231-3/+5
| | | | llvm-svn: 148693
* Replace a use of ConstantUniqueMap for CAZ constants with a simple DenseMap.Chris Lattner2012-01-231-1/+3
| | | | | | | Now that the type system rewrite has landed, there is no need for its complexity and std::map'ness. llvm-svn: 148691
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-171-1/+1
| | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). llvm-svn: 146786
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-2/+2
| | | | llvm-svn: 135375
* bump pointer allocate LLVM IR types, since they are never deallocated.Chris Lattner2011-07-151-1/+5
| | | | llvm-svn: 135248
* stop leaking all named struct types with an empty name. ThanksChris Lattner2011-07-131-0/+1
| | | | | | to Benjamin Kramer for steering me in the right direction here. llvm-svn: 135031
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-091-30/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
* Extend ConstantUniqueMap with a new template parameter ValRefType,Jay Foad2011-06-221-11/+15
| | | | | | | | representing a constant reference to ValType. Normally this is just "const ValType &", but when ValType is a std::vector we want to use ArrayRef as the reference type. llvm-svn: 133611
* eliminate the Type::getDescription() method, using "<<" instead. This Chris Lattner2011-06-181-8/+0
| | | | | | removes some gunk from LLVMContext. llvm-svn: 133360
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate theChris Lattner2010-11-171-1/+2
| | | | | | | | cookie argument to the SourceMgr diagnostic stuff. This cleanly separates LLVMContext's inlineasm handler from the sourcemgr error handling definition, increasing type safety and cleaning things up. llvm-svn: 119486
* Add X86 MMX type to bitcode and Type.Dale Johannesen2010-09-101-0/+1
| | | | | | | (The Ada bindings probably need it too, but all the obvious places to change say "do not edit this file".) llvm-svn: 113618
* Clarify the ownership model of LLVMContext and Module. Namely, contexts ownOwen Anderson2010-09-081-0/+4
| | | | | | | modules are instantiated in them. If the context is deleted, all of its owned modules are also deleted. llvm-svn: 113374
* remove unions from LLVM IR. They are severely buggy and notChris Lattner2010-08-281-5/+0
| | | | | | being actively maintained, improved, or extended. llvm-svn: 112356
* give LLVMContext an inline asm diagnostic hook member.Chris Lattner2010-04-061-0/+2
| | | | llvm-svn: 100506
* Add a new "NewDebugLoc" class which will eventually replace DebugLoc,Chris Lattner2010-04-011-1/+44
| | | | | | | | | | | | and will replace the 'DbgInfo' member in Instruction. The benefit of NewDebugLoc is that it is compact (8 bytes vs 12/24 bytes for the DbgInfo member in Instruction on a 32/64 bit system), it means that we will end up not having to allocate MDNodes to represent the "DILocations" in common cases of -O0 -g, and it is much more efficient to get things out of than the MDNode. llvm-svn: 100072
* Re-add the Metadata.h include to LLVMContextImpl.h so that MDNode is completeJeffrey Yasskin2010-03-211-2/+1
| | | | | | | where FoldingSet<MDNode> is instantiated. Clang and MSVC complain; gcc doesn't. llvm-svn: 99147
* Move the LLVMContextImpl implementation into a .cpp file.Jeffrey Yasskin2010-03-211-69/+3
| | | | llvm-svn: 99146
* Memoize InlineAsms into the LLVMContext and delete them on shutdown.Jeffrey Yasskin2010-03-211-0/+3
| | | | | | Fixes PR803. llvm-svn: 99143
* Delete MDNodes when LLVMContext is destroyed. Previous attempts: r97918, ↵Jeffrey Yasskin2010-03-131-8/+17
| | | | | | | | | | r97788. Tested: clang debug bootstrap, llvm-gcc bootstrap, `make check-lit` after configuring with --with-llvmgccdir (and this did run the FrontendC* tests this time) llvm-svn: 98410
* Roll back r97918 again. Just configuring against llvm-gcc wasn't enough to runJeffrey Yasskin2010-03-071-17/+8
| | | | | | the FrontendC* tests. :( llvm-svn: 97921
* Reapply r97788 to free MDNodes when the LLVMContext is destroyed. ItJeffrey Yasskin2010-03-071-8/+17
| | | | | | bootstraps llvm-gcc this time. llvm-svn: 97918
* Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.Jeffrey Yasskin2010-03-051-17/+8
| | | | llvm-svn: 97792
* Free MDNodes when the LLVMContext is destroyed. Leak found by Valgrind.Jeffrey Yasskin2010-03-051-8/+17
| | | | llvm-svn: 97788
* Stop leaking MDStrings.Jeffrey Yasskin2010-03-041-0/+5
| | | | llvm-svn: 97763
* Destroy MDNodes gracefully while deleting llvm context.Devang Patel2010-02-181-1/+11
| | | | llvm-svn: 96609
* Add support for a union type in LLVM IR. Patch by Talin!Chris Lattner2010-02-121-0/+5
| | | | llvm-svn: 96011
* revert 95903.Devang Patel2010-02-111-4/+1
| | | | llvm-svn: 95918
* Destroy MDNodes while destructing llvm context.Devang Patel2010-02-111-1/+4
| | | | llvm-svn: 95903
* Fix some of the memcheck errors found in the JIT unittests.Jeffrey Yasskin2010-02-111-2/+11
| | | | llvm-svn: 95856
* Final step in the metadata API restructuring: move the Chris Lattner2009-12-291-3/+13
| | | | | | | | getMDKindID/getMDKindNames methods to LLVMContext (and add convenience methods to Module), eliminating MetadataContext. Move the state that it maintains out to LLVMContext. llvm-svn: 92259
* This fixes a memory leak in OpaqueType found by Google's internal heapchecker.Jeffrey Yasskin2009-12-171-0/+11
| | | | llvm-svn: 91611
* Remove isPod() from DenseMapInfo, splitting it out to its ownChris Lattner2009-12-151-2/+0
| | | | | | | | isPodLike type trait. This is a generally useful type trait for more than just DenseMap, and we really care about whether something acts like a pod, not whether it really is a pod. llvm-svn: 91421
* remove a bunch of locking from LLVMContextImpl. Since only one threadChris Lattner2009-11-011-12/+0
| | | | | | | can be banging on a context at a time, this isn't needed. Owen, please review. llvm-svn: 85728
* IR support for the new BlockAddress constant kind. This isChris Lattner2009-10-281-0/+1
| | | | | | | untested and there is no way to use it, next up: doing battle with asmparser. llvm-svn: 85349
* Rename lib/VMCore/ConstantsContext.h:ValueMap<> to ConstantUniqueMap<> to avoidJeffrey Yasskin2009-10-271-9/+9
| | | | | | colliding with llvm/ADT/ValueMap.h:ValueMap<>. llvm-svn: 85344
* Derive metadata hierarchy from Value instead of User.Devang Patel2009-10-211-3/+1
| | | | llvm-svn: 84801
* Banish ConstantsLock. It's serving no purpose other than slowing things downOwen Anderson2009-10-191-1/+0
| | | | | | at the moment. llvm-svn: 84529
* s/class Metadata/class MetadataContext/gDevang Patel2009-09-281-1/+1
| | | | llvm-svn: 83019
OpenPOWER on IntegriCloud