Commit Graph

9422 Commits

Author SHA1 Message Date
Scott Michel abad22cf45 CellSPU: Fix bug 3606, as well as some ongoing work.
llvm-svn: 59009
2008-11-10 23:43:06 +00:00
Evan Cheng 02771dc473 Correct PIC function stub codegen.
llvm-svn: 59006
2008-11-10 23:14:47 +00:00
Dan Gohman d3b33fea65 Fix indentation.
llvm-svn: 59004
2008-11-10 22:09:58 +00:00
Mon P Wang 58fb9135e2 Added CONVERT_RNDSAT (conversion with rounding and saturation) SDNode to
support targets that support these conversions. Users should avoid using
this node as the current targets don't generating code for it.

llvm-svn: 59001
2008-11-10 20:54:11 +00:00
Evan Cheng 9f3058f3be Rename isGVNonLazyPtr to isIndirectSym to reflect how it will be used.
llvm-svn: 58949
2008-11-10 01:08:07 +00:00
Anton Korobeynikov cfb3bc4a45 Typo fix
llvm-svn: 58928
2008-11-09 02:54:13 +00:00
Anton Korobeynikov 9833d8c369 Temporary revert my last commit: it seems it's triggering some subtle bug in backend
and breaks llvm-gcc

llvm-svn: 58926
2008-11-08 23:05:05 +00:00
Oscar Fuentes 4829941a51 CMake: corrected library target name for dependency: LLVMCellSPU ->
LLVMCellSPUCodeGen.

llvm-svn: 58925
2008-11-08 21:23:15 +00:00
Oscar Fuentes 676e5194d0 CMake: Reflected changes on the CellSPU target build. May require a
clean start.

llvm-svn: 58924
2008-11-08 20:37:19 +00:00
Oscar Fuentes b200b648c4 Fixed a pasto.
llvm-svn: 58923
2008-11-08 20:34:18 +00:00
Scott Michel a872e5af8a CellSPU: Bring SPU's assembly printer more in-line with current LLVM code
structure. Assembly printer now outputs the correct section for strings.

llvm-svn: 58921
2008-11-08 18:59:02 +00:00
Anton Korobeynikov 09f51d1fd4 Factor out offset printing code into generic AsmPrinter.
FIXME: it seems, that most of targets don't support
offsets wrt CPI/GlobalAddress', was it intentional?

llvm-svn: 58917
2008-11-08 17:21:38 +00:00
Nicolas Geoffray 5a48f232f7 The Index field of an AttributeWithIndex is of type unsigned, not uint16_t.
llvm-svn: 58908
2008-11-08 15:36:01 +00:00
Anton Korobeynikov 09991ada2d StoreInst does not produce any result thus it's useless to create new
variable for it. This greatly reduces amount of unused variables in
llvm2cpp-generated code

llvm-svn: 58905
2008-11-08 12:58:07 +00:00
Evan Cheng 436bdcdcca Moved InvalidateInstructionCache to ARMJITInfo::emitFunctionStub which knows size of stub.
llvm-svn: 58899
2008-11-08 08:16:49 +00:00
Evan Cheng b31a717527 Rename startFunctionStub to startGVStub since it's also used for GV non-lazy ptr.
llvm-svn: 58897
2008-11-08 08:02:53 +00:00
Evan Cheng 98161f5f34 Tell ARMJITInfo if codegen relocation is PIC. It changes how function stubs are generated.
llvm-svn: 58896
2008-11-08 07:38:22 +00:00
Evan Cheng bb373c4637 Fix relocation for calls to external symbols.
llvm-svn: 58893
2008-11-08 07:22:33 +00:00
Scott Michel 1ccbbc3d07 CellSPU: Fix prologue/epilogue emission when function contains calls but
theframe size is 0; the prologue and epilogue should be emitted in this case.

llvm-svn: 58890
2008-11-08 05:16:20 +00:00
Evan Cheng 077c8f8832 Skip over two-address use operands.
llvm-svn: 58883
2008-11-08 01:44:13 +00:00
Evan Cheng ffdd91e3b8 Handle ARM machine constantpool entry with non-lazy ptr.
llvm-svn: 58882
2008-11-08 01:31:27 +00:00
Evan Cheng 454ff53d58 Use ARMFunctionInfo to track number of constpool entries and jumptables.
llvm-svn: 58877
2008-11-08 00:51:41 +00:00
Evan Cheng ef4d78ba67 More code clean up.
llvm-svn: 58872
2008-11-07 22:57:53 +00:00
Dale Johannesen 160be0ffda Make FP tests requiring two compares work on PPC (PR 642).
This is Chris' patch from the PR, modified to realize that
SETUGT/SETULT occur legitimately with integers, plus
two fixes in LegalizeDAG to pass a valid result type into
LegalizeSetCC.  The argument of TLI.getSetCCResultType is
ignored on PPC, but I think I'm following usage elsewhere.

llvm-svn: 58871
2008-11-07 22:54:33 +00:00
Evan Cheng 8467e2459a Get PIC jump table working.
llvm-svn: 58869
2008-11-07 22:30:53 +00:00
Dan Gohman cb0df597e0 Flush the raw_ostream after emitting the assembly for a function.
This is a temporary fix for the -print-emitted-asm option, where
errs() is used as the stream, in the case where other code is
using stderr without using errs()' buffer. Hopefully soon we'll
fix errs() to be non-buffered instead. Patch by Preston Gurd.

llvm-svn: 58859
2008-11-07 19:49:17 +00:00
Richard Osborne 3219819ffe Fix compile warnings.
llvm-svn: 58840
2008-11-07 11:21:09 +00:00
Scott Michel 3395d4485d CellSPU: Ensure that C strings are always put in the .rodata section
llvm-svn: 58839
2008-11-07 11:06:44 +00:00
Richard Osborne ca08e0645a Add XCore backend.
llvm-svn: 58838
2008-11-07 10:59:00 +00:00
Evan Cheng 7095cd2af2 Jump table JIT support. Work in progress.
llvm-svn: 58836
2008-11-07 09:06:08 +00:00
Scott Michel 34d93f8572 Teach CellSPU about ELF sections and new section emitter classes.
NB: This is likely to need more work.
llvm-svn: 58832
2008-11-07 04:36:25 +00:00
Evan Cheng 98dc53e926 Encode misc arithmetic instructions.
llvm-svn: 58828
2008-11-07 01:41:35 +00:00
Evan Cheng 49d665218c Encode extend instructions; more clean up.
llvm-svn: 58818
2008-11-06 22:15:19 +00:00
Evan Cheng aa03cd3336 - Improve naming consistency: Branch -> BrFrm, BranchMisc -> BrMiscFrm.
- Consolidate instruction formats.
- Other clean up.

