summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
Commit message (Collapse)AuthorAgeFilesLines
* Major calling convention code refactoring.Dan Gohman2009-08-059-514/+386
| | | | | | | | | | | | | | | | | | | Instead of awkwardly encoding calling-convention information with ISD::CALL, ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering provides three virtual functions for targets to override: LowerFormalArguments, LowerCall, and LowerRet, which replace the custom lowering done on the special nodes. They provide the same information, but in a more immediately usable format. This also reworks much of the target-independent tail call logic. The decision of whether or not to perform a tail call is now cleanly split between target-independent portions, and the target dependent portion in IsEligibleForTailCallOptimization. This also synchronizes all in-tree targets, to help enable future refactoring and feature work. llvm-svn: 78142
* Propogate the Depth argument when callingDan Gohman2009-08-041-1/+2
| | | | | | | | | TLI.computeMaskedBitsForTargetNode from ComputeMaskedBits, since the former may call back into the latter. This fixes a major compile time problem on a testcase that happnened to hit this in a particularly bad way, PR4643. llvm-svn: 78023
* Revert 77974. It breaks 3 of the ARM tests.Bob Wilson2009-08-031-8/+0
| | | | llvm-svn: 77982
* Allow targets to custom handle softening of results or operands before ↵Sanjiv Gupta2009-08-031-0/+8
| | | | | | trying the standard stuff. llvm-svn: 77974
* llvm_report_error already prints "LLVM ERROR:". So stop reporting errors ↵Benjamin Kramer2009-08-031-6/+5
| | | | | | like "LLVM ERROR: llvm: error:" or "LLVM ERROR: ERROR:". llvm-svn: 77971
* Avoid forming a SELECT_CC in a type that the target doesn'tDan Gohman2009-08-021-1/+2
| | | | | | | | | | | | | | | | | | | support. This isn't immediately interesting, because Legalize ends up lowering SELECT_CC if the target doesn't support it, but this simplifies the process. Also, if the SELECT_CC would be expanded in Legalize, it can potentially end up with two copies of the condition expression. By leaving it as SELECT+SETCC, the SELECT can be expanded into two SELECTs that use a single SETCC. The two comparisons are usually CSE'd, but depending on when various expressions get legalized, the comparison expression could involve calls to library functions, such that the comparison expression may not be able to be CSE'd. This will be needed by a future patch. llvm-svn: 77896
* Print the target flags as an int instead of a char, as they aren'tDan Gohman2009-08-011-4/+4
| | | | | | actually characters. llvm-svn: 77794
* Delete a redundant variable.Dan Gohman2009-08-011-1/+0
| | | | llvm-svn: 77774
* Minor code simplifications.Dan Gohman2009-08-011-8/+8
| | | | llvm-svn: 77769
* SelectionDAGISel no longer needs to check hasAvailableExternallyLinkage,Dan Gohman2009-08-011-5/+0
| | | | | | | as it is now a MachineFunctionPass, and MachineFunctionPass now handles this. llvm-svn: 77760
* SelectionDAGISel does not "preserve all", since it makes lots of changesDan Gohman2009-07-311-1/+3
| | | | | | to the MachineFunction. llvm-svn: 77753
* Use a range insert instead of an explicit loop.Dan Gohman2009-07-311-2/+1
| | | | llvm-svn: 77752
* Allow target intrinsics that return multiple values, i.e., struct types,Bob Wilson2009-07-311-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | in SelectionDAGLowering::visitTargetIntrinsic. This removes a bit of special-case code for vector types. After staring at it for a while, I managed to convince myself that it is not necessary. The only case where TLI.getValueType() differs from MVT::getMVT is for iPTR, so this code could potentially make a difference for a vector of pointers. But, it looks like that is not supported. Calling TLI.getValueType() on a vector of pointers leads to the following sequence of calls: TargetLowering::getValueType MVT::getMVT MVT::getVectorVT(iPTR, num elements) MVT::getExtendedVectorVT MVT::getTypeForMVT for iPTR assertion fails "Type is not extended!" So, unless I'm really missing something, this bit of code is irrelevant to the current version of LLVM, which is consistent with the fact that I don't see this code in other similar places. llvm-svn: 77747
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-2/+2
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Reapply r77654 with a fix: MachineFunctionPass's getAnalysisUsageDan Gohman2009-07-311-4/+7
| | | | | | | | shouldn't do AU.setPreservesCFG(), because even though CodeGen passes don't modify the LLVM IR CFG, they may modify the MachineFunction CFG, and passes like MachineLoop are registered with isCFGOnly set to true. llvm-svn: 77691
* Move getTrue() and getFalse() to 2.5-like APIs.Owen Anderson2009-07-311-4/+4
| | | | llvm-svn: 77685
* Revert r77654, it appears to be causing llvm-gcc bootstrap failures, and manyDaniel Dunbar2009-07-311-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | failures when building assorted projects with clang. --- Reverse-merging r77654 into '.': U include/llvm/CodeGen/Passes.h U include/llvm/CodeGen/MachineFunctionPass.h U include/llvm/CodeGen/MachineFunction.h U include/llvm/CodeGen/LazyLiveness.h U include/llvm/CodeGen/SelectionDAGISel.h D include/llvm/CodeGen/MachineFunctionAnalysis.h U include/llvm/Function.h U lib/Target/CellSPU/SPUISelDAGToDAG.cpp U lib/Target/PowerPC/PPCISelDAGToDAG.cpp U lib/CodeGen/LLVMTargetMachine.cpp U lib/CodeGen/MachineVerifier.cpp U lib/CodeGen/MachineFunction.cpp U lib/CodeGen/PrologEpilogInserter.cpp U lib/CodeGen/MachineLoopInfo.cpp U lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp D lib/CodeGen/MachineFunctionAnalysis.cpp D lib/CodeGen/MachineFunctionPass.cpp U lib/CodeGen/LiveVariables.cpp llvm-svn: 77661
* Manage MachineFunctions with an analysis Pass instead of the AnnotableDan Gohman2009-07-311-4/+7
| | | | | | | mechanism. To support this, make MachineFunctionPass a little more complete. llvm-svn: 77654
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-2/+1
| | | | llvm-svn: 77635
* Allow targets to define libcall names for mem(cpy,set,move) intrinsics, ↵Sanjiv Gupta2009-07-302-3/+9
| | | | | | rather than hardcoding them in DAG lowering. llvm-svn: 77586
* Optimize some common usage patterns of atomic built-ins ↵Evan Cheng2009-07-301-0/+1
| | | | | | | | | | | | __sync_add_and_fetch() and __sync_sub_and_fetch. When the return value is not used (i.e. only care about the value in the memory), x86 does not have to use add to implement these. Instead, it can use add, sub, inc, dec instructions with the "lock" prefix. This is currently implemented using a bit of instruction selection trick. The issue is the target independent pattern produces one output and a chain and we want to map it into one that just output a chain. The current trick is to select it into a merge_values with the first definition being an implicit_def. The proper solution is to add new ISD opcodes for the no-output variant. DAG combiner can then transform the node before it gets to target node selection. Problem #2 is we are adding a whole bunch of x86 atomic instructions when in fact these instructions are identical to the non-lock versions. We need a way to add target specific information to target nodes and have this information carried over to machine instructions. Asm printer (or JIT) can use this information to add the "lock" prefix. llvm-svn: 77582
* Move types back to the 2.5 API.Owen Anderson2009-07-297-44/+32
| | | | llvm-svn: 77516
* inline the global 'getInstrOperandRegClass' function into its callersChris Lattner2009-07-291-7/+8
| | | | | | now that TargetOperandInfo does the heavy lifting. llvm-svn: 77508
* Remove now unused Context variables.Benjamin Kramer2009-07-291-1/+0
| | | | llvm-svn: 77495
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-1/+1
| | | | llvm-svn: 77494
* Return ConstantVector to 2.5 API.Owen Anderson2009-07-282-2/+2
| | | | llvm-svn: 77366
* Change ConstantArray to 2.5 API.Owen Anderson2009-07-281-1/+1
| | | | llvm-svn: 77347
* Rip all of the global variable lowering logic out of TargetAsmInfo. SinceChris Lattner2009-07-281-5/+9
| | | | | | | | | | | | | | | | | | | | it is highly specific to the object file that will be generated in the end, this introduces a new TargetLoweringObjectFile interface that is implemented for each of ELF/MachO/COFF/Alpha/PIC16 and XCore. Though still is still a brutal and ugly refactoring, this is a major step towards goodness. This patch also: 1. fixes a bunch of dangling pointer problems in the PIC16 backend. 2. disables the TargetLowering copy ctor which PIC16 was accidentally using. 3. gets us closer to xcore having its own crazy target section flags and pic16 not having to shadow sections with its own objects. 4. fixes wierdness where ELF targets would set CStringSection but not CStringSection_. Factor the code better. 5. fixes some bugs in string lowering on ELF targets. llvm-svn: 77294
* Move ConstantFP construction back to the 2.5-ish API.Owen Anderson2009-07-272-5/+3
| | | | llvm-svn: 77247
* Reorganize code a bit to reduce indentation. No visible functionality Eli Friedman2009-07-261-287/+287
| | | | | | change. llvm-svn: 77171
* Remove Value::getNameLenDaniel Dunbar2009-07-261-18/+6
| | | | llvm-svn: 77148
* Convert a few more things to use raw_ostream.Dan Gohman2009-07-252-26/+27
| | | | llvm-svn: 77039
* More migration to raw_ostream, the water has dried up around the iostream hole.Daniel Dunbar2009-07-251-1/+2
| | | | | | | | | | - Some clients which used DOUT have moved to DEBUG. We are deprecating the "magic" DOUT behavior which avoided calling printing functions when the statement was disabled. In addition to being unnecessary magic, it had the downside of leaving code in -Asserts builds, and of hiding potentially unnecessary computations. llvm-svn: 77019
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-244-4/+4
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Add support for promoting SETCC operations.Jakob Stoklund Olesen2009-07-244-13/+20
| | | | llvm-svn: 76987
* Move more to raw_ostream, provide support for writing MachineBasicBlock,Daniel Dunbar2009-07-241-4/+4
| | | | | | LiveInterval, etc to raw_ostream. llvm-svn: 76965
* Switch to getNameStr().Daniel Dunbar2009-07-242-4/+4
| | | | llvm-svn: 76962
* "fix" PR4612, which is a crash on:Chris Lattner2009-07-231-1/+5
| | | | | | | | | | %0 = malloc [3758096384 x i32] The "malloc" instruction doesn't support 64-bits correctly (see PR715), and should be removed. Victor is actively working on fixing this, in the meantime just don't crash. llvm-svn: 76899
* Get rid of the Pass+Context magic.Owen Anderson2009-07-223-7/+7
| | | | llvm-svn: 76702
* Remove shift amount flavor. It isn't actually complete enough to Eli Friedman2009-07-211-1/+0
| | | | | | | | be useful, and it's currently unused. (Some issues: it isn't actually rich enough to capture the semantics on many architectures, and semantics can vary depending on the type being shifted.) llvm-svn: 76633
* Rename getConstantInt{True|False} to get{True|False} at Chris' behest.Owen Anderson2009-07-211-4/+4
| | | | llvm-svn: 76598
* Simplify / normalize some uses of Value::getName.Daniel Dunbar2009-07-211-1/+1
| | | | llvm-svn: 76553
* Fix a dagga combiner bug: avoid creating illegal constant.Evan Cheng2009-07-211-9/+12
| | | | | | | | Is this really a winning transformation? fold (shl (srl x, c1), c2) -> (shl (and x, (shl -1, c1)), (sub c2, c1)) or (srl (and x, (shl -1, c1)), (sub c1, c2)) llvm-svn: 76535
* Move a bit more state over to the LLVMContext.Owen Anderson2009-07-211-4/+6
| | | | llvm-svn: 76533
* Move stripping of bitcasts in inline asm argumentsDale Johannesen2009-07-202-12/+7
| | | | | | | to a place where it affects everything. Occurs only on calls AFAIK. llvm-svn: 76502
* Fix some minor MSVC compiler warnings.Daniel Dunbar2009-07-191-2/+2
| | | | llvm-svn: 76356
* Make promotion in operation legalization for SETCC work correctly.Eli Friedman2009-07-171-23/+5
| | | | llvm-svn: 76153
* Add line numbers to OProfile. To do this, I added a processDebugLoc()Jeffrey Yasskin2009-07-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | call to the MachineCodeEmitter interface and made copying the start line of a function not conditional on whether we're emitting Dwarf debug information. I'll propagate the processDebugLoc() calls to the non-X86 targets in a followup patch. In the long run, it'll probably be better to gather this information through the DwarfWriter, but the DwarfWriter currently depends on the AsmPrinter and TargetAsmInfo, and fixing that would be out of the way for this patch. There's a bug in OProfile 0.9.4 that makes it ignore line numbers for addresses above 4G, and a patch fixing it at http://thread.gmane.org/gmane.linux.oprofile/7634 Sample output: $ sudo opcontrol --reset; sudo opcontrol --start-daemon; sudo opcontrol --start; `pwd`/Debug/bin/lli fib.bc; sudo opcontrol --stop Signalling daemon... done Profiler running. fib(40) == 165580141 Stopping profiling. $ opreport -g -d -l `pwd`/Debug/bin/lli|head -60 Overflow stats not available CPU: Core 2, speed 1998 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 vma samples % linenr info image name symbol name 00007f67a30370b0 25489 61.2554 fib.c:24 10946.jo fib_left 00007f67a30370b0 1634 6.4106 fib.c:24 00007f67a30370b1 83 0.3256 fib.c:24 00007f67a30370b9 1997 7.8348 fib.c:24 00007f67a30370c6 2080 8.1604 fib.c:27 00007f67a30370c8 988 3.8762 fib.c:27 00007f67a30370cd 1315 5.1591 fib.c:27 00007f67a30370cf 251 0.9847 fib.c:27 00007f67a30370d3 1191 4.6726 fib.c:27 00007f67a30370d6 975 3.8252 fib.c:27 00007f67a30370db 1010 3.9625 fib.c:27 00007f67a30370dd 242 0.9494 fib.c:27 00007f67a30370e1 2782 10.9145 fib.c:28 00007f67a30370e5 3768 14.7828 fib.c:28 00007f67a30370eb 615 2.4128 (no location information) 00007f67a30370f3 6558 25.7287 (no location information) 00007f67a3037100 15603 37.4973 fib.c:29 10946.jo fib_right 00007f67a3037100 1646 10.5493 fib.c:29 00007f67a3037101 45 0.2884 fib.c:29 00007f67a3037109 2372 15.2022 fib.c:29 00007f67a3037116 2234 14.3178 fib.c:32 00007f67a3037118 612 3.9223 fib.c:32 00007f67a303711d 622 3.9864 fib.c:32 00007f67a303711f 385 2.4675 fib.c:32 00007f67a3037123 404 2.5892 fib.c:32 00007f67a3037126 634 4.0633 fib.c:32 00007f67a303712b 870 5.5759 fib.c:32 00007f67a303712d 62 0.3974 fib.c:32 00007f67a3037131 1848 11.8439 fib.c:33 00007f67a3037135 2840 18.2016 fib.c:33 00007f67a303713a 1 0.0064 fib.c:33 00007f67a303713b 1023 6.5564 (no location information) 00007f67a3037143 5 0.0320 (no location information) 000000000080c1e4 15 0.0360 MachineOperand.h:150 lli llvm::MachineOperand::isReg() const 000000000080c1e4 6 40.0000 MachineOperand.h:150 000000000080c1ec 2 13.3333 MachineOperand.h:150 ... llvm-svn: 76102
* Privatize the ConstantFP table. I'm on a roll!Owen Anderson2009-07-162-3/+4
| | | | llvm-svn: 76097
* Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a ↵Owen Anderson2009-07-164-4/+6
| | | | | | | | number of issues in our current context-passing stuff, which is also fixed here llvm-svn: 76089
OpenPOWER on IntegriCloud