summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fold the useful features of alist and alist_node into ilist, andDan Gohman2008-07-281-52/+46
| | | | | | | | | | | | | | | | a new ilist_node class, and remove them. Unlike alist_node, ilist_node doesn't attempt to manage storage itself, so it avoids the associated problems, including being opaque in gdb. Adjust the Recycler class so that it doesn't depend on alist_node. Also, change it to use explicit Size and Align parameters, allowing it to work when the largest-sized node doesn't have the greatest alignment requirement. Change MachineInstr's MachineMemOperand list from a pool-backed alist to a std::list for now. llvm-svn: 54146
* Rename SDOperand to SDValue.Dan Gohman2008-07-271-375/+369
| | | | llvm-svn: 54128
* Tidy SDNode::use_iterator, and complete the transition to have itDan Gohman2008-07-271-15/+8
| | | | | | | parallel its analogue, Value::value_use_iterator. The operator* method now returns the user, rather than the use. llvm-svn: 54127
* Rename isOnlyUseOf to isOnlyUserOf.Dan Gohman2008-07-271-2/+2
| | | | llvm-svn: 54124
* Fix grammaros in comments.Dan Gohman2008-07-211-2/+2
| | | | llvm-svn: 53884
* Add VerifyNode, a place to put sanity checks onDuncan Sands2008-07-211-2/+38
| | | | | | | | | | | | generic SDNode's (nodes with their own constructors should do sanity checking in the constructor). Add sanity checks for BUILD_VECTOR and fix all the places that were producing bogus BUILD_VECTORs, as found by "make check". My favorite is the BUILD_VECTOR with only two operands that was being used to build a vector with four elements! llvm-svn: 53850
* Add a new function, ReplaceAllUsesOfValuesWith, which handles bulkDan Gohman2008-07-171-191/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | replacement of multiple values. This is slightly more efficient than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically could be optimized even further. However, an important property of this new function is that it handles the case where the source value set and destination value set overlap. This makes it feasible for isel to use SelectNodeTo in many very common cases, which is advantageous because SelectNodeTo avoids a temporary node and it doesn't require CSEMap updates for users of values that don't change position. Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to handle operand lists more efficiently, and to correctly handle a number of corner cases to which its new wider use exposes it. This commit also includes a change to the encoding of post-isel opcodes in SDNodes; now instead of being sandwiched between the target-independent pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel opcodes are now represented as negative values. This makes it possible to test if an opcode is pre-isel or post-isel without having to know the size of the current target's post-isel instruction set. These changes speed up llc overall by 3% and reduce memory usage by 10% on the InstructionCombining.cpp testcase with -fast and -regalloc=local. llvm-svn: 53728
* SelectionDAG::AssignNodeIds is unused.Dan Gohman2008-07-151-11/+0
| | | | llvm-svn: 53636
* Don't sort SDNodes by their addresses in SelectionDAG::dump. Instead,Dan Gohman2008-07-151-9/+5
| | | | | | | just use the AllNodes order, which is at least relatively stable across runs. llvm-svn: 53632
* Include a frame index in the "fixed stack" pseudo source valueDan Gohman2008-07-111-2/+2
| | | | | | | instead of using the frame index for the SVOffset, which was inconsistent. llvm-svn: 53486
* Don't barf when dumping a constant that containsDuncan Sands2008-07-101-1/+1
| | | | | | a ginormous value (eg: i128 -1). llvm-svn: 53402
* Simplify hasNUsesOfValue and hasAnyUsesOfValue even more. ThisDan Gohman2008-07-091-14/+2
| | | | | | | | | | | makes their special-case checks of use_size() less beneficial, so remove them. This eliminates all but one use of use_size(), which is in AssignTopologicalOrder, which uses it only once for each node, and so can reasonably afford to recompute it, as this allows the UsesSize field of SDNode to be removed altogether. llvm-svn: 53377
* hasAnyUseOfValue can check SDUse nodes of its users directly insteadDan Gohman2008-07-091-13/+3
| | | | | | of examining every operand of every user. llvm-svn: 53374
* Move MemoryVT out of LSBaseNode into MemSDNode, allowing theDan Gohman2008-07-091-28/+16
| | | | | | | getMemOperand function to be moved into the base class as well and made non-virtual. llvm-svn: 53372
* Move the IsVolatile and SVOffset fields into the MemSDNode baseDan Gohman2008-07-091-0/+11
| | | | | | | | | | class, and store IsVolatile and Alignment in a more compact form. This makes AtomicSDNode slightly larger, but it shrinks LoadSDNode and StoreSDNode, which are much more common and are the largest of the SDNode subclasses. Also, this lets the isVolatile() and getAlignment() accessors be non-virtual. llvm-svn: 53361
* Missed alignment argument on stores lowered from memcpy.Evan Cheng2008-07-091-1/+1
| | | | llvm-svn: 53281
* const-ify SelectionDAG::getNodeValueTypes.Dan Gohman2008-07-091-2/+2
| | | | llvm-svn: 53264
* Factor out the code for computing an alignment value, and make itDan Gohman2008-07-081-38/+32
| | | | | | | available to getAtomic in addition to just getLoad and getStore, to prevent MachineMemOperands with 0 alignment. llvm-svn: 53261
* Do not CSE DEBUG_LOC, DBG_LABEL, DBG_STOPPOINT, DECLARE, and EH_LABEL ↵Evan Cheng2008-07-081-19/+38
| | | | | | SDNode's. This improves compile time slightly at -O0 -g. llvm-svn: 53246
* Pool-allocation for SDNodes. The pool is allocated once for each function,Dan Gohman2008-07-071-62/+107
| | | | | | | | | and reused across SelectionDAGs. This drastically reduces the number of calls to malloc/free made during instruction selection, and improves memory locality. llvm-svn: 53211
* Fix SDNode::MorphNodeTo (a function used by by SelectNodeTo) toDan Gohman2008-07-071-43/+50
| | | | | | | properly track dead nodes that are on the original SDNode's operand list but not the new one, and have no other uses. llvm-svn: 53201
* Remove most of the uses of SDOperandPtr, usually replacing it with aDan Gohman2008-07-071-38/+69
| | | | | | | | | | | | | | simple const SDOperand*, which is what's usually needed. For AddNodeIDOperands, which is small, just duplicate the function to accept an SDUse*. For SelectionDAG::getNode - Add an overload that accepts SDUse* that copies the operands into a temporary SDOperand array, but also has special-case checks for 0 through 3 operands to avoid the copy in the common cases. llvm-svn: 53183
* Fixed generating incorrect aligned stores that I backout of r53031Mon P Wang2008-07-051-3/+4
| | | | | | | | that fixed problems in EmitStackConvert where the source and target type have different alignment by creating a stack slot with the max alignment of source and target type. llvm-svn: 53150
* Backed out 53031.Evan Cheng2008-07-031-4/+3
| | | | llvm-svn: 53110
* Avoid unnecessarily copying APInt objects.Dan Gohman2008-07-031-3/+3
| | | | llvm-svn: 53065
* Replace a few uses of SelectionDAG::getTargetNode withDan Gohman2008-07-021-78/+44
| | | | | | | | | | | | SelectionDAG::SelectNodeTo in the instruction selector. This updates existing nodes in place instead of creating new ones. Go back to selecting ISD::DBG_LABEL nodes into TargetInstrInfo::DBG_LABEL nodes instead of leaving them unselected, now that SelectNodeTo allows us to update them in place. llvm-svn: 53057
* Add a new getMergeValues method that does not needDuncan Sands2008-07-021-0/+14
| | | | | | | | | | to be passed the list of value types, and use this where appropriate. Inappropriate places are where the value type list is already known and may be long, in which case the existing method is more efficient. llvm-svn: 53035
* Fixed problem in EmitStackConvert where the source and target typeMon P Wang2008-07-021-3/+4
| | | | | | | have different alignment by creating a stack slot with the max alignment of source and target type. llvm-svn: 53031
* instead of aborting on shifts of i1, just implicitly fold them.Chris Lattner2008-07-021-1/+7
| | | | | | The dag combiner can produce a shift of i1 when folding icmp i1's. llvm-svn: 53030
* No need to use std::distance. We can just count the number of operandsOwen Anderson2008-07-011-1/+4
| | | | | | much more cheaply. llvm-svn: 52990
* Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminatingDan Gohman2008-07-011-12/+30
| | | | | | | | | | | | | | | | the need for a flavor operand, and add a new SDNode subclass, LabelSDNode, for use with them to eliminate the need for a label id operand. Change instruction selection to let these label nodes through unmodified instead of creating copies of them. Teach the MachineInstr emitter how to emit a MachineInstr directly from an ISD label node. This avoids the need for allocating SDNodes for the label id and flavor value, as well as SDNodes for each of the post-isel label, label id, and label flavor. llvm-svn: 52943
* Rename ISD::LOCATION to ISD::DBG_STOPPOINT to better reflect itsDan Gohman2008-06-301-15/+27
| | | | | | | | | | | | | | | | | purpose, and give it a custom SDNode subclass so that it doesn't need to have line number, column number, filename string, and directory string, all existing as individual SDNodes to be the operands. This was the only user of ISD::STRING, StringSDNode, etc., so remove those and some associated code. This makes stop-points considerably easier to read in -view-legalize-dags output, and reduces overhead (creating new nodes and copying std::strings into them) on code containing debugging information. llvm-svn: 52924
* Revert the SelectionDAG optimization that makesDuncan Sands2008-06-301-2/+1
| | | | | | | | | | | | | | | | | | it impossible to create a MERGE_VALUES node with only one result: sometimes it is useful to be able to create a node with only one result out of one of the results of a node with more than one result, for example because the new node will eventually be used to replace a one-result node using ReplaceAllUsesWith, cf X86TargetLowering::ExpandFP_TO_SINT. On the other hand, most users of MERGE_VALUES don't need this and for them the optimization was valuable. So add a new utility method getMergeValues for creating MERGE_VALUES nodes which by default performs the optimization. Change almost everywhere to use getMergeValues (and tidy some stuff up at the same time). llvm-svn: 52893
* - Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an ↵Evan Cheng2008-06-301-29/+34
| | | | | | | | empty string for ConstantAggregateZero case which surprises selectiondag. - Correctly handle memcpy from constant string which is zero-initialized. llvm-svn: 52891
* Revert (52748 and friends):Anton Korobeynikov2008-06-291-7/+13
| | | | | | | | | | | | Move GetConstantStringInfo to lib/Analysis. Remove string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. This unbreaks llvm-gcc bootstrap. llvm-svn: 52884
* Really fix the bootstrap failure.Chris Lattner2008-06-281-9/+5
| | | | llvm-svn: 52854
* Add back the capability to include nul characters in strings with Chris Lattner2008-06-281-1/+1
| | | | | | | GetConstantStringInfo. This will hopefully restore llvm-gcc to happy bootstrap land. llvm-svn: 52851
* simplify this check, GetConstantStringInfo validates that aChris Lattner2008-06-271-5/+3
| | | | | | global is constant already. No functionality change. llvm-svn: 52812
* Move GetConstantStringInfo to lib/Analysis. RemoveEric Christopher2008-06-261-2/+2
| | | | | | | | | string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. llvm-svn: 52748
* - Fix a x86 vector isel bug: illegal transformation of a vector_shuffle into aEvan Cheng2008-06-251-11/+11
| | | | | | | | shift. - Add a readme entry for a missing vector_shuffle optimization that results in awful codegen. llvm-svn: 52740
* Add support for expanding PPC 128 bit floats.Duncan Sands2008-06-251-4/+3
| | | | | | | | | | | | | | | | | | | | For this it is convenient to permit floats to be used with EXTRACT_ELEMENT, so I tweaked things to allow that. I also added libcalls for ppcf128 to i32 forms of FP_TO_XINT, since they exist in libgcc and this case can certainly occur (and does occur in the testsuite) - before the i64 libcall was being used. Also, the XINT_TO_FP result seemed to be wrong when the argument is an i128: the wrong fudge factor was added (the i32 and i64 cases were handled directly, but the i128 code fell through to some generic softening code which seemed to think it was i64 to f32!). So I fixed it by adding a fudge factor that I found in my breakfast cereal. llvm-svn: 52739
* Remove the OrigVT member from AtomicSDNode, as it is redundant withDan Gohman2008-06-251-7/+5
| | | | | | the base SDNode's VTList. llvm-svn: 52722
* Added MemOperands to Atomic operations since Atomics touches memory.Mon P Wang2008-06-251-13/+66
| | | | | | | | Added abstract class MemSDNode for any Node that have an associated MemOperand Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and atomic.lss => atomic.load.sub llvm-svn: 52706
* Use clear() to zero an existing APInt.Dan Gohman2008-06-211-1/+1
| | | | llvm-svn: 52601
* add missing atomic intrinsic from gccAndrew Lenharth2008-06-141-0/+2
| | | | llvm-svn: 52270
* Sometimes (rarely) nodes held in LegalizeTypesDuncan Sands2008-06-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | maps can be deleted. This happens when RAUW replaces a node N with another equivalent node E, deleting the first node. Solve this by adding (N, E) to ReplacedNodes, which is already used to remap nodes to replacements. This means that deleted nodes are being allowed in maps, which can be delicate: the memory may be reused for a new node which might get confused with the old deleted node pointer hanging around in the maps, so detect this and flush out maps if it occurs (ExpungeNode). The expunging operation is expensive, however it never occurs during a llvm-gcc bootstrap or anywhere in the nightly testsuite. It occurs three times in "make check": Alpha/illegal-element-type.ll, PowerPC/illegal-element-type.ll and X86/mmx-shift.ll. If expunging proves to be too expensive then there are other more complicated ways of solving the problem. In the normal case this patch adds the overhead of a few more map lookups, which is hopefully negligable. llvm-svn: 52214
* Remove comparison methods for MVT. The main causeDuncan Sands2008-06-081-21/+15
| | | | | | | | | | | of apint codegen failure is the DAG combiner doing the wrong thing because it was comparing MVT's using < rather than comparing the number of bits. Removing the < method makes this mistake impossible to commit. Instead, add helper methods for comparing bits and use them. llvm-svn: 52098
* Tighten up the abstraction slightly.Duncan Sands2008-06-061-10/+10
| | | | llvm-svn: 52045
* Wrap MVT::ValueType in a struct to get type safetyDuncan Sands2008-06-061-274/+260
| | | | | | | | | | | | | | | | and better control the abstraction. Rename the type to MVT. To update out-of-tree patches, the main thing to do is to rename MVT::ValueType to MVT, and rewrite expressions like MVT::getSizeInBits(VT) in the form VT.getSizeInBits(). Use VT.getSimpleVT() to extract a MVT::SimpleValueType for use in switch statements (you will get an assert failure if VT is an extended value type - these shouldn't exist after type legalization). This results in a small speedup of codegen and no new testsuite failures (x86-64 linux). llvm-svn: 52044
* Fix a memcpy lowering bug. Even though the memcpy alignment is smaller than ↵Evan Cheng2008-06-041-2/+3
| | | | | | the desired alignment, the frame destination alignment may still be larger than the desired alignment. Don't change its alignment to something smaller. llvm-svn: 51970
OpenPOWER on IntegriCloud