llvm-svn: 58808
2008-11-06 17:48:05 +00:00
Evan Cheng 47b546d75f Remove opcode from instruction TS flags; add MOVCC support; fix addrmode3 encoding bug.
llvm-svn: 58800
2008-11-06 08:47:38 +00:00
Mon P Wang 9a8d60a7c0 Widening cleanup
llvm-svn: 58796
2008-11-06 05:31:54 +00:00
Evan Cheng 36ae40342f Handle smul<x><y>, smulw<y>, smla<x><y>, smlaw<y>.
llvm-svn: 58793
2008-11-06 03:35:07 +00:00
Evan Cheng b870fd8874 Fix so_imm encoding bug; add support for MOVi2pieces.
llvm-svn: 58790
2008-11-06 02:25:39 +00:00
Evan Cheng 2686c8fb34 Fix encoding of multiple instructions with 3 src operands; also handle smmul, smmla, and smmls.
llvm-svn: 58789
2008-11-06 01:21:28 +00:00
Evan Cheng fd2adbfa28 Encode pic load / store instructions; fix some encoding bugs.
llvm-svn: 58780
2008-11-05 23:22:34 +00:00
Evan Cheng 81889d010c Restructure ARM code emitter to use instruction formats instead of addressing modes to determine how to encode instructions.
llvm-svn: 58764
2008-11-05 18:35:52 +00:00
Dan Gohman 7a638a8c7e Reintroduce a comment that was removed with the AddToISelQueue
changes.

llvm-svn: 58760
2008-11-05 17:16:24 +00:00
Richard Osborne bfd58d87f3 Test commit, add Makefile for XCore target, more to follow.
llvm-svn: 58755
2008-11-05 09:53:58 +00:00
Evan Cheng 27889ab29f Add more vector move low and zero-extend patterns.
llvm-svn: 58752
2008-11-05 06:04:51 +00:00
Evan Cheng 3cd5e8c97b Indentation.
llvm-svn: 58750
2008-11-05 06:03:38 +00:00
Dan Gohman f14b77ebf1 Eliminate the ISel priority queue, which used the topological order for a
priority function. Instead, just iterate over the AllNodes list, which is
already in topological order. This eliminates a fair amount of bookkeeping,
and speeds up the isel phase by about 15% on many testcases.

The impact on most targets is that AddToISelQueue calls can be simply removed.

In the x86 target, there are two additional notable changes.

The rule-bending AND+SHIFT optimization in MatchAddress that creates new
pre-isel nodes during isel is now a little more verbose, but more robust.
Instead of either creating an invalid DAG or creating an invalid topological
sort, as it has historically done, it can now just insert the new nodes into
the node list at a position where they will be consistent with the topological
ordering.

Also, the address-matching code has logic that checked to see if a node was
"already selected". However, when a node is selected, it has all its uses
taken away via ReplaceAllUsesWith or equivalent, so it won't recieve any
further visits from MatchAddress. This code is now removed.

llvm-svn: 58748
2008-11-05 04:14:16 +00:00
Dan Gohman fd820528ab Use getTargetConstant instead of getConstant for nodes that should not be visited
by isel and potentially forced into registers.

llvm-svn: 58747
2008-11-05 02:06:09 +00:00
Evan Cheng 132de1983f Rename isGVLazyPtr to isGVNonLazyPtr relocation. This represents Mac OS X
indirect gv reference. Please don't call it lazy.

llvm-svn: 58746
2008-11-05 01:50:32 +00:00
Evan Cheng e3827d9061 Actually ARM / Mac OS X does have UINTTOFP_I64_F{64|32} libcalls.
llvm-svn: 58725
2008-11-04 22:19:55 +00:00
Evan Cheng 297b32a367 Custom lower bit_convert i64 -> f64 into FMDRR. This is now happening with legalizetypes.
llvm-svn: 58714
2008-11-04 19:57:48 +00:00
Evan Cheng 4eaff40147 Debug output tweak.
llvm-svn: 58708
2008-11-04 17:58:53 +00:00
Evan Cheng 453844c352 LDM_RET restores pc, do not set 's' bit which would restore CPSR from SPSR.
llvm-svn: 58707
2008-11-04 17:57:07 +00:00
Evan Cheng 9340be4641 For some targets, it's not possible to place GVs in the same memory buffer as the MachineCodeEmitter allocated memory. Code and data has different read / write / execution privilege requirements.
This is a short term workaround. The current solution is for the JIT memory manager to manage code and data memory separately.

llvm-svn: 58688
2008-11-04 09:30:48 +00:00
Evan Cheng 2299c99d79 Stylistic change.
llvm-svn: 58683
2008-11-04 06:10:06 +00:00
Evan Cheng 6dd08b6604 Handle ARM machine constantpool entries.
llvm-svn: 58671
2008-11-04 00:50:32 +00:00
Dan Gohman b9110e7fbb The ANDMask node folds to a constant, and isn't the node that needs to
have its node id set. The new and and shift nodes are the nodes that need
the IDs. This fixes PR2982.

llvm-svn: 58655
2008-11-03 23:43:55 +00:00
Evan Cheng f60e5aaaac Remove a dead switch statement.
llvm-svn: 58644
2008-11-03 21:26:52 +00:00
Evan Cheng 3620e685b5 Minor code restructuring. No functionality change.
llvm-svn: 58643
2008-11-03 21:02:39 +00:00
Jim Grosbach 4d0549e3be Add binary encoding support for multiply instructions. Some blanks left to fill in, but the basics are there.
llvm-svn: 58626
2008-11-03 18:38:31 +00:00
Dan Gohman ac41d9f5d8 Refactor various TargetAsmInfo subclasses' TargetMachine members away
adding a TargetMachine member to the base TargetAsmInfo class instead.

llvm-svn: 58624
2008-11-03 18:22:42 +00:00
Bill Wendling 03f5122c6c Whitespace fixes. No functionality change.
llvm-svn: 58539
2008-10-31 21:26:08 +00:00
Evan Cheng 83bf3de134 Add comment.
llvm-svn: 58533
2008-10-31 19:56:03 +00:00
Evan Cheng 20dbb3bcad Use better data structure for ConstPoolId2AddrMap.
llvm-svn: 58532
2008-10-31 19:55:13 +00:00
Evan Cheng 44994e0c77 Actually make debug output understandable.
llvm-svn: 58529
2008-10-31 19:15:52 +00:00
Mon P Wang ef89465c9f x86_64 rip-relative and magic mode address
llvm-svn: 58528
2008-10-31 19:13:42 +00:00
Evan Cheng 8fce66a47c Forgot this in last commit.
llvm-svn: 58527
2008-10-31 19:11:09 +00:00
Evan Cheng 467e6e8093 Encode PICADD; some code clean up.
llvm-svn: 58526
2008-10-31 19:10:44 +00:00
Bill Wendling d2bc13380f Revert r58489. It isn't correct for all cases.
llvm-svn: 58523
2008-10-31 18:30:19 +00:00
Evan Cheng 7e8202fce4 Change x86 register allocation ordering to match that of gcc. Otherwise some tools get confused by prologue generated by llvm.
llvm-svn: 58517
2008-10-31 16:52:57 +00:00
Bill Wendling 6d70df0b05 Don't skip over all "terminator" instructions when determining where to put the
callee-saved restore code. It could skip over conditional jumps
accidentally. Instead, just skip the "return" instructions.

llvm-svn: 58489
2008-10-31 04:00:23 +00:00
Dan Gohman 99cdf8893e Use MOVSSmr instead of EXTRACTPSmr in the case of extracting
vector element 0 for a store, as it's smaller and faster.

llvm-svn: 58483
2008-10-31 00:57:24 +00:00
Evan Cheng c696ef9b11 I think we got non-machine specific constpool entries covered.
llvm-svn: 58474
2008-10-30 23:43:36 +00:00
Duncan Sands 1310574b0f Shift amounts should have type getShiftAmountTy
(i32 for PPC, not i8).  Correct this, and some
formatting while there.

