summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* don't use the result of WriteTypeSymbolic or WriteAsOperand.Chris Lattner2008-08-191-5/+6
| | | | llvm-svn: 54978
* Rework the routines that convert AP[S]Int into a string. Now, instead ofChris Lattner2008-08-171-1/+1
| | | | | | | | | | | | | | | | | returning an std::string by value, it fills in a SmallString/SmallVector passed in. This significantly reduces string thrashing in some cases. More specifically, this: - Adds an operator<< and a print method for APInt that allows you to directly send them to an ostream. - Reimplements APInt::toString to be much simpler and more efficient algorithmically in addition to not thrashing strings quite as much. This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the asmprinter. This also fixes a bug I introduced into the asmwriter in a previous patch w.r.t. alias printing. llvm-svn: 54873
* Improve support for vector casts in LLVM IR and CodeGen.Dan Gohman2008-08-141-2/+26
| | | | llvm-svn: 54784
* Fix a bogus srem rule - a negative value srem'd by a power-of-2Dan Gohman2008-08-131-5/+3
| | | | | | | can have a non-negative result; for example, -16%16 is 0. Also, clarify the related comments. This fixes PR2670. llvm-svn: 54767
* Allow SelectionDAG to create EXTRACT_VECTOR_ELT nodes withDan Gohman2008-08-131-11/+9
| | | | | | | non-constant indices. Only a few of the peephole checks require a constant index. llvm-svn: 54764
* 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
OpenPOWER on IntegriCloud