summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* typoGabor Greif2008-08-301-1/+1
| | | | llvm-svn: 55574
* erect abstraction boundaries for accessing SDValue members, rename Val -> ↵Gabor Greif2008-08-281-90/+90
| | | | | | Node to reflect semantics llvm-svn: 55504
* Split the ATOMIC NodeType's to include the size, e.g.Dale Johannesen2008-08-281-32/+144
| | | | | | | | | | | | | | | | ATOMIC_LOAD_ADD_{8,16,32,64} instead of ATOMIC_LOAD_ADD. Increased the Hardcoded Constant OpActionsCapacity to match. Large but boring; no functional change. This is to support partial-word atomics on ppc; i8 is not a valid type there, so by the time we get to lowering, the ATOMIC_LOAD nodes looks the same whether the type was i8 or i32. The information can be added to the AtomicSDNode, but that is the largest SDNode; I don't fully understand the SDNode allocation, but it is sensitive to the largest node size, so increasing that must be bad. This is the alternative. llvm-svn: 55457
* Reorganize the lifetimes of the major objects SelectionDAGISelDan Gohman2008-08-271-5/+9
| | | | | | | | | | | | | | | | | | | | works with. SelectionDAG, FunctionLoweringInfo, and SelectionDAGLowering objects now get created once per SelectionDAGISel instance, and can be reused across blocks and across functions. Previously, they were created and destroyed each time they were needed. This reorganization simplifies the handling of PHI nodes, and also SwitchCases, JumpTables, and BitTestBlocks. This simplification has the side effect of fixing a bug in FastISel where successor PHI nodes weren't being updated correctly. This is also a step towards making the transition from FastISel into and out of SelectionDAG faster, and also making plain SelectionDAG faster on code with lots of little blocks. llvm-svn: 55450
* disallow direct access to SDValue::ResNo, provide a getter insteadGabor Greif2008-08-261-10/+10
| | | | llvm-svn: 55394
* Optimize SelectionDAG's topological sort to use one pass insteadDan Gohman2008-08-261-12/+7
| | | | | | | | of two, and to not need a scratch std::vector. Also, use the SelectionDAG's topological sort in LegalizeDAG instead of having a separate implementation. llvm-svn: 55389
* Actually recycle SDNode allocations. SelectionDAG is usingDan Gohman2008-08-261-2/+6
| | | | | | | | RecyclingAllocator, but this change is needed for the nodes to actually be recycled. This cuts SelectionDAG's memory usage high-water-mark in half in some cases. llvm-svn: 55351
* make sure to flush the stream after dumping, to make sure it goes out ↵Chris Lattner2008-08-241-0/+1
| | | | | | immediately. llvm-svn: 55288
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-75/+73
| | | | | | | | | | | | | | | | | | | | | | | | use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. llvm-svn: 55263
* Move the point at which FastISel taps into the SelectionDAGISelDan Gohman2008-08-231-15/+35
| | | | | | | | | | | | | | | | | | process up to a higher level. This allows FastISel to leverage more of SelectionDAGISel's infastructure, such as updating Machine PHI nodes. Also, implement transitioning from SDISel back to FastISel in the middle of a block, so it's now possible to go back and forth. This allows FastISel to hand individual CallInsts and other complicated things off to SDISel to handle, while handling the rest of the block itself. To help support this, reorganize the SelectionDAG class so that it is allocated once and reused throughout a function, instead of being completely reallocated for each block. llvm-svn: 55219
* Move SelectionDAG's constructor out of line.Dan Gohman2008-08-231-0/+7
| | | | llvm-svn: 55212
* Add libm-oriented ISD opcodes for rounding operations.Dan Gohman2008-08-211-0/+5
| | | | llvm-svn: 55130
* Elements in DeadNodeSet are checked for use_empty() before theyDan Gohman2008-08-211-1/+0
| | | | | | | are actually deleted, so it's not necessary to remove re-used nodes from the set. llvm-svn: 55123
* Change the FoldingSetNodeID usage for objects which carryDan Gohman2008-08-201-36/+26
| | | | | | | | alignment and volatility information, such as loads and stores, to reduce the number of integer values added to the FoldingSetNodeID. llvm-svn: 55058
* 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
OpenPOWER on IntegriCloud