aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Metadata.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When an MDNode changes to become identical to another MDNode,Dan Gohman2010-09-281-5/+4
| | | | | | | | | | | | 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-281-3/+1
| | | | | | | 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-141-0/+18
| | | | | | | | | | | | 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-301-1/+6
| | | | | | | 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-241-15/+15
| | | | | | | | | 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-231-1/+3
| | | | | | | 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-211-3/+1
| | | | 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-211-1/+3
| | | | | | | 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-201-0/+23
| | | | | | | | | 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-211-57/+4
| | | | | | | 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-211-1/+1
| | | | | | | | | | | | 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-211-7/+7
| | | | | | | 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-211-4/+1
| | | | 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-201-8/+6
| | | | | | | | 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-201-4/+0
| | | | | | | 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-131-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108259 91177308-0d34-0410-b5e6-96231b3b80d8
* Add fixme.Devang Patel2010-07-061-0/+1
| | | | 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-041-11/+3
| | | | | | | | | | 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-041-7/+21
| | | | | | | | | | | 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-281-2/+15
| | | | | | | | | 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-021-3/+3
| | | | | | | | | 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-011-6/+26
| | | | | | | | | | | | | | | 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-311-0/+4
| | | | | | | | | | 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-301-11/+36
| | | | | | | | | | | | | | | 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-301-44/+0
| | | | 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-251-13/+14
| | | | 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-251-0/+1
| | | | 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-131-8/+8
| | | | | | | | | | | | 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-101-9/+0
| | | | 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-071-8/+8
| | | | | | | 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-071-8/+8
| | | | | | | 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-051-8/+8
| | | | 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-051-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97788 91177308-0d34-0410-b5e6-96231b3b80d8
* Destroy MDNodes gracefully while deleting llvm context.Devang Patel2010-02-181-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96609 91177308-0d34-0410-b5e6-96231b3b80d8
* Add MDNode::getIfExists(), an efficient way to determine if a value is used ↵Victor Hernandez2010-01-261-28/+40
| | | | | | by metadata (since metadata does not appear in a value's use list) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94492 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove MetadataBase class because it is not adding significant value.Devang Patel2010-01-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94243 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy upChris Lattner2010-01-211-9/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94100 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix if/else brackets; getFunctionForValue() is to be called for non-metadata ↵Victor Hernandez2010-01-201-1/+3
| | | | | | values git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93984 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the conditions to unambiguously show the logic they represent. This is theChandler Carruth2010-01-201-3/+3
| | | | | | | | logic enforced in the test case as well, so hopefully it is correct. Please review Victor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93980 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor common parts of MDNode::getFunction() and assertLocalFunction() ↵Victor Hernandez2010-01-201-33/+23
| | | | | | into getFunctionForValue() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93977 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comment that MDNode::getFunction() is not to be used by ↵Victor Hernandez2010-01-181-1/+2
| | | | | | performance-critical code (currently only used by AsmWriter) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93802 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify MDNode::getFunction() and assertLocalFunction() by avoiding extra ↵Victor Hernandez2010-01-181-46/+39
| | | | | | Function* variable and smallptrset since function-local metadata cannot be cyclic git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93762 91177308-0d34-0410-b5e6-96231b3b80d8
* In debug builds, assert that function-local metadata has only 1 parent functionVictor Hernandez2010-01-141-1/+30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93449 91177308-0d34-0410-b5e6-96231b3b80d8
* Add MDNode::getFunction(), which figures out the metadata's function, if it ↵Victor Hernandez2010-01-141-0/+34
| | | | | | has function that it is local to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93400 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce Twine::toStringRef, a variant of toVector which avoids the copy if theBenjamin Kramer2010-01-131-5/+1
| | | | | | | | twine can be represented as a single StringRef. Use the new methode to simplify some twine users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93317 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Twine, instead of StringRef, for consistency.Devang Patel2010-01-121-5/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93249 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.Devang Patel2010-01-121-6/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93247 91177308-0d34-0410-b5e6-96231b3b80d8
* Suppress a warning on gcc 4.4.Mikhail Glushenkov2010-01-101-26/+26
| | | | | | warning: suggest parentheses around ‘&&’ within ‘||’. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93121 91177308-0d34-0410-b5e6-96231b3b80d8
* Compute isFunctionLocal in MDNode ctor or via argument in new function ↵Victor Hernandez2010-01-101-3/+32
| | | | | | | | | | getWhenValsUnresolved(). Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93108 91177308-0d34-0410-b5e6-96231b3b80d8
* Derive NamedMDNode from Value.Devang Patel2010-01-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93032 91177308-0d34-0410-b5e6-96231b3b80d8