llvm-svn: 58451
2008-10-30 19:28:32 +00:00
Duncan Sands 0852f48d1d Shift amounts should have the type given by
getShiftAmountTy (i32 in the case of CellSPU).

llvm-svn: 58449
2008-10-30 19:24:28 +00:00
Evan Cheng 66cff408ff ARM JIT should observe -relocation-model command line option.
llvm-svn: 58433
2008-10-30 16:10:54 +00:00
Mon P Wang 58c3794c27 Add initial support for vector widening. Logic is set to widen for X86.
One will only see an effect if legalizetype is not active.  Will move
support to LegalizeType soon.

llvm-svn: 58426
2008-10-30 08:01:45 +00:00
Scott Michel 487c43412d Resolve bug 2947: vararg-marked functions must spill registers R3-R79 to stack
so that va_start/va_arg/et.al. will walk arguments correctly for Cell SPU.

N.B.: Because neither clang nor llvm-gcc-4.2 can be built for CellSPU, this is
still unexorcised code.

llvm-svn: 58415
2008-10-30 01:51:48 +00:00
Evan Cheng 19d64ba8bf Correct way to handle CONSTPOOL_ENTRY instructions.
llvm-svn: 58409
2008-10-29 23:55:43 +00:00
Evan Cheng de9dbc5584 Add debugging support.
llvm-svn: 58408
2008-10-29 23:55:17 +00:00
Nate Begeman 534ac08ebd Fix PEXTRQ encoding
llvm-svn: 58403
2008-10-29 23:07:17 +00:00
Dale Johannesen 98aa9d3e49 Add a RM pseudoreg for the rounding mode, which
allows ppcf128->int conversion to work with
DeadInstructionElimination.  This is now turned
off but RM is harmless.  It does not do a complete
job of modeling the rounding mode.

Revert marking MFCR as using all 7 CR subregisters;
while correct, this caused the problem in PR 2964,
plus the local RA crash noted in the comments.
This was needed to make DeadInstructionElimination,
but as we are not running that, it is backed out
for now.  Eventually it should go back in and the
other problems fixed where they're broken.

llvm-svn: 58391
2008-10-29 18:26:45 +00:00
Jim Grosbach ff2b4948ce Support for constant islands in the ARM JIT.
Since the ARM constant pool handling supercedes the standard LLVM constant
pool entirely, the JIT emitter does not allocate space for the constants,
nor initialize the memory. The constant pool is considered part of the 
instruction stream.

Likewise, when resolving relocations into the constant pool, a hook into
the target back end is used to resolve from the constant ID# to the
address where the constant is stored.

For now, the support in the ARM emitter is limited to 32-bit integer. Future
patches will expand this to the full range of constants necessary.

llvm-svn: 58338
2008-10-28 18:25:49 +00:00
Duncan Sands 4068a7f31e Fix darwin ppc llvm-gcc build breakage: intercept
ppcf128 to i32 conversion and expand it into a code
sequence like in LegalizeDAG.  This needs custom
ppc lowering of FP_ROUND_INREG, so turn that on and
make it work with LegalizeTypes.  Probably PPC should
simply custom lower the original conversion.

llvm-svn: 58329
2008-10-28 15:00:32 +00:00
Chris Lattner 38461f6b2f Fix a nasty miscompilation of 176.gcc on linux/x86 where we synthesized
a memset using 16-byte XMM stores, but where the stack realignment code
didn't work.  Until it does (PR2962) disable use of xmm regs in memcpy
and memset formation for linux and other targets with insufficiently
aligned stacks.

This is part of PR2888

llvm-svn: 58317
2008-10-28 05:49:35 +00:00
David Greene ce2a938186 Have TableGen emit setSubgraphColor calls under control of a -gen-debug
flag.  Then in a debugger developers can set breakpoints at these calls
to see waht is about to be selected and what the resulting subgraph
looks like.  This really helps when debugging instruction selection.

llvm-svn: 58278
2008-10-27 21:56:29 +00:00
Evan Cheng f713722975 For now, don't split live intervals around x87 stack register barriers. FpGET_ST0_80 must be right after a call instruction (and ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 registers between them.
llvm-svn: 58230
2008-10-27 07:14:50 +00:00
Dan Gohman 191453174d Move the code that adds the DeadMachineInstructionElimPass from
target-independent code to target-specific code. This prevents it
from running on targets that aren't using fast-isel.

In addition to saving compile time, this addresses the problem
that not all targets are prepared for it. In order to use this
pass, all instructions must declare all their fixed uses and
defs of physical registers.

llvm-svn: 58144
2008-10-25 17:46:52 +00:00
Nicolas Geoffray 5457ce9ac3 Support for allocation of TLS variables in the JIT. Allocation of a global
variable is moved to the execution engine. The JIT calls the TargetJITInfo
to allocate thread local storage. Currently, only linux/x86 knows how to
allocate thread local global variables.

llvm-svn: 58142
2008-10-25 15:41:43 +00:00
Nicolas Geoffray db30612fc4 Generate code for TLS instructions.
llvm-svn: 58141
2008-10-25 15:22:06 +00:00
Oscar Fuentes 9ba4650b76 CMake: lib/Target/ARM/AsmPrinter/CMakeLists.txt added.
llvm-svn: 58133
2008-10-25 03:40:32 +00:00
Dale Johannesen 71f361e758 Mark MFCR as reading all condition code registers.
Prevents some more overzealous deletions (mostly
in AltiVec code).

llvm-svn: 58121
2008-10-24 22:08:01 +00:00
Dale Johannesen 3863f8e725 Rewrite logic to figure out whether LR needs to
be saved/restored in the prolog/epilog.  We need
to do this iff something in the function stores
into it.

llvm-svn: 58116
2008-10-24 21:24:23 +00:00
Torok Edwin 33986d8f17 move the note to the correct README
llvm-svn: 58104
2008-10-24 19:23:07 +00:00
Torok Edwin fcaae54669 add note about va_arg code on x86 and x86-64
llvm-svn: 58103
2008-10-24 19:20:05 +00:00
Duncan Sands 014f5bbaad Fix translateX86CC: if SetCCOpcode is SETULE and
LHS is a foldable load, then LHS and RHS are swapped
and SetCCOpcode is changed to SETUGT.  But the later
code is expecting operands to be the wrong way round
for SETUGT, but they are not in this case, resulting
in an inverted compare.  The solution is to move the
load normalization before the correction for SETUGT.
This bug was tickled by LegalizeTypes which happened
to legalize the testcase slightly differently to
LegalizeDAG.

llvm-svn: 58092
2008-10-24 13:03:10 +00:00
Dan Gohman 712886f561 Fix constant-offset emission for x86-64 absolute addresses. This
fixes a bunch of test-suite JIT failures on x86-64 in
-relocation-model=static mode.

llvm-svn: 58066
2008-10-24 01:57:54 +00:00
Dale Johannesen e395d78657 Mark defs and uses of CTR and LR correctly.
Prevents DeadMachineInstructionElim from thinking
things like MTCTR are dead (fixes massive
testsuite breakage at -O0).

