summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor inline asm constraint matching code out of SDIsel into TargetLowering.Evan Cheng2008-02-261-91/+15
| | | | llvm-svn: 47587
* Convert MaskedValueIsZero and all its users to use APInt. Also addDan Gohman2008-02-251-10/+10
| | | | | | a SignBitIsZero function to simplify a common use case. llvm-svn: 47561
* Pass alignment on ByVal parameters, from FE, allDale Johannesen2008-02-221-0/+9
| | | | | | the way through. It is now used for codegen. llvm-svn: 47484
* Make the clobber analysis a bit more smart: we only are careful about Chris Lattner2008-02-211-3/+13
| | | | | | | early clobbers if the clobber list contains a *register* not some thing like {memory}, {dirflag} etc. llvm-svn: 47457
* Treat clobber operands like early clobbers: if we haveChris Lattner2008-02-211-0/+16
| | | | | | | | | any, we force sdisel to do all regalloc for an asm. This leads to gross but correct codegen. This fixes the rest of PR2078. llvm-svn: 47454
* Atomic op support. If any gcc test uses __sync builtins, it might start ↵Andrew Lenharth2008-02-211-1/+33
| | | | | | failing on archs that haven't implemented them yet llvm-svn: 47430
* Add support for matching mem operands. This fixes PR1133, patch byChris Lattner2008-02-211-1/+7
| | | | | | Eli Friedman. This implements CodeGen/Generic/2008-02-20-MatchingMem.ll. llvm-svn: 47428
* Fix a (harmless) but where vregs were added to the used reg lists for Chris Lattner2008-02-211-9/+26
| | | | | | | | | | inline asms. Fix PR2078 by marking aliases of registers used when a register is marked used. This prevents EAX from being allocated when AX is listed in the clobber set for the asm. llvm-svn: 47426
* assert is more effective reminder then FIXME tag for unimplemented features.Devang Patel2008-02-201-1/+1
| | | | llvm-svn: 47388
* Update gcc 4.3 warnings fix patch with recent head changesAnton Korobeynikov2008-02-201-1/+1
| | | | llvm-svn: 47368
* Add GetResultInst. First step for multiple return value support.Devang Patel2008-02-191-0/+4
| | | | llvm-svn: 47348
* llvm.memory.barrier, and impl for x86 and alphaAndrew Lenharth2008-02-161-0/+9
| | | | llvm-svn: 47204
* In TargetLowering::LowerCallTo, don't assert thatDuncan Sands2008-02-141-10/+16
| | | | | | | | | | | | | | | | | the return value is zero-extended if it isn't sign-extended. It may also be any-extended. Also, if a floating point value was returned in a larger floating point type, pass 1 as the second operand to FP_ROUND, which tells it that all the precision is in the original type. I think this is right but I could be wrong. Finally, when doing libcalls, set isZExt on a parameter if it is "unsigned". Currently isSExt is set when signed, and nothing is set otherwise. This should be right for all calls to standard library routines. llvm-svn: 47122
* In SDISel, for targets that support FORMAL_ARGUMENTS nodes, lower thisChris Lattner2008-02-131-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | node as soon as we create it in SDISel. Previously we would lower it in legalize. The problem with this is that it only exposes the argument loads implied by FORMAL_ARGUMENTs after legalize, so that only dag combine 2 can hack on them. This causes us to miss some optimizations because datatype expansion also happens here. Exposing the loads early allows us to do optimizations on them. For example we now compile arg-cast.ll to: _foo: movl $2147483647, %eax andl 8(%esp), %eax ret where we previously produced: _foo: subl $12, %esp movsd 16(%esp), %xmm0 movsd %xmm0, (%esp) movl $2147483647, %eax andl 4(%esp), %eax addl $12, %esp ret It might also make sense to do this for ISD::CALL nodes, which have implicit stores on many targets. llvm-svn: 47054
* Generalize getCopyFromParts and getCopyToParts toDuncan Sands2008-02-121-113/+215
| | | | | | | | | | | | handle arbitrary precision integers and any number of parts. For example, on a 32 bit machine an i50 corresponds to two i32 parts. getCopyToParts will extend the i50 to an i64 then write half of the i64 to each part; getCopyFromParts will combine the two i32 parts into an i64 then truncate the result to i50. llvm-svn: 47024
* Generalize the handling of call and return arguments,Duncan Sands2008-02-111-136/+85
| | | | | | | in preparation for apint support. These changes are intended to have no functional effect. llvm-svn: 46967
* Rename MRegisterInfo to TargetRegisterInfo.Dan Gohman2008-02-101-6/+7
| | | | llvm-svn: 46930
* SDIsel processes llvm.dbg.declare by recording the variable debug ↵Evan Cheng2008-02-021-6/+4
| | | | | | | | | information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc. Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes. For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time. llvm-svn: 46659
* Remove the nasty LABEL hack with a much less evil one. Now ↵Evan Cheng2008-02-011-6/+14
| | | | | | llvm.dbg.func.start implies a stoppoint is set. SelectionDAGISel records a new source line but does not create a ISD::LABEL node for this special stoppoint. Asm printer will magically print this label. This ensures nothing is emitted before. llvm-svn: 46635
* Add an extra operand to LABEL nodes which distinguishes between debug, EH, ↵Evan Cheng2008-01-311-8/+14
| | | | | | or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution. llvm-svn: 46609
* Rename ISD::FLT_ROUNDS to ISD::FLT_ROUNDS_ to avoid conflictingDan Gohman2008-01-311-1/+1
| | | | | | with the real FLT_ROUNDS (defined in <float.h>). llvm-svn: 46587
* Even though InsertAtEndOfBasicBlock is an ugly hack it still deserves a ↵Evan Cheng2008-01-301-4/+4
| | | | | | | | proper name. Rename it to EmitInstrWithCustomInserter since it does not necessarily insert instruction at the end. llvm-svn: 46562
* Handle 'X' constraint in asm's better.Dale Johannesen2008-01-291-19/+34
| | | | llvm-svn: 46485
* fix long lines.Chris Lattner2008-01-251-2/+3
| | | | llvm-svn: 46355
* Forgot these.Evan Cheng2008-01-241-4/+2
| | | | llvm-svn: 46292
* * Introduce a new SelectionDAG::getIntPtrConstant methodChris Lattner2008-01-171-19/+14
| | | | | | | | | | | | | and switch various codegen pieces and the X86 backend over to using it. * Add some comments to SelectionDAGNodes.h * Introduce a second argument to FP_ROUND, which indicates whether the FP_ROUND changes the value of its input. If not it is safe to xform things like fp_extend(fp_round(x)) -> x. llvm-svn: 46125
* For PR1839: add initial support for __builtin_trap. llvm-gcc part is missedAnton Korobeynikov2008-01-151-0/+5
| | | | | | as well as PPC codegen llvm-svn: 46001
* Remove the assumption that byval has been applied toDuncan Sands2008-01-131-12/+12
| | | | | | a pointer to a struct. llvm-svn: 45939
* Enabling the target-independent garbage collection infrastructure by hooking itGordon Henriksen2008-01-071-8/+34
| | | | | | | | | up to the various compiler pipelines. This doesn't actually add support for any GC algorithms, which means it temporarily breaks a few tests. To be fixed shortly. llvm-svn: 45669
* Rename SSARegMap -> MachineRegisterInfo in keeping with the idea Chris Lattner2007-12-311-13/+13
| | | | | | | | | | | | | | that "machine" classes are used to represent the current state of the code being compiled. Given this expanded name, we can start moving other stuff into it. For now, move the UsedPhysRegs and LiveIn/LoveOuts vectors from MachineFunction into it. Update all the clients to match. This also reduces some needless #includes, such as MachineModuleInfo from MachineFunction. llvm-svn: 45467
* use simplified operand addition methods.Chris Lattner2007-12-301-17/+25
| | | | llvm-svn: 45436
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Simplify LowerCallTo by using a callsite.Duncan Sands2007-12-191-41/+27
| | | | llvm-svn: 45198
* The C++ exception handling personality function wantsDuncan Sands2007-12-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | to know about calls that cannot throw ('nounwind'): if such a call does throw for some reason then the personality will terminate the program. The distinction between an ordinary call and a nounwind call is that an ordinary call gets an entry in the exception table but a nounwind call does not. This patch sets up the exception table appropriately. One oddity is that I've chosen to bracket nounwind calls with labels (like invokes) - the other choice would have been to bracket ordinary calls with labels. While bracketing ordinary calls is more natural (because bracketing by labels would then correspond exactly to getting an entry in the exception table), I didn't do it because introducing labels impedes some optimizations and I'm guessing that ordinary calls occur more often than nounwind calls. This fixes the gcc filter2 eh test, at least at -O0 (the inliner needs some tweaking at higher optimization levels). llvm-svn: 45197
* Make invokes of inline asm legal. Teach codegenDuncan Sands2007-12-171-17/+20
| | | | | | | | how to lower them (with no attempt made to be efficient, since they should only occur for unoptimized code). llvm-svn: 45108
* Rather than having special rules like "intrinsics cannotDuncan Sands2007-12-031-21/+3
| | | | | | | | | throw exceptions", just mark intrinsics with the nounwind attribute. Likewise, mark intrinsics as readnone/readonly and get rid of special aliasing logic (which didn't use anything more than this anyway). llvm-svn: 44544
* Add some convenience methods for querying attributes, andDuncan Sands2007-11-281-12/+11
| | | | | | use them. llvm-svn: 44403
* Fix PR1146: parameter attributes are longer part ofDuncan Sands2007-11-271-12/+10
| | | | | | | | | | | | the function type, instead they belong to functions and function calls. This is an updated and slightly corrected version of Reid Spencer's original patch. The only known problem is that auto-upgrading of bitcode files doesn't seem to work properly (see test/Bitcode/AutoUpgradeIntrinsics.ll). Hopefully a bitcode guru (who might that be? :) ) will fix it. llvm-svn: 44359
* err, no really.Chris Lattner2007-11-271-1/+1
| | | | llvm-svn: 44352
* don't depend on ADL.Chris Lattner2007-11-271-1/+1
| | | | llvm-svn: 44351
* Several changes:Chris Lattner2007-11-241-9/+1
| | | | | | | | | | | | | | | | | | | | | 1) Change the interface to TargetLowering::ExpandOperationResult to take and return entire NODES that need a result expanded, not just the value. This allows us to handle things like READCYCLECOUNTER, which returns two values. 2) Implement (extremely limited) support in LegalizeDAG::ExpandOp for MERGE_VALUES. 3) Reimplement custom lowering in LegalizeDAGTypes in terms of the new ExpandOperationResult. This makes the result simpler and fully general. 4) Implement (fully general) expand support for MERGE_VALUES in LegalizeDAGTypes. 5) Implement ExpandOperationResult support for ARM f64->i64 bitconvert and ARM i64 shifts, allowing them to work with LegalizeDAGTypes. 6) Implement ExpandOperationResult support for X86 READCYCLECOUNTER and FP_TO_SINT, allowing them to work with LegalizeDAGTypes. LegalizeDAGTypes now passes several more X86 codegen tests when enabled and when type legalization in LegalizeDAG is ifdef'd out. llvm-svn: 44300
* Implement necessary bits for flt_rounds gcc builtin. Anton Korobeynikov2007-11-151-0/+4
| | | | | | Codegen bits and llvm-gcc support will follow. llvm-svn: 44182
* This assertion was bogus.Duncan Sands2007-11-151-3/+2
| | | | llvm-svn: 44167
* Make labels work in asm blocks; allow labels asDale Johannesen2007-11-051-22/+28
| | | | | | | parameters. Rename ValueRefList to ParamList in AsmParser, since its only use is for parameters. llvm-svn: 43734
* Add std:: to sort calls.Dan Gohman2007-11-021-1/+1
| | | | llvm-svn: 43652
* Change illegal uses of ++ to uses of STLExtra.h's next function.Dan Gohman2007-11-021-1/+1
| | | | llvm-svn: 43651
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* - Remove the hacky code that forces a memcpy. Alignment is taken care of in theBill Wendling2007-10-261-11/+3
| | | | | | | | | FE. - Explicitly pass in the alignment of the load & store. - XFAIL 2007-10-23-UnalignedMemcpy.ll because llc has a bug that crashes on unaligned pointers. llvm-svn: 43398
* Fix comment and use the "Size" variable that's already provided.Bill Wendling2007-10-231-10/+5
| | | | llvm-svn: 43271
* If there's an unaligned memcpy to/from the stack, don't lower it. Just call theBill Wendling2007-10-231-0/+13
| | | | | | memcpy library function instead. llvm-svn: 43270
OpenPOWER on IntegriCloud