summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add a little heuristic to Value::isUsedInBasicBlock to speed it up for small ↵Benjamin Kramer2011-12-051-0/+13
| | | | | | | | | | basic blocks. - Calling getUser in a loop is much more expensive than iterating over a few instructions. - Use it instead of the open-coded loop in AddrModeMatcher. - 5% speedup on ARMDisassembler.cpp Release builds. llvm-svn: 145810
* Remove Value::getNameStr. It has been deprecated for a while and provides no ↵Benjamin Kramer2011-11-151-4/+0
| | | | | | additional value over getName(). llvm-svn: 144657
* Remove all remaining uses of Value::getNameStr().Benjamin Kramer2011-11-151-4/+4
| | | | llvm-svn: 144648
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-4/+4
| | | | llvm-svn: 135375
* remove the old and dangerous uncheckedReplaceAllUsesWith method,Chris Lattner2011-07-151-19/+9
| | | | | | | which was just replaceAllUsesWith without some assertions. It was needed back when type refinement was alive. llvm-svn: 135253
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-091-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad2011-06-231-0/+3
| | | | | | -Wshorten-64-to-32 warning in Instructions.h. llvm-svn: 133708
* Revert r133513:Eric Christopher2011-06-231-3/+0
| | | | | | | | | "Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)." Due to some additional warnings. llvm-svn: 133700
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-211-0/+3
| | | | | | self-hosted build failure has been fixed (r133512). llvm-svn: 133513
* Revert r133435 and r133449 to appease buildbots.Chad Rosier2011-06-211-3/+0
| | | | llvm-svn: 133499
* Change how PHINodes store their operands.Jay Foad2011-06-201-0/+3
| | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) llvm-svn: 133435
* teach Value::isDereferenceablePointer that byval arguments are alwaysChris Lattner2011-01-231-0/+4
| | | | | | dereferencable, noticed by inspection. llvm-svn: 124085
* Move the implementation of the User class into a new source file,Jay Foad2011-01-161-23/+0
| | | | | | User.cpp. llvm-svn: 123575
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-1/+1
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Revert r122114 (CallbackVH observing use-list changes) because it caused ↵Owen Anderson2010-12-201-38/+0
| | | | | | severe slowdowns on the Linux self-host configuration. llvm-svn: 122279
* Add support to CallbackVH to receive notification when a Value's use-list ↵Owen Anderson2010-12-181-0/+38
| | | | | | changes. llvm-svn: 122114
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-21/+0
| | | | | | | function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
* DoxygenifyNick Lewycky2010-11-111-1/+1
| | | | llvm-svn: 118846
* Factor out Instruction::isSafeToSpeculativelyExecute's code forDan Gohman2010-11-111-0/+55
| | | | | | | | | | | | testing for dereferenceable pointers into a helper function, isDereferenceablePointer. Teach it how to reason about GEPs with simple non-zero indices. Also eliminate ArgumentPromtion's IsAlwaysValidPointer, which didn't check for weak externals or out of range gep indices. llvm-svn: 118840
* After updating value handles for RAUW, check that no weak or tracking handlesDuncan Sands2010-07-271-1/+19
| | | | | | | | are still on the list. This might happen if a CallbackVH created some new value handles for the old value when doing RAUW. Barf if it occurs, since it is almost certainly a mistake. llvm-svn: 109495
* Clarify that if a new value handle is added while dropping value handlesDuncan Sands2010-07-241-4/+9
| | | | | | | hanging off a value, then the dropping code will intentionally not drop it too (since this is almost certainly a bug). llvm-svn: 109337
* Make NamedMDNode not be a subclass of Value, and simplify the interfaceDan Gohman2010-07-211-4/+0
| | | | | | for creating and populating NamedMDNodes. llvm-svn: 109061
* Fix Value::stripPointerCasts and BasicAA to avoid trouble onDan Gohman2010-06-281-1/+9
| | | | | | | code in unreachable blocks, which have have use-def cycles. This fixes PR7514. llvm-svn: 107071
* rename use_const_iterator to const_use_iterator for consistency's sakeGabor Greif2010-03-251-3/+3
| | | | llvm-svn: 99564
* Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move someDuncan Sands2010-02-161-2/+2
| | | | | | methods to try to have the type predicates be more logically positioned. llvm-svn: 96349
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-5/+5
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Change Value::getUnderlyingObject to have the MaxLookup value specified as aBob Wilson2010-01-251-4/+3
| | | | | | | | | | | | parameter with a default value, instead of just hardcoding it in the implementation. The limit of MaxLookup = 6 was introduced in r69151 to fix a performance problem with O(n^2) behavior in instcombine, but the scalarrepl pass is relying on getUnderlyingObject to go all the way back to an AllocaInst. Making the limit part of the method signature makes it clear that by default the result is limited and should help avoid similar problems in the future. This fixes pr6126. llvm-svn: 94433
* Introduce Twine::toStringRef, a variant of toVector which avoids the copy if theBenjamin Kramer2010-01-131-9/+6
| | | | | | | twine can be represented as a single StringRef. Use the new methode to simplify some twine users. llvm-svn: 93317
* Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer2010-01-051-7/+4
| | | | | | dereference the type pointer. llvm-svn: 92726
* Change errs() to dbgs().David Greene2010-01-051-3/+3
| | | | llvm-svn: 92663
* When doing v1->RAUW(v2), don't do anything to metadata. We don't knowChris Lattner2009-12-291-9/+0
| | | | | | | | why one was replaced with the other. Even in the specific case of debug information, it doesn't make sense to transfer the location over, this will just result in jumbled loc info. llvm-svn: 92241
* This is a major cleanup of the instruction metadata interfaces thatChris Lattner2009-12-281-10/+9
| | | | | | | | | | | | | | | | | | | | | | I asked Devang to do back on Sep 27. Instead of going through the MetadataContext class with methods like getMD() and getMDs(), just ask the instruction directly for its metadata with getMetadata() and getAllMetadata(). This includes a variety of other fixes and improvements: previously all Value*'s were bloated because the HasMetadata bit was thrown into value, adding a 9th bit to a byte. Now this is properly sunk down to the Instruction class (the only place where it makes sense) and it will be folded away somewhere soon. This also fixes some confusion in getMDs and its clients about whether the returned list is indexed by the MDID or densely packed. This is now returned sorted and densely packed and the comments make this clear. This introduces a number of fixme's which I'll follow up on. llvm-svn: 92235
* remove a bunch of locking from LLVMContextImpl. Since only one threadChris Lattner2009-11-011-2/+0
| | | | | | | can be banging on a context at a time, this isn't needed. Owen, please review. llvm-svn: 85728
* Remove unnecessary include.Daniel Dunbar2009-10-171-1/+0
| | | | llvm-svn: 84336
* Copy metadata when value is RAUW'd. It is debatable whether this is the ↵Devang Patel2009-10-131-0/+4
| | | | | | right approach for custom metadata data in general. However, right now the only custom data user, "dbg", expects this behavior while FE is constructing llvm IR with debug info. llvm-svn: 83977
* Fix http://llvm.org/PR5160, to let CallbackVHs modify other ValueHandles on theJeffrey Yasskin2009-10-121-23/+46
| | | | | | same Value without breaking things. llvm-svn: 83861
* Fix commento.Daniel Dunbar2009-09-221-2/+1
| | | | llvm-svn: 82544
* Add a TrackingVH value handle.Daniel Dunbar2009-09-221-0/+13
| | | | | | | | | | This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type. For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class. The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction. llvm-svn: 82506
* Strip trailing whitespace.Daniel Dunbar2009-09-201-41/+41
| | | | llvm-svn: 82359
* Initialize HasMetadata to zero.Benjamin Kramer2009-09-171-2/+2
| | | | llvm-svn: 82145
* Add llvm::Metadata to manage metadata used in a context. Devang Patel2009-09-161-0/+5
| | | | | | This interface will be used to attach metadata with an instruction. llvm-svn: 82060
* Teach getUnderlyingObject and skipPointerCasts about GlobalAliases.Dan Gohman2009-08-271-0/+8
| | | | llvm-svn: 80265
* Add a fast path for setName("") on an unnamed value.Daniel Dunbar2009-08-191-0/+4
| | | | llvm-svn: 79492
* Make a SmallVector size more reasonable.Daniel Dunbar2009-08-191-1/+1
| | | | llvm-svn: 79403
* Privatize the ValueHandle global map. Because this is used so heavily ↵Owen Anderson2009-08-181-21/+15
| | | | | | | | throughout the code base, locking all accesses to it is not practical performance-wise. llvm-svn: 79355
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-3/+6
| | | | llvm-svn: 78948
* Fix a typo in an assertion string.Dan Gohman2009-08-111-1/+1
| | | | llvm-svn: 78671
* revert r78048, it isn't worth using assertingvh here.Chris Lattner2009-08-041-8/+8
| | | | llvm-svn: 78119
* switch ValueMap to using AssertingVH. This is an old patch I had layingChris Lattner2009-08-041-8/+8
| | | | | | around in a tree I forgot about. llvm-svn: 78048
* Keep track of named mdnodes in a Module using an ilist.Devang Patel2009-07-291-0/+4
| | | | llvm-svn: 77476
OpenPOWER on IntegriCloud