summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Properly handle sdiv / udiv / srem / urem libcallsAnton Korobeynikov2009-05-031-0/+4
| | | | llvm-svn: 70764
* Proper name 16 bit libcallsAnton Korobeynikov2009-05-031-4/+4
| | | | llvm-svn: 70750
* Allow CONCAT_VECTORS nodes to be legal or have custom lowering for some targets.Bob Wilson2009-05-011-0/+1
| | | | | | Changes to take advantage of this will come later. llvm-svn: 70560
* Move helper functions for optimizing division by constant into the APIntJay Foad2009-04-301-101/+2
| | | | | | class. llvm-svn: 70488
* Disable the load-shrinking optimization from looking atChris Lattner2009-04-291-3/+6
| | | | | | | | | | | anything larger than 64-bits, avoiding a crash. This should really be fixed to use APInts, though type legalization happens to help us out and we get good code on the attached testcase at least. This fixes rdar://6836460 llvm-svn: 70360
* Fix PR3898, which manifests as failures on are an Xcore,Chris Lattner2009-04-181-1/+1
| | | | | | patch by Jakob Stoklund Olesen! llvm-svn: 69472
* Implement support for using modeling implicit-zero-extension on x86-64Dan Gohman2009-04-081-3/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with SUBREG_TO_REG, teach SimpleRegisterCoalescing to coalesce SUBREG_TO_REG instructions (which are similar to INSERT_SUBREG instructions), and teach the DAGCombiner to take advantage of this on targets which support it. This eliminates many redundant zero-extension operations on x86-64. This adds a new TargetLowering hook, isZExtFree. It's similar to isTruncateFree, except it only applies to actual definitions, and not no-op truncates which may not zero the high bits. Also, this adds a new optimization to SimplifyDemandedBits: transform operations like x+y into (zext (add (trunc x), (trunc y))) on targets where all the casts are no-ops. In contexts where the high part of the add is explicitly masked off, this allows the mask operation to be eliminated. Fix the DAGCombiner to avoid undoing these transformations to eliminate casts on targets where the casts are no-ops. Also, this adds a new two-address lowering heuristic. Since two-address lowering runs before coalescing, it helps to be able to look through copies when deciding whether commuting and/or three-address conversion are profitable. Also, fix a bug in LiveInterval::MergeInClobberRanges. It didn't handle the case that a clobber range extended both before and beyond an existing live range. In that case, multiple live ranges need to be added. This was exposed by the new subreg coalescing code. Remove 2008-05-06-SpillerBug.ll. It was bugpoint-reduced, and the spiller behavior it was looking for no longer occurrs with the new instruction selection. llvm-svn: 68576
* Fix a TargetLowering optimization so that it doesn't duplicateDan Gohman2009-04-031-0/+1
| | | | | | loads when an input node has multiple uses. llvm-svn: 68398
* Make check in CheckTailCallReturnConstraints for ignorable instructions betweenArnold Schwaighofer2009-03-281-18/+32
| | | | | | | a CALL and a RET node more generic. Add a test for tail calls with a void return. llvm-svn: 67943
* Enable tail call optimization for functions that return a struct (bug 3664) ↵Arnold Schwaighofer2009-03-281-0/+24
| | | | | | and for functions that return types that need extending (e.g i1). llvm-svn: 67934
* Introduce new linkage types linkonce_odr, weak_odr, common_odrDuncan Sands2009-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | and extern_weak_odr. These are the same as the non-odr versions, except that they indicate that the global will only be overridden by an *equivalent* global. In C, a function with weak linkage can be overridden by a function which behaves completely differently. This means that IP passes have to skip weak functions, since any deductions made from the function definition might be wrong, since the definition could be replaced by something completely different at link time. This is not allowed in C++, thanks to the ODR (One-Definition-Rule): if a function is replaced by another at link-time, then the new function must be the same as the original function. If a language knows that a function or other global can only be overridden by an equivalent global, it can give it the weak_odr linkage type, and the optimizers will understand that it is alright to make deductions based on the function body. The code generators on the other hand map weak and weak_odr linkage to the same thing. llvm-svn: 66339
* The DAG combiner was performing a BT combine. The BT combine had a value of -1,Bill Wendling2009-03-041-11/+22
| | | | | | | | | | | | so it changed it into a 31 via the TLO.ShrinkDemandedConstant() call. Then it would go through the DAG combiner again. This time it had a value of 31, which was turned into a -1 by TLI.SimplifyDemandedBits(). This would ping pong forever. Teach the TLO.ShrinkDemandedConstant() call not to lower a value if the demanded value is an XOR of all ones. llvm-svn: 65985
* Refactor TLS code and add some tests. The tests and expected results are:Rafael Espindola2009-02-271-0/+22
| | | | | | | | | | | | | | | | | | | | | pic | declaration | linkage | visibility | !pic | declaration | external | default | tls1.ll tls2.ll | local exec pic | declaration | external | default | tls1-pic.ll tls2-pic.ll | general dynamic !pic | !declaration | external | default | tls3.ll tls4.ll | initial exec pic | !declaration | external | default | tls3-pic.ll tls4-pic.ll | general dynamic !pic | declaration | external | hidden | tls7.ll tls8.ll | local exec pic | declaration | external | hidden | X | local dynamic !pic | !declaration | external | hidden | tls9.ll tls10.ll | local exec pic | !declaration | external | hidden | X | local dynamic !pic | declaration | internal | default | tls5.ll tls6.ll | local exec pic | declaration | internal | default | X | local dynamic The ones marked with an X have not been implemented since local dynamic is not implemented. llvm-svn: 65632
* Don't assume that a left-shift of a value with one bit set will haveDan Gohman2009-02-151-6/+23
| | | | | | | | one bit set, because the bit may be shifted off the end. Instead, just check for a constant 1 being shifted. This is still sufficient to handle all the cases in test/CodeGen/X86/bt.ll. This fixes PR3583. llvm-svn: 64622
* Arrange to print constants that match "n" and "i" constraintsDale Johannesen2009-02-121-2/+5
| | | | | | | | in inline asm as signed (what gcc does). Add partial support for x86-specific "e" and "Z" constraints, with appropriate signedness for printing. llvm-svn: 64400
* Make a transformation added in 63266 a bit less aggressive.Dale Johannesen2009-02-111-5/+9
| | | | | | | | | | | It was transforming (x&y)==y to (x&y)!=0 in the case where y is variable and known to have at most one bit set (e.g. z&1). This is not correct; the expressions are not equivalent when y==0. I believe this patch salvages what can be salvaged, including all the cases in bt.ll. Dan, please review. Fixes gcc.c-torture/execute/20040709-[12].c llvm-svn: 64314
* Use getDebugLoc forwarder instead of getNode()->getDebugLoc.Dale Johannesen2009-02-071-1/+1
| | | | | | No functional change. llvm-svn: 64026
* Get rid of the last non-DebugLoc versions of getNode!Dale Johannesen2009-02-071-1/+1
| | | | | | | | | | | | Many targets build placeholder nodes for special operands, e.g. GlobalBaseReg on X86 and PPC for the PIC base. There's no sensible way to associate debug info with these. I've left them built with getNode calls with explicit DebugLoc::getUnknownLoc operands. I'm not too happy about this but don't see a good improvement; I considered adding a getPseudoOperand or something, but it seems to me that'll just make it harder to read. llvm-svn: 63992
* Remove more non-DebugLoc getNode variants. UseDale Johannesen2009-02-061-3/+2
| | | | | | | | getCALLSEQ_{END,START} to permit passing no DebugLoc there. UNDEF doesn't logically have DebugLoc; add getUNDEF to encapsulate this. llvm-svn: 63978
* Remove more non-DebugLoc versions of getNode.Dale Johannesen2009-02-061-3/+4
| | | | llvm-svn: 63969
* Propagation in TargetLowering. Includes passing a DLDale Johannesen2009-02-031-89/+105
| | | | | | into SimplifySetCC which gets called elsewhere. llvm-svn: 63583
* Fix PR3401: when using large integers, the typeDuncan Sands2009-01-311-3/+5
| | | | | | | | | | | | | returned by getShiftAmountTy may be too small to hold shift values (it is an i8 on x86-32). Before and during type legalization, use a large but legal type for shift amounts: getPointerTy; afterwards use getShiftAmountTy, fixing up any shift amounts with a big type during operation legalization. Thanks to Dan for writing the original patch (which I shamelessly pillaged). llvm-svn: 63482
* Get rid of the non-DebugLoc-ified getNOT() method.Bill Wendling2009-01-301-5/+5
| | | | llvm-svn: 63442
* Fix two typos that Duncan spotted in a comment.Dan Gohman2009-01-291-1/+1
| | | | llvm-svn: 63312
* Make x86's BT instruction matching more thorough, and add someDan Gohman2009-01-291-1/+42
| | | | | | | | | dagcombines that help it match in several more cases. Add several more cases to test/CodeGen/X86/bt.ll. This doesn't yet include matching for BT with an immediate operand, it just covers more register+register cases. llvm-svn: 63266
* Make isOperationLegal do what its name suggests, and introduce aDan Gohman2009-01-281-4/+4
| | | | | | | | | | | | | | | new isOperationLegalOrCustom, which does what isOperationLegal previously did. Update a bunch of callers to use isOperationLegalOrCustom instead of isOperationLegal. In some case it wasn't obvious which behavior is desired; when in doubt I changed then to isOperationLegalOrCustom as that preserves their previous behavior. This is for the second half of PR3376. llvm-svn: 63212
* Add SelectionDAG::getNOT method to construct bitwise NOT operations,Bob Wilson2009-01-221-14/+14
| | | | | | | corresponding to the "not" and "vnot" PatFrags. Use the new method in some places where it seems appropriate. llvm-svn: 62768
* Few targets like PIC16 wants libcall generation for illegal type i16.Sanjiv Gupta2009-01-181-0/+4
| | | | llvm-svn: 62467
* Make getWidenVectorType const; this file was missed in theDan Gohman2009-01-151-1/+1
| | | | | | previous commit. llvm-svn: 62266
* TargetLowering.h #includes SelectionDAGNodes.h, so it doesn't need itsDan Gohman2009-01-051-2/+0
| | | | | | | own OpActionsCapacity magic number; it can just use ISD::BUILTIN_OP_END, as long as it takes care to round up when needed. llvm-svn: 61733
* Fix PR3274: when promoting the condition of a BRCOND node,Duncan Sands2009-01-011-1/+1
| | | | | | | | | | promote from i1 all the way up to the canonical SetCC type. In order to discover an appropriate type to use, pass MVT::Other to getSetCCResultType. In order to be able to do this, change getSetCCResultType to take a type as an argument, not a value (this is also more logical). llvm-svn: 61542
* Added support for vector widening.Mon P Wang2008-12-181-2/+26
| | | | llvm-svn: 61209
* Followup to r60283: optimize arbitrary width signed divisions as well Eli Friedman2008-11-301-71/+34
| | | | | | as unsigned divisions. Same caveats as before. llvm-svn: 60284
* Fix for PR2164: allow transforming arbitrary-width unsigned divides intoEli Friedman2008-11-301-95/+65
| | | | | | | | | | | multiplies. Some more cleverness would be nice, though. It would be nice if we could do this transformation on illegal types. Also, we would prefer a narrower constant when possible so that we can use a narrower multiply, which can be cheaper. llvm-svn: 60283
* APIntify a test which is potentially unsafe otherwise, and fix the Eli Friedman2008-11-301-3/+10
| | | | | | | | | nearby FIXME. I'm not sure what the right way to fix the Cell test was; if the approach I used isn't okay, please let me know. llvm-svn: 60277
* Rename SetCCResultContents to BooleanContents. InDuncan Sands2008-11-231-1/+1
| | | | | | | practice these booleans are mostly produced by SetCC, however the concept is more general. llvm-svn: 59911
* Fix the testb optimization so x86 also bootstraps.Dale Johannesen2008-11-121-3/+1
| | | | | | Reenable test. llvm-svn: 59101
* Temporarily revert r58979 and related patch. It's causing a failure in X86 ↵Bill Wendling2008-11-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | bootstrap: Comparing stages 2 and 3 warning: ./cc1-checksum.o differs warning: ./cc1obj-checksum.o differs warning: ./cc1objplus-checksum.o differs warning: ./cc1plus-checksum.o differs Bootstrap comparison failure! ./alias.o differs ./alloc-pool.o differs ./attribs.o differs ./bb-reorder.o differs ./bitmap.o differs ./build/errors.o differs ./build/genattrtab.o differs ./build/genautomata.o differs ./build/genemit.o differs ./build/genextract.o differs ... -bw llvm-svn: 59003
* Really fix testb optimization on big-endian.Dale Johannesen2008-11-101-5/+8
| | | | | | Fixes ppc32 bootstrap. llvm-svn: 58979
* Temporarily revert 58825, which breaks PPC bootstrap.Dale Johannesen2008-11-091-1/+3
| | | | | | xs llvm-svn: 58930
* Make testb optimization work on big-endian targets.Dale Johannesen2008-11-081-1/+4
| | | | llvm-svn: 58874
* When we're doing a compare of load-AND-constant to 0Dale Johannesen2008-11-071-0/+46
| | | | | | | | | (e.g. a bitfield test) narrow the load as much as possible. The has the potential to avoid unnecessary partial-word load-after-store conflicts, which cause stalls on several targets. Also a size win on x86 (testb vs testl). llvm-svn: 58825
* Widening cleanupMon P Wang2008-11-061-1/+1
| | | | llvm-svn: 58796
* Add initial support for vector widening. Logic is set to widen for X86.Mon P Wang2008-10-301-1/+15
| | | | | | | One will only see an effect if legalizetype is not active. Will move support to LegalizeType soon. llvm-svn: 58426
* Teach DAGCombine to fold constant offsets into GlobalAddress nodes,Dan Gohman2008-10-181-0/+17
| | | | | | | | | | | | | | | | | | | | | | 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
* Keep track of *which* input constraint matches an outputChris Lattner2008-10-171-3/+3
| | | | | | | constraint. Reject asms where an output has multiple input constraints tied to it. llvm-svn: 57687
* add an assert so that PR2356 explodes instead of running off anChris Lattner2008-10-171-0/+15
| | | | | | | array. Improve some minor comments, refactor some helpers in AsmOperandInfo. No functionality change for valid code. llvm-svn: 57686
* - Add target lowering hooks that specify which setcc conditions are illegal,Evan Cheng2008-10-151-0/+1
| | | | | | | | | | | i.e. conditions that cannot be checked with a single instruction. For example, SETONE and SETUEQ on x86. - Teach legalizer to implement *illegal* setcc as a and / or of a number of legal setcc nodes. For now, only implement FP conditions. e.g. SETONE is implemented as SETO & SETNE, SETUEQ is SETUO | SETEQ. - Move x86 target over. llvm-svn: 57542
* Rename LoadX to LoadExt.Evan Cheng2008-10-141-1/+1
| | | | llvm-svn: 57526
* * Make TargetLowering not crash when TargetMachine::getTargetAsmInfo() returnsMatthijs Kooijman2008-10-131-1/+2
| | | | | | | null. This assumes that any target that does not have AsmInfo, does not support "LocAndDot". llvm-svn: 57438
OpenPOWER on IntegriCloud