llvm-svn: 58043
2008-10-23 20:41:28 +00:00
Jim Grosbach 1ecf1fd5c8 remove extraneous #ifdef's
llvm-svn: 58006
2008-10-22 22:27:51 +00:00
Dale Johannesen f6655a9e79 Remove allocation of unused stack slot.
llvm-svn: 57987
2008-10-22 17:26:06 +00:00
Duncan Sands 5ee1dde8fa Get this working with LegalizeTypes: (1) don't
assume that i64 has been turned into a BUILD_PAIR
node (when called from LegalizeTypes this hasn't
happened yet) and don't use a vector shuffle mask
with an illegal element type.

llvm-svn: 57972
2008-10-22 11:24:12 +00:00
Chris Lattner 35b40f8c2f Fix PR2907 by digging through constant expressions to find FP constants that
are their operands.

llvm-svn: 57956
2008-10-22 04:53:16 +00:00
Oscar Fuentes f3c03b02dc CMake: Turned some libraries into partially linked objects. Corrected
names of LLVMCore and ARMCodeGen.

llvm-svn: 57943
2008-10-22 02:51:53 +00:00
Dale Johannesen cf4607fcce Adjust comments for pedantic satisfaction.
llvm-svn: 57940
2008-10-22 00:02:32 +00:00
Dale Johannesen 3d7ece1acb Add comments to explain uint64->f64 algorithm,
well, sort of.  (Algorithm by Ian Ollmann.)

llvm-svn: 57932
2008-10-21 23:07:49 +00:00
Dale Johannesen 28929589e7 Add an SSE2 algorithm for uint64->f64 conversion.
The same one Apple gcc uses, faster.  Also gets the
extreme case in gcc.c-torture/execute/ieee/rbug.c
correct which we weren't before; this is not
sufficient to get the test to pass though, there
is another bug.

llvm-svn: 57926
2008-10-21 20:50:01 +00:00
Dan Gohman 4ddf7a4c22 Implement the optimized FCMP_OEQ/FCMP_UNE code for x86 fast-isel.
llvm-svn: 57915
2008-10-21 18:24:51 +00:00
Jim Grosbach cfebc18d7c use pre-UAL mnemonics for push/pop for compilaton callback function
llvm-svn: 57911
2008-10-21 16:54:12 +00:00
Dan Gohman c14e5227f0 Disable constant-offset folding for PowerPC, as the PowerPC target
isn't yet prepared for it.

llvm-svn: 57886
2008-10-21 03:41:46 +00:00
Dan Gohman 269246b034 Don't create TargetGlobalAddress nodes with offsets that don't fit
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
2008-10-21 03:38:42 +00:00
Dan Gohman 97d95d6d85 Optimized FCMP_OEQ and FCMP_UNE for x86.
Where previously LLVM might emit code like this:

        ucomisd %xmm1, %xmm0
        setne   %al
        setp    %cl
        orb     %al, %cl
        jne     .LBB4_2

it now emits this:

        ucomisd %xmm1, %xmm0
        jne     .LBB4_2
        jp      .LBB4_2

It has fewer instructions and uses fewer registers, but it does
have more branches. And in the case that this code is followed by
a non-fallthrough edge, it may be followed by a jmp instruction,
resulting in three branch instructions in sequence. Some effort
is made to avoid this situation.

To achieve this, X86ISelLowering.cpp now recognizes FCMP_OEQ and
FCMP_UNE in lowered form, and replace them with code that emits
two branches, except in the case where it would require converting
a fall-through edge to an explicit branch.

Also, X86InstrInfo.cpp's branch analysis and transform code now
knows now to handle blocks with multiple conditional branches. It
uses loops instead of having fixed checks for up to two
instructions. It can now analyze and transform code generated
from FCMP_OEQ and FCMP_UNE.

llvm-svn: 57873
2008-10-21 03:29:32 +00:00
Dan Gohman c835458da9 When the coalescer is doing rematerializing, have it remove
the copy instruction from the instruction list before asking the
target to create the new instruction. This gets the old instruction
out of the way so that it doesn't interfere with the target's
rematerialization code. In the case of x86, this helps it find
more cases where EFLAGS is not live.

Also, in the X86InstrInfo.cpp, teach isSafeToClobberEFLAGS to check
to see if it reached the end of the block after scanning each
instruction, instead of just before. This lets it notice when the
end of the block is only two instructions away, without doing any
additional scanning.

These changes allow rematerialization to clobber EFLAGS in more
cases, for example using xor instead of mov to set the return value
to zero in the included testcase.

llvm-svn: 57872
2008-10-21 03:24:31 +00:00
Jim Grosbach 9396051e3d Update the stub and callback code to handle lazy compilation. The stub
is re-written by the callback to branch directly to the compiled code
in future invocations.

Added back in range-based memory permission functions for the updating of
the stub on Darwin.

llvm-svn: 57846
2008-10-20 21:39:23 +00:00
Duncan Sands 1d20ab5784 Have X86 custom lowering for LegalizeTypes use
LowerOperation if it doesn't know what else to do.
This methods should probably be factorized some,
but this is good enough for the moment.  Have
LowerATOMIC_BINARY_64 use EXTRACT_ELEMENT rather
than assuming the operand is a BUILD_PAIR (if it
is then getNode will automagically simplify the
EXTRACT_ELEMENT).  This way LowerATOMIC_BINARY_64
usable from LegalizeTypes.

llvm-svn: 57831
2008-10-20 15:56:33 +00:00
Dan Gohman 2fe6bee5b6 Teach DAGCombine to fold constant offsets into GlobalAddress nodes,
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
2008-10-18 02:06:02 +00:00
Dan Gohman 209fc26462 This is now partly done.
llvm-svn: 57734
2008-10-17 21:39:27 +00:00
Dan Gohman b1d8d6ecff This is done.
llvm-svn: 57733
2008-10-17 21:38:40 +00:00
Evan Cheng 0fcc89b596 Add implicit defs of XMM8 to XMM15 on 32-bit call instructions. While this is not technically true, it tells tblgen that these instructions "clobber" the entire XMM register file.
llvm-svn: 57723
2008-10-17 21:02:22 +00:00
Chris Lattner 8e2ef196ae add support for 128 bit inputs on both x86-64 and x86-32.
llvm-svn: 57709
2008-10-17 18:15:05 +00:00
Chris Lattner c7e65f4377 Fix a bug where the x86 backend would reject 64-bit r constraints when
in 32-bit mode instead of assigning a register pair.  This has nothing to
do with PR2356, but I happened to notice it while working on it.

llvm-svn: 57704
2008-10-17 17:59:52 +00:00
Evan Cheng 27c3702267 Fix lfence and mfence encoding. These look like MRM5r and MRM6r instructions except they do not have any operands. The RegModRM byte is encoded with register number 0.
llvm-svn: 57692
2008-10-17 17:14:20 +00:00
Evan Cheng 9e23d746bf getX86RegNum has long been moved to X86RegisterInfo.
llvm-svn: 57691
2008-10-17 17:12:18 +00:00
Chris Lattner 7e9e3b3d4b add some simple hacky long double support for the CBE. This
should work for intel long double, but ppc long double aborts
in convert.

llvm-svn: 57672
2008-10-17 06:11:48 +00:00
Dan Gohman ca0546facc Fun x86 encoding tricks: when adding an immediate value of 128,
use a SUB instruction instead of an ADD, because -128 can be
encoded in an 8-bit signed immediate field, while +128 can't be.
This avoids the need for a 32-bit immediate field in this case.

