summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* In the case of an extractelement on an insertelement value,Dan Gohman2009-01-291-1/+5
| | | | | | | the element indices may be equal if either one is not a constant. llvm-svn: 63311
* Revert r63273. This was already implemented by Dale. There's no need for myBill Wendling2009-01-291-72/+101
| | | | | | change. llvm-svn: 63301
* - Add DebugLoc to getTargetNode(). Bill Wendling2009-01-291-101/+72
| | | | | | | | | - Modify TableGen to add the DebugLoc when calling getTargetNode. (The light-weight wrappers are only temporary. The non-DebugLoc version will be removed once the whole debug info stuff is finished with.) llvm-svn: 63273
* Add DebugLoc-sensitive versions of many node creationDale Johannesen2009-01-291-0/+458
| | | | | | functions. Currently omitted: memcpy, memmove, memset. llvm-svn: 63259
* Add DebugLoc to the getNode() methods.Bill Wendling2009-01-281-41/+134
| | | | llvm-svn: 63245
* Add DebugLoc-aware constructors for SDNode derivedDale Johannesen2009-01-281-0/+23
| | | | | | | classes (those that reasonably have a DebugLoc associated with them). llvm-svn: 63236
* Add an assertion to the form of SelectionDAG::getConstant that takesDan Gohman2009-01-271-0/+3
| | | | | | | | a uint64_t to verify that the value is in range for the given type, to help catch accidental overflow. Fix a few places that relied on getConstant implicitly truncating the value. llvm-svn: 63128
* Take the next steps in making SDUse more consistent with LLVM Use, andDan Gohman2009-01-261-80/+63
| | | | | | | | | | | | | | | | | tidy up SDUse and related code. - Replace the operator= member functions with a set method, like LLVM Use has, and variants setInitial and setNode, which take care up updating use lists, like LLVM Use's does. This simplifies code that calls these functions. - getSDValue() is renamed to get(), as in LLVM Use, though most places can either use the implicit conversion to SDValue or the convenience functions instead. - Fix some more node vs. value terminology issues. Also, eliminate the one remaining use of SDOperandPtr, and SDOperandPtr itself. llvm-svn: 62995
* Eliminate the loop that searches through each of the operandsDan Gohman2009-01-251-195/+178
| | | | | | | | | | | of each use in the SelectionDAG ReplaceAllUses* functions. Thanks to Chris for spotting this opportunity. Also, factor out code from all 5 of the ReplaceAllUses* functions into AddNonLeafNodeToCSEMaps, which is now renamed AddModifiedNodeToCSEMaps to more accurately reflect its purpose. llvm-svn: 62964
* Whitespace tidiments.Dan Gohman2009-01-251-2/+1
| | | | llvm-svn: 62963
* Move the N->use_empty() assert from DeleteNode toDan Gohman2009-01-251-3/+2
| | | | | | | DeleteNodeNotInCSEMaps, since DeleteNode just calls DeleteNodeNotInCSEMaps. llvm-svn: 62962
* Fold x-0 to x in unsafe-fp-math mode. This comes up in theDan Gohman2009-01-231-9/+16
| | | | | | | | | | | | | | testcase from PR3376, and in fact is sufficient to completely avoid the problem in that testcase. There's an underlying problem though; TLI.isOperationLegal considers Custom to be Legal, which might be ok in some cases, but that's what DAGCombiner is using in many places to test if something is legal when LegalOperations is true. When DAGCombiner is running after legalize, this isn't sufficient. I'll address this in a separate commit. llvm-svn: 62860
* Don't create ISD::FNEG nodes after legalize if they aren't legal.Dan Gohman2009-01-221-2/+13
| | | | | | | | | | | | | | Simplify x+0 to x in unsafe-fp-math mode. This avoids a bunch of redundant work in many cases, because in unsafe-fp-math mode, ISD::FADD with a constant is considered free to negate, so the DAGCombiner often negates x+0 to -0-x thinking it's free, when in reality the end result is -x, which is more expensive than x. Also, combine x*0 to 0. This fixes PR3374. llvm-svn: 62789
* Add SelectionDAG::getNOT method to construct bitwise NOT operations,Bob Wilson2009-01-221-0/+15
| | | | | | | corresponding to the "not" and "vnot" PatFrags. Use the new method in some places where it seems appropriate. llvm-svn: 62768
* fix a typoChris Lattner2009-01-221-1/+1
| | | | llvm-svn: 62761
* Remove SDNode's virtual destructor. This makes it impossible forDan Gohman2009-01-191-53/+14
| | | | | | | | | | | | | | SDNode subclasses to keep state that requires non-trivial destructors, however it was already effectively impossible, since the destructor isn't actually ever called. There currently aren't any SDNode subclasses affected by this, and in general it's desireable to keep SDNode objects light-weight. This eliminates the last virtual member function in the SDNode class, so it eliminates the need for a vtable pointer, making SDNode smaller. llvm-svn: 62539
* Fix SelectionDAG::ReplaceAllUsesWith to behave correctly whenDan Gohman2009-01-191-6/+19
| | | | | | | | | | | | | uses are added to the From node while it is processing From's use list, because of automatic local CSE. The fix is to avoid visiting any new uses. Fix a few places in the DAGCombiner that assumed that after a RAUW call, the From node has no users and may be deleted. This fixes PR3018. llvm-svn: 62533
* More consts on TargetLowering references.Dan Gohman2009-01-151-1/+1
| | | | llvm-svn: 62262
* Removoe MachineModuleInfo methods (and related DebugInfoDesc class ↵Devang Patel2009-01-131-1/+1
| | | | | | hierarchy) that were used to handle debug info. llvm-svn: 62199
* Undo previous checkin.Devang Patel2009-01-131-3/+2
| | | | llvm-svn: 62190
* Use dwarf writer to decide whether the module has debug info or not.Devang Patel2009-01-131-2/+3
| | | | llvm-svn: 62184
* Use DebugInfo interface to lower dbg_* intrinsics.Devang Patel2009-01-131-2/+2
| | | | llvm-svn: 62127
* Request DwarfWriter. This will be used to handle dbg_* intrinsics.Devang Patel2009-01-091-1/+3
| | | | llvm-svn: 61999
* Clean up the atomic opcodes in SelectionDAG.Dan Gohman2008-12-231-150/+47
| | | | | | | | | | | | | This removes all the _8, _16, _32, and _64 opcodes and replaces each group with an unsuffixed opcode. The MemoryVT field of the AtomicSDNode is now used to carry the size information. In tablegen, the size-specific opcodes are replaced by size-independent opcodes that utilize the ability to compose them with predicates. This shrinks the per-opcode tables and makes the code that handles atomics much more concise. llvm-svn: 61389
* Avoid generating a convert_rndsat node when the src and dest type are the same.Mon P Wang2008-12-111-0/+4
| | | | llvm-svn: 60869
* Add sub/mul overflow intrinsics. This currently doesn't have aBill Wendling2008-12-091-0/+12
| | | | | | | target-independent way of determining overflow on multiplication. It's very tricky. Patch by Zoltan Varga! llvm-svn: 60800
* Fix PR3117: not all nodes being legalized. TheDuncan Sands2008-12-091-0/+16
| | | | | | | | | | | | | | | | | | | | | | | essential problem was that the DAG can contain random unused nodes which were never analyzed. When remapping a value of a node being processed, such a node may become used and need to be analyzed; however due to operands being transformed during analysis the node may morph into a different one. Users of the morphing node need to be updated, and this wasn't happening. While there I added a bunch of documentation and sanity checks, so I (or some other poor soul) won't have to scratch their head over this stuff so long trying to remember how it was all supposed to work next time some obscure problem pops up! The extra sanity checking exposed a few places where invariants weren't being preserved, so those are fixed too. Since some of the sanity checking is expensive, I added a flag to turn it on. It is also turned on when building with ENABLE_EXPENSIVE_CHECKS=1. llvm-svn: 60797
* Fix getNode to allow a vector for the shift amount for shifts of vectors.Mon P Wang2008-12-091-2/+4
| | | | | | | | Fix the shift amount when unrolling a vector shift into scalar shifts. Fix problem in getShuffleScalarElt where it assumes that the input of a bit convert must be a vector. llvm-svn: 60740
* When allocating a stack temporary, use the correctDuncan Sands2008-12-041-1/+1
| | | | | | | number of bytes for types such as i1 which are not a multiple of 8 bits in length. llvm-svn: 60543
* Expand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value ↵Bill Wendling2008-12-011-0/+33
| | | | | | types. llvm-svn: 60381
* There are no longer any places that require aDuncan Sands2008-12-011-4/+4
| | | | | | | | MERGE_VALUES node with only one operand, so get rid of special code that only existed to handle that possibility. llvm-svn: 60349
* Eliminate some unused variable compile time warnings.Evan Cheng2008-11-241-0/+2
| | | | llvm-svn: 59952
* Rename SetCCResultContents to BooleanContents. InDuncan Sands2008-11-231-5/+5
| | | | | | | practice these booleans are mostly produced by SetCC, however the concept is more general. llvm-svn: 59911
* Cleanup of the [SU]ADDO type legalization code. Patch by Duncan!Bill Wendling2008-11-221-1/+11
| | | | | | | | | | "It simplifies the type legalization part a bit, and produces better code by teaching SelectionDAG about the extra bits in an i8 SADDO/UADDO node. In essence, I spontaneously decided that on x86 this i8 boolean result would be either 0 or 1, and on other platforms 0/1 or 0/-1, depending on whether the platform likes it's boolean zero extended or sign extended." llvm-svn: 59864
* Update comments.Dan Gohman2008-11-211-3/+3
| | | | llvm-svn: 59834
* Rename "ADDO" to "SADDO" and "UADDO". The "UADDO" isn't equivalent to "ADDC"Bill Wendling2008-11-211-1/+2
| | | | | | | because the boolean it returns to indicate an overflow may not be treated like as a flag. It could be stored to memory, for instance. llvm-svn: 59780
* Implement the sadd_with_overflow intrinsic. This is converted intoBill Wendling2008-11-211-2/+1
| | | | | | | | "ISD::ADDO". ISD::ADDO is lowered into a target-independent form that does the addition and then checks if the result is less than one of the operands. (If it is, then there was an overflow.) llvm-svn: 59779
* Add UADDO and SADDO nodes. These will be used for determining an overflowBill Wendling2008-11-211-0/+2
| | | | | | condition in an addition operation. llvm-svn: 59760
* Added CONVERT_RNDSAT (conversion with rounding and saturation) SDNode toMon P Wang2008-11-101-0/+31
| | | | | | | support targets that support these conversions. Users should avoid using this node as the current targets don't generating code for it. llvm-svn: 59001
* Added support for the following definition of shufflevector Mon P Wang2008-11-101-1/+2
| | | | | | <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> llvm-svn: 58964
* Fix PR2986: do not use a potentially illegalDuncan Sands2008-10-301-1/+6
| | | | | | | | | | type for the shift amount type. Add a check that shifts and rotates use the type returned by getShiftAmountTy for the amount. This exposed some problems in CellSPU and PPC, which have already been fixed. llvm-svn: 58455
* Add sanity checking for BUILD_PAIR (I noticed theDuncan Sands2008-10-291-4/+18
| | | | | | | | | other day that PPC custom lowering could create a BUILD_PAIR of two f64 with a result type of... f64! - already fixed). Fix a place that triggers the sanity check. llvm-svn: 58378
* fix some whitespace stuffChris Lattner2008-10-281-3/+3
| | | | llvm-svn: 58319
* Fix UpdateNodeOperands so that it does CSE of callsDuncan Sands2008-10-271-86/+52
| | | | | | | | | (and a bunch of other node types). While there, I added a doNotCSE predicate and used it to reduce code duplication (some of the duplicated code was wrong...). This fixes ARM/cse-libcalls.ll when using LegalizeTypes. llvm-svn: 58249
* Initialize uninitialized variable.Dale Johannesen2008-10-241-1/+1
| | | | llvm-svn: 58057
* Temporarily allow the operands of a BUILD_VECTORDuncan Sands2008-10-221-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | to have a different type to the vector element type. This should be fairly harmless because in the past guys like this were being built all over the place (and were cleaned up when I added this check). The reason for relaxing this check is that it helps LegalizeTypes legalize vector shuffles: the mask is a BUILD_VECTOR that it is *not always possible* to legalize while keeping it a BUILD_VECTOR (vector_shuffle requires the mask to be a BUILD_VECTOR, as opposed to a vector with the right vector type). With this check it is even harder to legalize the mask - turning the check off means that LegalizeTypes manages to legalize almost all vector shuffles encountered in practice. The correct solution is to change vector_shuffle to be a variadic node with the mask built into it as operands. While waiting for that change, this hack stops the problem with vector_shuffle from blocking the turning on of LegalizeTypes. llvm-svn: 57965
* Don't create TargetGlobalAddress nodes with offsets that don't fitDan Gohman2008-10-211-1/+1
| | | | | | | | | | | | | | in the 32-bit signed offset field of addresses. Even though this may be intended, some linkers refuse to relocate code where the relocated address computation overflows. Also, fix the sign-extension of constant offsets to use the actual pointer size, rather than the size of the GlobalAddress node, which may be different, for example on x86-64 where MVT::i32 is used when the address is being fit into the 32-bit displacement field. llvm-svn: 57885
* Set N->OperandList to 0 after deletion. Otherwise, it's possible that it willBill Wendling2008-10-191-15/+26
| | | | | | be either deleted or referenced afterwards. llvm-svn: 57786
* Don't truncate GlobalAddress offsets to int in debug output.Dan Gohman2008-10-181-1/+1
| | | | llvm-svn: 57770
* Teach DAGCombine to fold constant offsets into GlobalAddress nodes,Dan Gohman2008-10-181-2/+8
| | | | | | | | | | | | | | | | | | | | | | and add a TargetLowering hook for it to use to determine when this is legal (i.e. not in PIC mode, etc.) This allows instruction selection to emit folded constant offsets in more cases, such as the included testcase, eliminating the need for explicit arithmetic instructions. This eliminates the need for the C++ code in X86ISelDAGToDAG.cpp that attempted to achieve the same effect, but wasn't as effective. Also, fix handling of offsets in GlobalAddressSDNodes in several places, including changing GlobalAddressSDNode's offset from int to int64_t. The Mips, Alpha, Sparc, and CellSPU targets appear to be unaware of GlobalAddress offsets currently, so set the hook to false on those targets. llvm-svn: 57748
OpenPOWER on IntegriCloud