summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change this from an assert to a cerr+exit, since it's diagnosing anDan Gohman2009-06-151-2/+6
| | | | | | unsupported inline asm construct, rather than verifying a code invariant. llvm-svn: 73435
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-32/+14
| | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt llvm-svn: 72897
* Add a new codegen pass that normalizes dwarf exception handlingDuncan Sands2009-05-221-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code in preparation for code generation. The main thing it does is handle the case when eh.exception calls (and, in a future patch, eh.selector calls) are far away from landing pads. Right now in practice you only find eh.exception calls close to landing pads: either in a landing pad (the common case) or in a landing pad successor, due to loop passes shifting them about. However future exception handling improvements will result in calls far from landing pads: (1) Inlining of rewinds. Consider the following case: In function @f: ... invoke @g to label %normal unwind label %unwinds ... unwinds: %ex = call i8* @llvm.eh.exception() ... In function @g: ... invoke @something to label %continue unwind label %handler ... handler: %ex = call i8* @llvm.eh.exception() ... perform cleanups ... "rethrow exception" Now inline @g into @f. Currently this is turned into: In function @f: ... invoke @something to label %continue unwind label %handler ... handler: %ex = call i8* @llvm.eh.exception() ... perform cleanups ... invoke "rethrow exception" to label %normal unwind label %unwinds unwinds: %ex = call i8* @llvm.eh.exception() ... However we would like to simplify invoke of "rethrow exception" into a branch to the %unwinds label. Then %unwinds is no longer a landing pad, and the eh.exception call there is then far away from any landing pads. (2) Using the unwind instruction for cleanups. It would be nice to have codegen handle the following case: invoke @something to label %continue unwind label %run_cleanups ... handler: ... perform cleanups ... unwind This requires turning "unwind" into a library call, which necessarily takes a pointer to the exception as an argument (this patch also does this unwind lowering). But that means you are using eh.exception again far from a landing pad. (3) Bugpoint simplifications. When bugpoint is simplifying exception handling code it often generates eh.exception calls far from a landing pad, which then causes codegen to assert. Bugpoint then latches on to this assertion and loses sight of the original problem. Note that it is currently rare for this pass to actually do anything. And in fact it normally shouldn't do anything at all given the code coming out of llvm-gcc! But it does fire a few times in the testsuite. As far as I can see this is almost always due to the LoopStrengthReduce codegen pass introducing pointless loop preheader blocks which are landing pads and only contain a branch to another block. This other block contains an eh.exception call. So probably by tweaking LoopStrengthReduce a bit this can be avoided. llvm-svn: 72276
* Temporarily revert r72191. It was causing an assert during llvm-gccBill Wendling2009-05-211-40/+13
| | | | | | bootstrapping. llvm-svn: 72200
* Introduce DebugScope which gets embedded into the machine instructions' ↵Argyrios Kyrtzidis2009-05-201-13/+40
| | | | | | | | DebugLoc. DebugScope refers to a debug region, function or block. llvm-svn: 72191
* Fix for PR4235: to build a floating-point value from integer parts, Eli Friedman2009-05-201-5/+19
| | | | | | | | | | | | build an integer and cast that to a float. This fixes a crash caused by trying to split an f32 into two f16's. This changes the behavior in test/CodeGen/XCore/fneg.ll because that testcase now triggers a DAGCombine which converts the fneg into an integer operation. If someone is interested, it's probably possible to tweak the test to generate an actual fneg. llvm-svn: 72162
* Revert last commit. It was wrong.Bill Wendling2009-05-181-2/+1
| | | | llvm-svn: 72026
* Don't call RegionInlinedFnEnd if our optimization level isn't -O0.Bill Wendling2009-05-181-1/+2
| | | | llvm-svn: 72024
* Add an assert to turn a segfault on an unsupported inlineDan Gohman2009-05-141-0/+2
| | | | | | asm construct into an assertion failure. llvm-svn: 71757
* Removing the HasBuiltinSetjmp flag and associated bits. Flagging the presenceJim Grosbach2009-05-131-6/+0
| | | | | | | | | of exception handling builtin sjlj targets in functions turns out not to be necessary. Marking the intrinsic implementation in the .td file as defining all registers is sufficient to get the context saved properly by the containing function. llvm-svn: 71743
* Add support for GCC compatible builtin setjmp and longjmp intrinsics. This isJim Grosbach2009-05-121-0/+6
| | | | | | | a supporting preliminary patch for GCC-compatible SjLJ exception handling. Note that these intrinsics are not designed to be invoked directly by the user, but rather used by the front-end as target hooks for exception handling. llvm-svn: 71610
* --- Reverse-merging r71370 into '.':Bill Wendling2009-05-101-34/+58
| | | | | | | | U lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Revert r71370. llvm-svn: 71373
* A debug function start was not being recorded when the optimization level wasn'tBill Wendling2009-05-091-58/+34
| | | | | | | | None. However, we were always recording the region end. There's no longer a good reason for this code to be separated out between the different opt levels, as it was doing pretty much the same thing anyway. llvm-svn: 71370
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-091-9/+9
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* Mirror how Fast ISel determines if a region.end intrinsic is the end of anBill Wendling2009-05-081-15/+12
| | | | | | | | | inlined function or the end of a function. Before, this was never executing the "inlined" version of the Record method. This will become important once the inlined Dwarf writer patch lands. llvm-svn: 71268
* Do not emit bit tests if target does not support natively left shiftAnton Korobeynikov2009-05-081-0/+4
| | | | llvm-svn: 71240
* Revert 71165. It did more than just revert 71158 and it introducedDan Gohman2009-05-071-2/+1
| | | | | | several regressions. The problem due to 71158 is now fixed. llvm-svn: 71176
* Temporarily revert r71158. It was causing a failure during a full bootstrap:Bill Wendling2009-05-071-1/+2
| | | | | | | | | | | | | | | | | | | | | checking for bcopy... no checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://developer.apple.com/bugreporter> for instructions. make[4]: *** [decUtility.o] Error 1 make[4]: *** Waiting for unfinished jobs.... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://developer.apple.com/bugreporter> for instructions. make[4]: *** [decNumber.o] Error 1 make[3]: *** [all-stage2-libdecnumber] Error 2 make[3]: *** Waiting for unfinished jobs.... llvm-svn: 71165
* Make DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's ↵Argyrios Kyrtzidis2009-05-071-6/+5
| | | | | | | | | | | methods: -Have it return a label ID -Remove the unused Instruction parameter No functionality change. llvm-svn: 71132
* Make DBG_STOPPOINT nodes, and therefore DBG_LABEL labels, get a DebugLoc, so ↵Chris Lattner2009-05-041-5/+6
| | | | | | | | | that it shows up in -print-machineinstrs. This doesn't appear to affect anything, but it was weird for some DBG_LABELs to have DebugLocs but not all of them. llvm-svn: 70921
* -Remove the DwarfWriter::RecordSourceLine calls from the instruction selectors.Argyrios Kyrtzidis2009-05-041-3/+2
| | | | | | | | -Depend on DebugLocs for source line info. (Comes with Regression-Be-Gone(tm)) llvm-svn: 70871
* Revert r70803 for now, it causes a regression.Argyrios Kyrtzidis2009-05-031-1/+2
| | | | llvm-svn: 70811
* -Remove the DwarfWriter::RecordSourceLine calls from the instruction selectors.Argyrios Kyrtzidis2009-05-031-2/+1
| | | | | | -Depend on DebugLocs for source line info. llvm-svn: 70803
* -Move the DwarfWriter::ValidDebugInfo check to a static ↵Argyrios Kyrtzidis2009-05-031-74/+74
| | | | | | | | DIDescriptor::ValidDebugInfo -Create DebugLocs without the need to have a DwarfWriter around llvm-svn: 70682
* Make DebugLoc independent of DwarfWriter.Argyrios Kyrtzidis2009-04-301-24/+13
| | | | | | | | -Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable* -Remove DwarfWriter::getOrCreateSourceID -Make necessary changes for the above (fix callsites, etc.) llvm-svn: 70520
* fix a regression handling indirect results: these need to be consideredChris Lattner2009-04-301-8/+13
| | | | | | | | memory operands otherwise the writebacks get lost when the inline asm doesn't otherwise have side effects. This fixes rdar://6839427, though clang really shouldn't generate these anymore. llvm-svn: 70455
* Instead of passing in an unsigned value for the optimization level, use an enum,Bill Wendling2009-04-291-7/+7
| | | | | | | which better identifies what the optimization is doing. And is more flexible for future uses. llvm-svn: 70440
* Implement review feedback for vector shuffle work.Nate Begeman2009-04-291-32/+19
| | | | llvm-svn: 70372
* Second attempt:Bill Wendling2009-04-291-10/+11
| | | | | | | | | | | | Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to use the old behavior, the flag is -O0. This change allows for finer-grained control over which optimizations are run at different -O levels. Most of this work was pretty mechanical. The majority of the fixes came from verifying that a "fast" variable wasn't used anymore. The JIT still uses a "Fast" flag. I'll change the JIT with a follow-up patch. llvm-svn: 70343
* r70270 isn't ready yet. Back this out. Sorry for the noise.Bill Wendling2009-04-281-11/+10
| | | | llvm-svn: 70275
* Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want toBill Wendling2009-04-281-10/+11
| | | | | | | | | | | use the old behavior, the flag is -O0. This change allows for finer-grained control over which optimizations are run at different -O levels. Most of this work was pretty mechanical. The majority of the fixes came from verifying that a "fast" variable wasn't used anymore. The JIT still uses a "Fast" flag. I'm not 100% sure if it's necessary to change it there... llvm-svn: 70270
* 2nd attempt, fixing SSE4.1 issues and implementing feedback from duncan.Nate Begeman2009-04-271-87/+66
| | | | | | | | | | | | | | PR2957 ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes as the shuffle mask. A value of -1 represents UNDEF. In addition to eliminating the creation of illegal BUILD_VECTORS just to represent shuffle masks, we are better about canonicalizing the shuffle mask, resulting in substantially better code for some classes of shuffles. llvm-svn: 70225
* Revert 69952. Causes testsuite failures on linux x86-64.Rafael Espindola2009-04-241-66/+87
| | | | llvm-svn: 69967
* PR2957Nate Begeman2009-04-241-87/+66
| | | | | | | | | | | | | | ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes as the shuffle mask. A value of -1 represents UNDEF. In addition to eliminating the creation of illegal BUILD_VECTORS just to represent shuffle masks, we are better about canonicalizing the shuffle mask, resulting in substantially better code for some classes of shuffles. A clean up of x86 shuffle code, and some canonicalizing in DAGCombiner is next. llvm-svn: 69952
* Factor out a bit of code that appears in several places into aDan Gohman2009-04-231-9/+13
| | | | | | utility function. llvm-svn: 69937
* Handle Void types in ComputeValueVTs. This doesn't currently occur,Dan Gohman2009-04-231-0/+3
| | | | | | | but this change makes the code more general and easier to adapt for new purposes. llvm-svn: 69935
* Inline asm's were still introducing bogus dependencies;Dale Johannesen2009-04-181-1/+7
| | | | | | my earlier patch to this code only fixed half of it. llvm-svn: 69408
* Do not treat beginning of inlined scope as beginning of normal function ↵Devang Patel2009-04-161-0/+10
| | | | | | | | | | | | | | | | | | | | | scope if the location info is missing. Insetad of doing ... if (inlined_subroutine && known_location) DW_TAG_inline_subroutine else DW_TAG_subprogram do if (inlined_subroutine) { if (known_location) DW_TAG_inline_subroutine } else { DW_TAG_subprogram } llvm-svn: 69300
* Record line number at the beginning of a func.start.Devang Patel2009-04-161-1/+1
| | | | | | This line was accidently lost yesterday. llvm-svn: 69286
* In -fast mode do what FastISel does.Devang Patel2009-04-161-30/+65
| | | | | | This code could use some refactoring help! llvm-svn: 69254
* Do not force asm's to be chained if they don't touchDale Johannesen2009-04-141-0/+3
| | | | | | | memory and aren't volatile. This was interfering with good scheduling. llvm-svn: 69008
* Make these errors more noticable in build logs.Daniel Dunbar2009-04-131-5/+5
| | | | llvm-svn: 68998
* Right now, Debugging information to encode scopes (DW_TAG_lexical_block) ↵Devang Patel2009-04-131-13/+11
| | | | | | | | relies on DBG_LABEL. Unfortunately this intefers with the quality of optimized code. This patch updates dwarf writer to encode scoping information in DWARF only in FastISel mode. llvm-svn: 68973
* Reapply 68847.Devang Patel2009-04-131-0/+22
| | | | | | Now debug_inlined section is covered by TAI->doesDwarfUsesInlineInfoSection(), which is false by default. llvm-svn: 68964
* Revert r68847. It breaks the build on non-Darwin targets, with this messageDan Gohman2009-04-111-22/+0
| | | | | | | from the assembler: Error: unknown pseudo-op: `.debug_inlined' llvm-svn: 68863
* Keep track of inlined functions and their locations. This information is ↵Devang Patel2009-04-111-0/+22
| | | | | | | | collected when nested llvm.dbg.func.start intrinsics are seen. (Right now, inliner removes nested llvm.dbg.func.start intrinisics during inlining.) Create debug_inlined dwarf section using these information. This info is used by gdb, at least on Darwin, to enable better experience debugging inlined functions. See DwarfWriter.cpp for more information on structure of debug_inlined section. llvm-svn: 68847
* Remove the obsolete SelectionDAG::getNodeValueTypes and simplifyDan Gohman2009-04-091-27/+18
| | | | | | code that uses it by using SelectionDAG::getVTList instead. llvm-svn: 68744
* Generalize ExtendUsesToFormExtLoad to be usable for ANY_EXTEND,Dan Gohman2009-04-091-2/+18
| | | | | | | | | | | | | | | in addition to ZERO_EXTEND and SIGN_EXTEND. Fix a bug in the way it checked for live-out values, and simplify the way it find users by using SDNode::use_iterator's (relatively) new features. Also, make it slightly more permissive on targets with free truncates. In SelectionDAGBuild, avoid creating ANY_EXTEND nodes that are larger than necessary. If the target's SwitchAmountTy has enough bits, use it. This exposes the truncate to optimization early, enabling more optimizations. llvm-svn: 68670
* Don't copy the operand of a SwitchInst into virtual registers asDan Gohman2009-04-091-3/+13
| | | | | | | | | | eagerly. This helps avoid CopyToReg nodes in some cases where they aren't needed, and also helps subsequent optimizer heuristics in cases where the extra nodes would cause the node to appear to have multiple results. This doesn't have a significant impact currently; it'll help an upcoming change. llvm-svn: 68667
* Revert prev. patch for now.Devang Patel2009-04-071-4/+6
| | | | llvm-svn: 68569
OpenPOWER on IntegriCloud