A similar optimization applies to 64-bit adds with 0x80000000,
with the 32-bit signed immediate field.

To support this, teach tablegen how to handle 64-bit constants.

llvm-svn: 57663
2008-10-17 01:33:43 +00:00
Dan Gohman a39b0a1f05 Define patterns for shld and shrd that match immediate
shift counts, and patterns that match dynamic shift counts
when the subtract is obscured by a truncate node.

Add DAGCombiner support for recognizing rotate patterns
when the shift counts are defined by truncate nodes.

Fix and simplify the code for commuting shld and shrd
instructions to work even when the given instruction doesn't
have a parent, and when the caller needs a new instruction.

These changes allow LLVM to use the shld, shrd, rol, and ror
instructions on x86 to replace equivalent code using two
shifts and an or in many more cases.

llvm-svn: 57662
2008-10-17 01:23:35 +00:00
Dan Gohman e33afda4fa Trim #includes.
llvm-svn: 57649
2008-10-16 20:18:31 +00:00
Chris Lattner ba88d86a65 fix typo noticed by sdt
llvm-svn: 57644
2008-10-16 17:02:50 +00:00
Duncan Sands dc84511146 Fix warnings about mb/me being potentially used
uninitialized in these functions with gcc-4.3.

llvm-svn: 57635
2008-10-16 13:02:33 +00:00
Chris Lattner 305fb0a7ba add some notes
llvm-svn: 57631
2008-10-16 07:04:06 +00:00
Chris Lattner 29628cc5da add some notes and a file to collect unimplemented features in the
x86 backend.  These will all be answered with "patches welcome", so
a PR doesn't help drive them along.

llvm-svn: 57630
2008-10-16 06:46:12 +00:00
Chris Lattner 122c9b1b22 mark some targets as experimental. Andrew, if you think that Alpha is
basically working, feel free to remove the tag.  The other targets have
really basic things that break them.

llvm-svn: 57628
2008-10-16 06:16:50 +00:00
Dan Gohman 33332bce17 Const-ify several TargetInstrInfo methods.
llvm-svn: 57622
2008-10-16 01:49:15 +00:00
Dan Gohman 4a87660127 Remove an unused variable.
llvm-svn: 57621
2008-10-16 01:47:47 +00:00
Dan Gohman 6bae5268a7 Fix the predicate for memop64 to be a regular load, not just
an unindexed load.

llvm-svn: 57612
2008-10-16 00:03:00 +00:00
Chris Lattner 9b83197b76 move PR1941 here.
llvm-svn: 57586
2008-10-15 16:33:52 +00:00
Chris Lattner 6d275fd6e1 move PR1604 here.
llvm-svn: 57582
2008-10-15 16:06:03 +00:00
Chris Lattner 843dacc937 move PR1488 into this file.
llvm-svn: 57579
2008-10-15 16:02:15 +00:00
Dan Gohman 29ad439782 Now that predicates can be composed, simplify several of
the predicates by extending simple predicates to create
more complex predicates instead of duplicating the logic
for the simple predicates.

This doesn't reduce much redundancy in DAGISelEmitter.cpp's
generated source yet; that will require improvements to
DAGISelEmitter.cpp's instruction sorting, to make it more
effectively group nodes with similar predicates together.

llvm-svn: 57565
2008-10-15 06:50:19 +00:00
Chris Lattner 117792afec add a note
llvm-svn: 57557
2008-10-15 05:53:25 +00:00
Chris Lattner ddb17ce4be add support for folding immediates into stores when they
are due to argument passing in calls.  This is significant because
it hits all immediate arguments to calls on x86-32.

llvm-svn: 57556
2008-10-15 05:38:32 +00:00
Chris Lattner 3ba293564a fold immediates into stores in simple cases, this produces diffs like
this:

-	movl	$0, %eax
-	movl	%eax, _yy_n_chars
+	movl	$0, _yy_n_chars

llvm-svn: 57555
2008-10-15 05:30:52 +00:00
Chris Lattner e388725aef fold compare of null pointer into compare with 0.
llvm-svn: 57553
2008-10-15 05:18:04 +00:00
Chris Lattner a0f9d4972f Some minor cleanups:
1. Compute action in X86SelectSelect based on MVT instead of type.
2. Use TLI.getValueType(..) instead of MVT::getVT(..) because the former
   handles pointers and the later doesn't.
3. Don't pass TLI into isTypeLegal, since it already has access to it as 
   an ivar.

#2 gives fast isel some minor new functionality: handling load/stores of
pointers.

llvm-svn: 57552
2008-10-15 05:07:36 +00:00
Chris Lattner 74e012839d Use switch on VT instead of Type* comparisons.
llvm-svn: 57551
2008-10-15 04:32:45 +00:00
Chris Lattner dc1c380f23 Use X86FastEmitCompare for FCMP_OEQ and FCMP_UNE: it doesn't
change the generated code, but makes the code simpler.

llvm-svn: 57550
2008-10-15 04:29:23 +00:00
Chris Lattner d46b9510b6 refactor compare emission out into a new X86FastEmitCompare method,
which makes it easy to share the compare/imm folding logic with 'setcc'.
This shaves a bunch of instructions off the common select case, which
happens a lot in llvm-gcc.

llvm-svn: 57549
2008-10-15 04:26:38 +00:00
Chris Lattner 88f4754f8f Fold immediates into compares when possible, producing "cmp $4, %eax" instead of
loading 4 into a register and then doing the compare.

llvm-svn: 57548
2008-10-15 04:13:29 +00:00
Chris Lattner 47bef25c01 more minor refactoring of X86SelectBranch, no functionality change.
llvm-svn: 57547
2008-10-15 04:02:26 +00:00
Chris Lattner 0ce717ac6b factor buildmi calls in X86SelectBranch
llvm-svn: 57546
2008-10-15 03:58:05 +00:00
Chris Lattner f32ce221e4 factor some more BuildMI's in X86SelectCmp
llvm-svn: 57545
2008-10-15 03:52:54 +00:00
Chris Lattner a3596db462 factor some BuildMI calls, no functionality change.
llvm-svn: 57544
2008-10-15 03:47:17 +00:00
Evan Cheng 3b0f5e4d61 - Add target lowering hooks that specify which setcc conditions are illegal,
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
2008-10-15 02:05:31 +00:00
Dan Gohman e7ced74558 FastISel support for exception-handling constructs.
- Move the EH landing-pad code and adjust it so that it works
   with FastISel as well as with SDISel.
 - Add FastISel support for @llvm.eh.exception and
   @llvm.eh.selector.

llvm-svn: 57539
2008-10-14 23:54:11 +00:00
Dale Johannesen 28106756af Accept -march=i586, because gcc does (a synonym
for pentium).  Fixes
gcc.target/i386/20000720-1.c
gcc.target/i386/pr26826.c

llvm-svn: 57528
2008-10-14 22:06:33 +00:00
Evan Cheng 07d53b1d33 Rename LoadX to LoadExt.
llvm-svn: 57526
2008-10-14 21:26:46 +00:00
Jim Grosbach b7c01f5f48 Update ARM Insn encoding to get endian-ness to match the documentation (31-0 left to right)
llvm-svn: 57524
2008-10-14 20:36:24 +00:00
Dan Gohman 9c4b7d5c4f Fix command-line option printing to print two spaces where needed,
instead of requiring all "short description" strings to begin with
two spaces. This makes these strings less mysterious, and it fixes
some cases where short description strings mistakenly did not
begin with two spaces.

