summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename VMCore directory to IR.Chandler Carruth2013-01-021-698/+0
| | | | | | | | | | | | | | | | | | Aside from moving the actual files, this patch only updates the build system and the source file comments under lib/... that are relevant. I'll be updating other docs and other files in smaller subsequnet commits. While I've tried to test this, but it is entirely possible that there will still be some build system fallout. Also, note that I've not changed the library name itself: libLLVMCore.a is still the library name. I'd be interested in others' opinions about whether we should rename this as well (I think we should, just not sure what it might break) llvm-svn: 171359
* Don't use isa<CallInst>(this) in the constructor for CallInst's base class.Richard Smith2012-12-201-2/+5
| | | | | | | | This has undefined behavior, because the classof implementation attempts to access parts of the not-yet-constructed derived class. Found by clang -fsanitize=vptr. llvm-svn: 170658
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-5/+6
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165402
* Move CallbackVHs dtor inline, it can be devirtualized in many cases. Move ↵Benjamin Kramer2012-05-191-3/+6
| | | | | | the other virtual methods out of line as they are only called from within Value.cpp anyway. llvm-svn: 157123
* The MDString class stored a StringRef to the string which was already in aBill Wendling2012-04-101-1/+6
| | | | | | | | | | | | | 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
* Allow subclasses of the ValueHandleBase to store information as part of theBill Wendling2012-04-081-12/+14
| | | | | | | value pointer by making the value pointer into a pointer-int pair with 2 bits available for flags. llvm-svn: 154279
* Extend the inline cost calculation to account for bonuses due toChandler Carruth2012-03-141-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | correlated pairs of pointer arguments at the callsite. This is designed to recognize the common C++ idiom of begin/end pointer pairs when the end pointer is a constant offset from the begin pointer. With the C-based idiom of a pointer and size, the inline cost saw the constant size calculation, and this provides the same level of information for begin/end pairs. In order to propagate this information we have to search for candidate operations on a pair of pointer function arguments (or derived from them) which would be simplified if the pointers had a known constant offset. Then the callsite analysis looks for such pointer pairs in the argument list, and applies the appropriate bonus. This helps LLVM detect that half of bounds-checked STL algorithms (such as hash_combine_range, and some hybrid sort implementations) disappear when inlined with a constant size input. However, it's not a complete fix due the inaccuracy of our cost metric for constants in general. I'm looking into that next. Benchmarks showed no significant code size change, and very minor performance changes. However, specific code such as hashing is showing significantly cleaner inlining decisions. llvm-svn: 152752
* Refactor some methods to look through bitcasts and GEPs on pointers intoChandler Carruth2012-03-101-6/+42
| | | | | | | | | | a common collection of methods on Value, and share their implementation. We had two variations in two different places already, and I need the third variation for inline cost estimation. Reviewed by Duncan Sands on IRC, but further comments here welcome. llvm-svn: 152490
* Make Value::isDereferenceablePointer() handle unreachable code blocks. (ThisNick Lewycky2012-01-231-7/+17
| | | | | | | | returns false in the event the computation feeding into the pointer is unreachable, which maybe ought to be true -- but this is at least consistent with undef->isDereferenceablePointer().) Fixes PR11825! llvm-svn: 148671
* 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
OpenPOWER on IntegriCloud