summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Added MemIntrinsicNode which is useful to represent target intrinsics thatMon P Wang2008-10-171-2/+59
| | | | | | touches memory and need an associated MemOperand llvm-svn: 57712
* Add a "loses information" return value to APFloat::convertDale Johannesen2008-10-091-9/+14
| | | | | | | and APFloat::convertToInteger. Restore return value to IEEE754. Adjust all users accordingly. llvm-svn: 57329
* Use -1ULL instead of uint64_t(-1), at Anton's suggestion.Dan Gohman2008-10-031-2/+2
| | | | llvm-svn: 57021
* Make some implicit conversions explicit, to avoid compiler warnings.Dan Gohman2008-10-011-2/+2
| | | | llvm-svn: 56927
* Fold trivial two-operand tokenfactors where the operands are equalDan Gohman2008-10-011-0/+1
| | | | | | immediately. llvm-svn: 56921
* Implement the -fno-builtin option in the front-end, not in the back-end.Bill Wendling2008-10-011-6/+1
| | | | llvm-svn: 56900
* - Initialize "--no-builtin" to "false".Bill Wendling2008-09-301-1/+1
| | | | | | - Testcase for r56885. llvm-svn: 56886
* Add the new `-no-builtin' flag. This flag is meant to mimic the GCCBill Wendling2008-09-301-1/+7
| | | | | | | | | `-fno-builtin' flag. Currently, it's used to replace "memset" with "_bzero" instead of "__bzero" on Darwin10+. This arguably violates the meaning of this flag, but is currently sufficient. The meaning of this flag should become more specific over time. llvm-svn: 56885
* Optimize SelectionDAG's AssignTopologicalOrder even further.Dan Gohman2008-09-301-26/+62
| | | | | | | | | | | | | | | | | | | Completely eliminate the TopOrder std::vector. Instead, sort the AllNodes list in place. This also eliminates the need to call AllNodes.size(), a linear-time operation, before performing the sort. Also, eliminate the Sources temporary std::vector, since it essentially duplicates the sorted result as it is being built. This also changes the direction of the topological sort from bottom-up to top-down. The AllNodes list starts out in roughly top-down order, so this reduces the amount of reordering needed. Top-down is also more convenient for Legalize, and ISel needed only minor adjustments. llvm-svn: 56867
* Add "inreg" field to CallSDNode (doesn't increaseDale Johannesen2008-09-261-5/+5
| | | | | | | | | its size). Adjust various lowering functions to pass this info through from CallInst. Use it to implement sseregparm returns on X86. Remove X86_ssecall calling convention. llvm-svn: 56677
* Forgot this part with my last patch. Sorry about the breakage.Bill Wendling2008-09-241-27/+38
| | | | llvm-svn: 56552
* Change SelectionDAG::getConstantPool to always set the alignment of theDan Gohman2008-09-161-0/+6
| | | | | | | | | | | | | | | | | | | | ConstantPoolSDNode, using the target's preferred alignment for the constant type. In LegalizeDAG, when performing loads from the constant pool, the ConstantPoolSDNode's alignment is used in the calls to getLoad and getExtLoad. This change prevents SelectionDAG::getLoad/getExtLoad from incorrectly choosing the ABI alignment for constant pool loads when Alignment == 0. The incorrect alignment is only a performance issue when ABI alignment does not equal preferred alignment (i.e., on x86 it was generating MOVUPS instead of MOVAPS for v4f32 constant loads when the default ABI alignment for 128bit vectors is forced to 1 byte.) Patch by Paul Redmond! llvm-svn: 56253
* Reverting r56249. On further investigation, this functionality isn't needed.Bill Wendling2008-09-161-43/+28
| | | | | | Apologies for the thrashing. llvm-svn: 56251
* - Change "ExternalSymbolSDNode" to "SymbolSDNode".Bill Wendling2008-09-161-28/+43
| | | | | | | | | | - Add linkage to SymbolSDNode (default to external). - Change ISD::ExternalSymbol to ISD::Symbol. - Change ISD::TargetExternalSymbol to ISD::TargetSymbol These changes pave the way to allowing SymbolSDNodes with non-external linkage. llvm-svn: 56249
* Re-enable SelectionDAG CSE for calls. It matters in the case ofDan Gohman2008-09-151-6/+20
| | | | | | libcalls, as in this testcase on ARM. llvm-svn: 56226
* Define CallSDNode, an SDNode subclass for use with ISD::CALL.Dan Gohman2008-09-131-8/+31
| | | | | | | | | | | | | Currently it just holds the calling convention and flags for isVarArgs and isTailCall. And it has several utility methods, which eliminate magic 5+2*i and similar index computations in several places. CallSDNodes are not CSE'd. Teach UpdateNodeOperands to handle nodes that are not CSE'd gracefully. llvm-svn: 56183
* Change ConstantSDNode and ConstantFPSDNode to use ConstantInt* andDan Gohman2008-09-121-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | ConstantFP* instead of APInt and APFloat directly. This reduces the amount of time to create ConstantSDNode and ConstantFPSDNode nodes when ConstantInt* and ConstantFP* respectively are already available, as is the case in SelectionDAGBuild.cpp. Also, it reduces the amount of time to legalize constants into constant pools, and the amount of time to add ConstantFP operands to MachineInstrs, due to eliminating ConstantInt::get and ConstantFP::get calls. It increases the amount of work needed to create new constants in cases where the client doesn't already have a ConstantInt* or ConstantFP*, such as legalize expanding 64-bit integer constants to 32-bit constants. And it adds a layer of indirection for the accessor methods. But these appear to be outweight by the benefits in most cases. It will also make it easier to make ConstantSDNode and ConstantFPNode more consistent with ConstantInt and ConstantFP. llvm-svn: 56162
* Rename ConstantSDNode::getValue to getZExtValue, for consistencyDan Gohman2008-09-121-28/+31
| | | | | | | with ConstantInt. This led to fixing a bug in TargetLowering.cpp using getValue instead of getAPIntValue. llvm-svn: 56159
* Make safer variant of alias resolution routine to be defaultAnton Korobeynikov2008-09-091-1/+1
| | | | llvm-svn: 56005
* Fix the string for ISD::UDIVREM.Dan Gohman2008-09-081-1/+1
| | | | llvm-svn: 55917
* Clean up uses of TargetLowering::getTargetMachine.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55769
* 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
OpenPOWER on IntegriCloud