llvm-svn: 57521
2008-10-14 20:25:08 +00:00
Evan Cheng c36231b95e Fix indentation.
llvm-svn: 57508
2008-10-14 17:15:39 +00:00
Dan Gohman 56b6885104 When doing the very-late shift-and address-mode optimization,
create a new DAG node to represent the new shift to keep the
DAG consistent, even though it'll almost always be folded into
the address.

If a user of the resulting address has multiple uses, the
nodes may get revisited by a later MatchAddress call, in which
case DAG inconsistencies do matter.

This fixes PR2849.

llvm-svn: 57465
2008-10-13 20:52:04 +00:00
Anton Korobeynikov 46a9c01fff Update size of inst correctly with segment override.
llvm-svn: 57414
2008-10-12 10:30:11 +00:00
Chris Lattner 2753955fc0 Change CALLSEQ_BEGIN and CALLSEQ_END to take TargetConstant's as
parameters instead of raw Constants.  This prevents the constants from
being selected by the isel pass, fixing PR2735.

llvm-svn: 57385
2008-10-11 22:08:30 +00:00
Duncan Sands 23ee981e8e Fix comment typo.
llvm-svn: 57381
2008-10-11 19:34:24 +00:00
Anton Korobeynikov 2589777f3f Add ability to override segment (mostly for code emitter purposes).
llvm-svn: 57380
2008-10-11 19:09:15 +00:00
Dale Johannesen 05b54c2af4 Fix SSE4.1 roundss, roundsd. While the instructions have
the same pattern as roundpd/roundps, the Intel compiler 
builtins do not:  rounds* has an extra operand.  Fixes
gcc.target/i386/sse4_1-rounds[sd]-[1234].c

llvm-svn: 57370
2008-10-10 23:51:03 +00:00
Anton Korobeynikov 58deb69040 Fix a thinko and unbreak sparc default CC
llvm-svn: 57368
2008-10-10 21:47:37 +00:00
Anton Korobeynikov f8a4a0e959 Extend set of return registers on sparc until someone will implement MRV support there. At least, this will allow libgcc compile, however we are not ABI-compatible with stuff compiled with native gcc.
llvm-svn: 57364
2008-10-10 20:30:14 +00:00
Anton Korobeynikov b80b485264 Ignore extra 'r' modifier for now
llvm-svn: 57363
2008-10-10 20:29:50 +00:00
Anton Korobeynikov 76baad1ffc Use expand for smul_lohi for now
llvm-svn: 57362
2008-10-10 20:29:31 +00:00
Anton Korobeynikov 281cf247a5 Add rudimentary support for 'r' register operand
llvm-svn: 57359
2008-10-10 20:28:10 +00:00
Anton Korobeynikov b8736566c2 Cleanup
llvm-svn: 57358
2008-10-10 20:27:31 +00:00
Anton Korobeynikov 3db2173021 Add rudimentary asmprinter support for printing inline asm operands for sparc.
llvm-svn: 57346
2008-10-10 10:15:03 +00:00
Anton Korobeynikov 9aaaa4035e Add dummy 'm' inline asm constraint handler for Sparc. I'm not sure, whether it is correct, however :)
llvm-svn: 57345
2008-10-10 10:14:47 +00:00
Anton Korobeynikov 1f9487b916 Cleanup
llvm-svn: 57344
2008-10-10 10:14:15 +00:00
Dale Johannesen 4f0bd68cfe Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Dale Johannesen 54306fe499 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.

llvm-svn: 57325
2008-10-09 18:53:47 +00:00
Chris Lattner 1a84f86271 get CodeGen/Alpha/mul128.ll to work.
llvm-svn: 57318
2008-10-09 04:50:56 +00:00
Dale Johannesen 66e08292aa (re)Put const weak strings in appropriate section on Darwin.
g++dg/abi/key2.C

llvm-svn: 57309
2008-10-08 21:49:47 +00:00
Jim Grosbach d83529e8c4 Comment to be explicit that the enumeration values for CondCodes matter.
llvm-svn: 57295
2008-10-08 16:24:35 +00:00
Duncan Sands 32052e8272 Use template to distinguish between function variants.
GCC 4.4.0 gives an error on the "int" declaration for example
saying that it has already been declared (using the "short"
one). Using templates here allow the compiler to distinguish
between the function to choose.

Also, "llvm/Support/DataTypes.h" was not included, leading to
error messages about not knowing "uint32_t" for example.

Patch by Samuel Tardieu.

llvm-svn: 57292
2008-10-08 07:44:52 +00:00
Duncan Sands 26ff6f9c54 Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.

llvm-svn: 57291
2008-10-08 07:23:46 +00:00
Dan Gohman b3ba449cfb Add MBB successors and physreg Uses in the same order that
SDISel typically adds them in. This makes it a little easier
to compare FastISel output with SDISel output.

llvm-svn: 57266
2008-10-07 22:10:33 +00:00
Dan Gohman d3917157d5 Instead of emitting an implicit use for the super-register of
X86::CL that was used, emit an EXTRACT_SUBREG from the CL
super-register to CL. This more precisely describes how the
CL register is being used.

llvm-svn: 57264
2008-10-07 21:50:36 +00:00
Jim Grosbach f311fe142c Unconditional branch instruction encoding fix. Needs to use ABI, not AXI, to get the proper opcode bits.
llvm-svn: 57262
2008-10-07 21:08:09 +00:00
Jim Grosbach b53acd8caa need ARM.h for ARMCC definition
llvm-svn: 57261
2008-10-07 21:01:51 +00:00
Owen Anderson 1d338fc6a4 Add an option to enable StrongPHIElimination, for ease of testing.
llvm-svn: 57259
2008-10-07 20:22:28 +00:00
Jim Grosbach c084e84028 Encode the conditional execution predicate when JITing.
llvm-svn: 57258
2008-10-07 19:05:35 +00:00
Dale Johannesen 422ef88f31 Model hardwired inputs & outputs of x86 8-bit divides correctly.
Fixes local RA miscompilation of gcc.c-torture/execute/20020904-1.c -O0.

llvm-svn: 57257
2008-10-07 18:54:28 +00:00
Jim Grosbach 2fb5c3938b Clarify naming and correct conditional so that CMP and CMN instructions get the Rn operand encoded properly
llvm-svn: 57252
2008-10-07 17:42:09 +00:00
Jim Grosbach 1d54d4f375 Fix Opcode values of CMP and CMN
llvm-svn: 57251
2008-10-07 17:40:46 +00:00
Anders Carlsson 1699ad9030 Certain patterns involving the "movss" instruction were marked as requiring SSE2, when in reality movss is an SSE1 instruction.
llvm-svn: 57246
2008-10-07 16:14:11 +00:00
Andrew Lenharth 64861a7181 Note that ADDC and company don't actually expand yet (missing in legalize
llvm-svn: 57226
2008-10-07 02:10:26 +00:00
Evan Cheng 94d14f2d45 Fix PR2850 and PR2863. Only generate movddup for 128-bit SSE vector shuffles.
llvm-svn: 57210
2008-10-06 21:13:08 +00:00
Devang Patel c0f3b52e65 It is possible that all functions in one module are not being
optimized for size. Set OptForSize for each function separately.

