summaryrefslogtreecommitdiff
path: root/lib/VMCore/Metadata.cpp
Commit message (Collapse)AuthorAge
* Typo.Eric Christopher2012-08-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161826 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the Metadata merging methods from GVN and make them public in MDNode.Hal Finkel2012-06-16
| | | | | | | There are other passes, BBVectorize specifically, that also need some of this functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158605 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't forget to reset 'first operand' flag when we're setting the ↵Bill Wendling2012-04-26
| | | | | | MDNodeOperand value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155599 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache the hash value of the operands in the MDNode.Benjamin Kramer2012-04-11
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154497 91177308-0d34-0410-b5e6-96231b3b80d8
* The MDString class stored a StringRef to the string which was already in aBill Wendling2012-04-10
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154429 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the 'Parent' pointer from the MDNodeOperand class.Bill Wendling2012-04-08
| | | | | | | | | | | | | An MDNode has a list of MDNodeOperands allocated directly after it as part of its allocation. Therefore, the Parent of the MDNodeOperands can be found by walking back through the operands to the beginning of that list. Mark the first operand's value pointer as being the 'first' operand so that we know where the beginning of said list is. This saves a *lot* of space during LTO with -O0 -g flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154280 91177308-0d34-0410-b5e6-96231b3b80d8
* The speedup doesn't appear to have been from this, but was an anomaly of my ↵Bill Wendling2012-04-03
| | | | | | testing machine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153951 91177308-0d34-0410-b5e6-96231b3b80d8
* Reserve space for the eventual filling of the vector. This gives a small ↵Bill Wendling2012-04-03
| | | | | | speedup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153949 91177308-0d34-0410-b5e6-96231b3b80d8
* I noticed in passing that the Metadata getIfExists method was creating a newDuncan Sands2012-03-31
| | | | | | | node and returning it if one didn't exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153798 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a way to replace a field inside a metadata node. This can beEric Christopher2012-02-15
| | | | | | | used to incrementally update a created node without needing a temporary node and RAUW. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150571 91177308-0d34-0410-b5e6-96231b3b80d8
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
* Using Inst->setMetadata(..., NULL) should be safe to remove metadata even whenNick Lewycky2011-12-27
| | | | | | | | | there is non of that type to remove. This fixes a crasher in the particular case where the instruction has metadata but no metadata storage in the context (this is only possible if the instruction has !dbg but no other metadata info). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147285 91177308-0d34-0410-b5e6-96231b3b80d8
* Unweaken vtables as per ↵David Blaikie2011-12-20
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
* Push StringRefs through the metadata interface.Benjamin Kramer2011-12-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145934 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert Metadata API to use ArrayRef.Jay Foad2011-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129932 91177308-0d34-0410-b5e6-96231b3b80d8
* Add ArrayRef variant.Devang Patel2011-03-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126978 91177308-0d34-0410-b5e6-96231b3b80d8
* When an MDNode changes to become identical to another MDNode,Dan Gohman2010-09-28
| | | | | | | | | | | | delete the MDNode that changed, rather than the other MDNode. This is less work, because it doesn't require the changed node to be re-inserted into the uniquing map and it doesn't require the is-function-local flag to be recomputed. Also, it avoids trouble when the existing node is part of a complicated data structure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114996 91177308-0d34-0410-b5e6-96231b3b80d8
* Scope a varible inside an if statement, to make it clear thatDan Gohman2010-09-28
| | | | | | | it's not used afterwards. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114986 91177308-0d34-0410-b5e6-96231b3b80d8
* When a function-local value with function-local metadata uses gets RAUWed with aDan Gohman2010-09-14
| | | | | | | | | | | | non-function-local value, it may result in the metadata no longer needing to be function-local. Check for this condition, and clear the isFunctionLocal flag, if it's still in the uniquing map, since any node in the uniquing map needs to have an accurate function-local flag. Also, add an assert to help catch problematic cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113828 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comments explaining why it's not necessary to include theDan Gohman2010-08-30
| | | | | | | is-function-local flag in metadata uniquing bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112528 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't include the is-function-local bit in the FoldingSetNodeIDDan Gohman2010-08-24
| | | | | | | | | for MDNodes, since this information is effectively implied by the operands. This allow allows the code to avoid doing a recursive is-it-really-function-local check in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111995 91177308-0d34-0410-b5e6-96231b3b80d8
* Verify that a non-uniqued non-temporary MDNode is not deleted viaDan Gohman2010-08-23
| | | | | | | MDNode::deleteTemporary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111853 91177308-0d34-0410-b5e6-96231b3b80d8
* Use MDNode::destroy(). Fixes a delete/free mismatch.Benjamin Kramer2010-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111739 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an assert to MDNode::deleteTemporary check that the node being deletedDan Gohman2010-08-21
| | | | | | | is not non-temporary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111713 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new temporary MDNode concept. Temporary MDNodes areDan Gohman2010-08-20
| | | | | | | | | not part of the IR, are not uniqued, and may be safely RAUW'd. This replaces a variety of alternate mechanisms for achieving the same effect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111681 91177308-0d34-0410-b5e6-96231b3b80d8
* Make NamedMDNode not be a subclass of Value, and simplify the interfaceDan Gohman2010-07-21
| | | | | | | for creating and populating NamedMDNodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109061 91177308-0d34-0410-b5e6-96231b3b80d8
* Disallow null as a named metadata operand.Dan Gohman2010-07-21
| | | | | | | | | | | | Make MDNode::destroy private. Fix the one thing that used MDNode::destroy, outside of MDNode itself. One should never delete or destroy an MDNode explicitly. MDNodes implicitly go away when there are no references to them (implementation details aside). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109028 91177308-0d34-0410-b5e6-96231b3b80d8
* Use TrackingVH instead of WeakVH for NamedMDNode's operands, since nodesDan Gohman2010-07-21
| | | | | | | referenced by NamedMDNodes shouldn't be deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109021 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy.Dan Gohman2010-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109020 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename removeAllMetadata to clearMetadataHashEntries and simplifyDan Gohman2010-07-20
| | | | | | | | it to just do the things that need to be done when an instruction is deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108948 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove setDbgMetadata and getDbgMetadata; their users have beenDan Gohman2010-07-20
| | | | | | | replaced with setDebugLoc and getDebugLoc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108914 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for empty metadata nodes: !{}.Dan Gohman2010-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108259 91177308-0d34-0410-b5e6-96231b3b80d8
* Add fixme.Devang Patel2010-07-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107697 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a problem exposed by my previous commit and noticed by a release-assertsDuncan Sands2010-05-04
| | | | | | | | | | buildbot: the debugging and non-debugging versions of getFunction were not functionally equivalent: the non-debugging version wrongly assumed that if a metadata operand was not metadata, then it had a non-null containing function. This is not true, since the operand might be a global value, constant etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103008 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a variant of PR6112 found by thinking about it: when doingDuncan Sands2010-05-04
| | | | | | | | | | | RAUW of a global variable with a local variable in function F, if function local metadata M in function G was using the global then M would become function-local to both F and G, which is not allowed. See the testcase for an example. Fixed by detecting this situation and zapping the metadata operand when it occurs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103007 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6112 - When globalopt (or any other pass) does RAUW(@G, %G), Chris Lattner2010-04-28
| | | | | | | | | metadata references in non-function-local MDNodes should drop to null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102519 91177308-0d34-0410-b5e6-96231b3b80d8
* rename NewDebugLoc -> DebugLoc, prune #includes in DebugLoc.h.Chris Lattner2010-04-02
| | | | | | | | | This keeps around temporary typedef for clang/llvm-gcc so the build won't break when I commit this :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100218 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the representation of the location in instruction fromChris Lattner2010-04-01
| | | | | | | | | | | | | | | being a TrackingVH<MDNode> to a NewDebugLoc, shrinking sizeof(Instruction) a lot, and providing clients the ability to deal with locations in terms of NewDebugLoc instead of having to deal with Metadata. This is still fully compatible with all clients that *do* use MDNodes for everything of course. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100088 91177308-0d34-0410-b5e6-96231b3b80d8
* add new apis for getting/setting !dbg metadata on Chris Lattner2010-03-31
| | | | | | | | | | instructions. In addition to being a convenience, they are faster than the old apis, particularly when not going from an MDKindID like people should be doing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99982 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a major source of compile-time slowness at -O0 -g by optimizingChris Lattner2010-03-30
| | | | | | | | | | | | | | | the storage of !dbg metadata kinds in the instruction themselves. The on-the-side hash table works great for metadata that not-all instructions get, or for metadata that only exists when optimizing. But when compile-time is everything, it isn't great. I'm not super thrilled with the fact that this plops a TrackingVH in Instruction, because it grows it by 3 words. I'm investigating alternatives, but this should be a step in the right direction in any case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99957 91177308-0d34-0410-b5e6-96231b3b80d8
* move some method definitions to files that make sense.Chris Lattner2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99927 91177308-0d34-0410-b5e6-96231b3b80d8
* Include isFunctionLocal while calculating folding node set profile for a MDNode.Devang Patel2010-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99490 91177308-0d34-0410-b5e6-96231b3b80d8
* Include isFunctionLocal while calculating folding node set provide for a MDNode.Devang Patel2010-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99484 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete MDNodes when LLVMContext is destroyed. Previous attempts: r97918, ↵Jeffrey Yasskin2010-03-13
| | | | | | | | | | | | 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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98410 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove duplicated code. No functionality change.Benjamin Kramer2010-03-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98156 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll back r97918 again. Just configuring against llvm-gcc wasn't enough to runJeffrey Yasskin2010-03-07
| | | | | | | the FrontendC* tests. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97921 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r97788 to free MDNodes when the LLVMContext is destroyed. ItJeffrey Yasskin2010-03-07
| | | | | | | bootstraps llvm-gcc this time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97918 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.Jeffrey Yasskin2010-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97792 91177308-0d34-0410-b5e6-96231b3b80d8
* Free MDNodes when the LLVMContext is destroyed. Leak found by Valgrind.Jeffrey Yasskin2010-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97788 91177308-0d34-0410-b5e6-96231b3b80d8