llvm-svn: 57182
2008-10-06 18:03:39 +00:00
Devang Patel ab379c905b Remove unncessary isDeclaration() checks.
llvm-svn: 57179
2008-10-06 17:30:07 +00:00
Anton Korobeynikov 37e560cde1 Emit type-correct constant null. Also fix a typo.
Patch by Robert G. Jakabosky!

llvm-svn: 57110
2008-10-05 15:07:06 +00:00
Anton Korobeynikov d2aded08ac Fix weird think-o and unbreak build on all gcc-3.4.x-based platforms (e.g. mingw)
llvm-svn: 57106
2008-10-05 08:53:29 +00:00
Chris Lattner f9325e5f67 this case is matched now.
llvm-svn: 57096
2008-10-05 02:16:12 +00:00
Anton Korobeynikov b52ef06c8c Revert r56675 - it breaks unwinding runtime everywhere.
llvm-svn: 57048
2008-10-04 11:09:36 +00:00
Dale Johannesen 8c36a1c09c Make atomic Swap work, 64-bit on x86-32.
Make it all work in non-pic mode.

llvm-svn: 57034
2008-10-03 22:25:52 +00:00
Dale Johannesen 5d60c1ebb1 Pass MemOperand through for 64-bit atomics on 32-bit,
incidentally making the case where the memop is a
pointer deref work.  Fix cmp-and-swap regression.

llvm-svn: 57027
2008-10-03 19:41:08 +00:00
Dan Gohman 2c836cf187 Avoid creating two TargetLowering objects for each target.
Instead, just create one, and make sure everything that needs
it can access it. Previously most of the SelectionDAGISel
subclasses all had their own TargetLowering object, which was
redundant with the TargetLowering object in the TargetMachine
subclasses, except on Sparc, where SparcTargetMachine
didn't have a TargetLowering object. Change Sparc to work
more like the other targets here.

llvm-svn: 57016
2008-10-03 16:55:19 +00:00
Dan Gohman eae96ce3ec Remove an unused field.
llvm-svn: 57014
2008-10-03 16:17:33 +00:00
Jim Grosbach 332ad5e016 Indexing off by one resulted in errant encoding of source register for
reg->reg moves.

llvm-svn: 57011
2008-10-03 15:53:56 +00:00
Jim Grosbach af929abc01 NeedStub/DoesntNeedStub logic was reversed, leading to not using a stub
for global relocations that do need them (libc calls, for example).

llvm-svn: 57010
2008-10-03 15:52:42 +00:00
Dan Gohman 0d1e9a8e04 Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.

llvm-svn: 57006
2008-10-03 15:45:36 +00:00
Dan Gohman b01a9c94d4 Fix X86FastISel to handle dynamic allocas that have avoided
getting inserted into the ValueMap. This avoids infinite
recursion in some rare cases.

llvm-svn: 56989
2008-10-03 01:27:49 +00:00
Dan Gohman 1ab1d31f7a Optimize conditional branches in X86FastISel. This replaces
sequences like this:
       sete    %al
       testb   %al, %al
       jne     LBB11_1
with this:
       je      LBB11_1

llvm-svn: 56969
2008-10-02 22:15:21 +00:00
Dale Johannesen 867d549fce Handle some 64-bit atomics on x86-32, some of the time.
llvm-svn: 56963
2008-10-02 18:53:47 +00:00
Dan Gohman b158fd751c Work around an interaction between fast-isel and regalloc=local. The
local register allocator's physreg liveness doesn't recognize subregs,
so it doesn't know that defs of %ecx that are immediately followed by
uses of %cl aren't dead. This comes up due to the way fast-isel emits
shift instructions.

This is a temporary workaround. Arguably, local regalloc should
handle subreg references correctly. On the other hand, perhaps
fast-isel should use INSERT_SUBREG instead of just assigning to the
most convenient super-register of %cl when lowering shifts.

This fixes MultiSource/Benchmarks/MallocBench/espresso,
MultiSource/Applications/hexxagon, and others, under -fast.

llvm-svn: 56947
2008-10-02 14:56:12 +00:00
Bill Wendling b04e6edba9 "The original bug was a complaint that _mm_srli_si128 mis-compiled when passed
a constant vector ("{0x123, 0x456}" syntax).  The fix is to simplify the
_mm_srli_si128 macro, and  move the "* 8" from the macro into the compiler
back-end.  I can't change the existing __builtins because so many people are
using them :-(."
Patch by Stuart Hastings!

llvm-svn: 56944
2008-10-02 05:56:52 +00:00
Devang Patel 1b76f2c40b Remove OptimizeForSize global. Use function attribute optsize.
llvm-svn: 56937
2008-10-01 23:18:38 +00:00
Dan Gohman 6388dde98e Split x86's ADJCALLSTACK instructions into 32-bit and 64-bit forms.
This allows the 64-bit forms to use+def RSP instead of ESP. This
doesn't fix any real bugs today, but it is more precise and it
makes the debug dumps on x86-64 look more consistent.

Also, add some comments describing the CALL instructions' physreg
operand uses and defs.

llvm-svn: 56925
2008-10-01 18:28:06 +00:00
Jim Grosbach 3dc0a3bce3 Fix typo s/ther/there/
llvm-svn: 56924
2008-10-01 18:16:49 +00:00
Dan Gohman bb3c5019f8 Mark CALL instructions as having a Use of ESP/RSP.
llvm-svn: 56911
2008-10-01 04:14:30 +00:00
Bill Wendling 68f12ee567 Implement the -fno-builtin option in the front-end, not in the back-end.
llvm-svn: 56900
2008-10-01 00:59:58 +00:00
Bill Wendling 1782584f56 Just don't transform this memset into "bzero" if no-builtin is specified.
llvm-svn: 56888
2008-09-30 22:05:33 +00:00
Bill Wendling bd09262e97 Add the new `-no-builtin' flag. This flag is meant to mimic the GCC
`-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
2008-09-30 21:22:07 +00:00
Dan Gohman 86aa16a69a Optimize SelectionDAG's AssignTopologicalOrder even further.
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
2008-09-30 18:30:35 +00:00
Dan Gohman 8392f0c75d Fix X86FastISel's output for x86-32 PIC constant pool addresses.
llvm-svn: 56829
2008-09-30 01:21:32 +00:00
Dan Gohman 6ebe734ca6 Move the GlobalBaseReg field out of X86ISelDAGToDAG.cpp
and X86FastISel.cpp into X86MachineFunction.h, so that it
can be shared, instead of having each selector keep track
of its own.

llvm-svn: 56825
2008-09-30 00:58:23 +00:00
Dan Gohman 5033136825 Disable all x87 usage, including f32 and f64 when the subtarget
doesn't have SSE(2), with X86FastISel.

llvm-svn: 56823
2008-09-30 00:48:39 +00:00
Dale Johannesen f61a84ec43 Remove misuse of ReplaceNodeResults for atomics with
valid types.  No functional change.

llvm-svn: 56808
2008-09-29 22:25:26 +00:00
Dan Gohman c02dbf451e Fix an over-pessimization about GlobalVariable addresses in X86FastISel.
llvm-svn: 56802
2008-09-29 21:13:15 +00:00
Evan Cheng 82237f2f42 Fix PR2835. Do not change the width of a volatile load.
llvm-svn: 56792
2008-09-29 17:26:18 +00:00
Duncan Sands 08d91178e9 Rename isWeakForLinker to mayBeOverridden. Use it
instead of hasWeakLinkage in a bunch of optimization
passes.

llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Evan Cheng 3774b2f292 Re-apply 56683 with fixes.
llvm-svn: 56748
2008-09-27 01:56:22 +00:00
Daniel Dunbar 1d5e766016 Unbreak build.
llvm-svn: 56727
2008-09-27 00:22:09 +00:00
Devang Patel 9eb525d4f9 Implement function notes as function attributes.
llvm-svn: 56716
2008-09-26 23:51:19 +00:00
Evan Cheng 7d6fa97567 Implement "punpckldq %xmm0, $xmm0" as "pshufd $0x50, %xmm0, %xmm" unless optimizing for code size.
llvm-svn: 56711
2008-09-26 23:41:32 +00:00
Bill Wendling c966a737c5 Temporarily reverting r56683. This is causing a failure during the build of llvm-gcc:
/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -mmacosx-version-min=10.4 -O2  -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Gir/devel/llvm/clean/llvm.obj/include -I/Volumes/Gir/devel/llvm/clean/llvm.src/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c ../../llvm-gcc.src/gcc/unwind-dw2-fde-darwin.c -o libgcc/./unwind-dw2-fde-darwin.o
Assertion failed: (TargetRegisterInfo::isVirtualRegister(regA) && TargetRegisterInfo::isVirtualRegister(regB) && "cannot update physical register live information"), function runOnMachineFunction, file /Volumes/Gir/devel/llvm/clean/llvm.src/lib/CodeGen/TwoAddressInstructionPass.cpp, line 311.
../../llvm-gcc.src/gcc/unwind-dw2.c:1527: 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.
{standard input}:3521:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
{standard input}:3521:symbol: "_dwarf_reg_size_table" can't be undefined in a subtraction expression
{standard input}:3520:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
...

llvm-svn: 56703
2008-09-26 22:10:44 +00:00
Dan Gohman 6e0548336a Rename ConstantSDNode's getSignExtended to getSExtValue, for
consistancy with ConstantInt, and re-implement it in terms
of ConstantInt's getSExtValue.

llvm-svn: 56700
2008-09-26 21:54:37 +00:00
Dan Gohman 7e922aa35d Mark lea fi# as being really rematerializable.
llvm-svn: 56698
2008-09-26 21:30:20 +00:00
Evan Cheng 30f5494efb unpckhps requires sse1, punpckhdq requires sse2.
llvm-svn: 56697
2008-09-26 21:26:30 +00:00
Dan Gohman 2564b900ce Fix X86FastISel's address folding to check displacement
values for overflow.

llvm-svn: 56686
2008-09-26 20:04:15 +00:00
Evan Cheng d77cbe8947 Fix @llvm.frameaddress codegen. FP elimination optimization should be disabled when frame address is desired. Also add support for depth > 0.
llvm-svn: 56683
2008-09-26 19:48:35 +00:00
Oscar Fuentes 9e3f7dbeda CMake: Builds all examples. Corrected name of CBackend target.
llvm-svn: 56682
2008-09-26 19:48:03 +00:00
Dale Johannesen 0e32a2c935 Add "inreg" field to CallSDNode (doesn't increase
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
2008-09-26 19:31:26 +00:00
Dan Gohman 007a6bb9b9 Factor out the code for determining when symblic addresses
require RIP-relative addressing and use it to fix a bug
in X86FastISel in x86-64 PIC mode, where it was trying to
use base/index registers with RIP-relative addresses. This
fixes a bunch of x86-64 testsuite failures.

llvm-svn: 56676
2008-09-26 19:15:30 +00:00
Evan Cheng 994dd0bbec Avoid spilling EBP / RBP twice in the prologue.
llvm-svn: 56675
2008-09-26 19:14:21 +00:00
Evan Cheng 001ffdd36b X86 address displacement field must be interpreted as a 32-bit value.
llvm-svn: 56665
2008-09-26 16:58:16 +00:00
Oscar Fuentes cdc95498f5 CMake: Builds all targets.
llvm-svn: 56641
2008-09-26 04:40:32 +00:00
Dan Gohman 839105d254 Disable support for x86_f80 in X86FastISel. Supporting it would
require more work.

llvm-svn: 56637
2008-09-26 01:39:32 +00:00
Bill Wendling 374d7f2b16 If we have a function with an unreachable statement such that the ending debug
information is in an unreachable block, then it's possible that the high/low pc
values won't be set for the dwarf information. E.g., this function:

void abort(void) __attribute__((__noreturn__));
void dead_beef(void) __attribute__ ((noreturn));

int *b;

void dead_beef(void) {
  *b=0xdeadbeef;
  abort();
}

has a call to "@llvm.dbg.region.end" only in the unreachable block:

define void @dead_beef() noreturn nounwind  {
entry:
	call void @llvm.dbg.func.start(...)
	call void @llvm.dbg.stoppoint(...)
...
	call void @abort( ) noreturn nounwind 
	unreachable

return:		; No predecessors!
	call void @llvm.dbg.stoppoint(...)
	call void @llvm.dbg.region.end(...)
	ret void
}

The dwarf information emitted is something like:

0x00000084:     TAG_subprogram [5]  
                 AT_name( "dead_beef" )
                 AT_external( 0x01 )
                 AT_prototyped( 0x01 )
                 AT_decl_file( 0x01 )
                 AT_decl_line( 0x08 )

Note that this is *not* the best fix for this problem, but a band-aid for an
gaping wound. This code needs to be changed when we revamp our debugging
information.

llvm-svn: 56628
2008-09-26 00:28:12 +00:00
Evan Cheng 9dbe45c000 Prefer movlhps over punpcklqdq, etc. in more cases.
llvm-svn: 56627
2008-09-25 23:35:16 +00:00
Dan Gohman 0c1b884df1 Fix a bug in which address displacements were being added to the
load from the stub, instead of the result of the load from the stub.

llvm-svn: 56626
2008-09-25 23:34:02 +00:00
Devang Patel 4c758ea3e0 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Anton Korobeynikov 87001fd6fd Reapply 56585:56589 with proper fix for some gcc versions
llvm-svn: 56621
2008-09-25 21:00:33 +00:00
Evan Cheng 74c9ed91b0 With sse3 and when the source is a load or has multiple uses, favors movddup over shuffp*, pshufd, etc. Without sse3 or when the source is from a register, make use of movlhps
llvm-svn: 56620
2008-09-25 20:50:48 +00:00
Dale Johannesen c50ada2f56 Accept 'inreg' attribute on x86 functions as
meaning sse_regparm (i.e. float/double values go
in XMM0 instead of ST0).  Update documentation
to reflect reality.

llvm-svn: 56619
2008-09-25 20:47:45 +00:00
Dan Gohman 3691d507c4 PIC support in X86FastISel.
llvm-svn: 56608
2008-09-25 15:24:26 +00:00
Evan Cheng 84301390ae Temporarily backing out 56585:56589 to unbreak the build.
llvm-svn: 56607
2008-09-25 07:38:08 +00:00