1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

47653 Commits

Author SHA1 Message Date
Chad Rosier
8b97de1cfa Whitespace and other cleanup. Functionallity unchanged.
llvm-svn: 132533
2011-06-03 05:09:12 +00:00
Eli Friedman
eae10d6163 Add ARM fast-isel support for materializing the address of a global in cases where the global uses an indirect symbol.
rdar://9431157

llvm-svn: 132522
2011-06-03 01:13:19 +00:00
Andrew Trick
39b3306530 Basic PassManager diagnostics.
Added asserts whenever attempting to use a potentially
uninitialized pass. This helps people trying to develop a new pass and
people trying to understand the bug reports filed by the former people.

llvm-svn: 132520
2011-06-03 00:48:58 +00:00
Andrew Trick
335c4f8d8b whitespace
llvm-svn: 132519
2011-06-03 00:44:32 +00:00
Jakob Stoklund Olesen
9037bbb219 Avoid calling TRI->getAllocatableSet in RAFast.
When compiling a program with lots of small functions like
483.xalancbmk, this makes RAFast 11% faster.

Add some comments to clarify the difference between unallocatable and
reserved registers. It's quite subtle.

The fast register allocator depends on EFLAGS' not being allocatable on
x86. That way it can completely avoid tracking liveness, and it won't
mind when there are multiple uses of a single def.

llvm-svn: 132514
2011-06-02 23:41:40 +00:00
Eric Christopher
d68494ffdd Have LowerOperandForConstraint handle multiple character constraints.
Part of rdar://9119939

llvm-svn: 132510
2011-06-02 23:16:42 +00:00
Jakob Stoklund Olesen
409986a648 Flag unallocatable register classes instead of giving them empty
allocation orders.

llvm-svn: 132509
2011-06-02 23:07:24 +00:00
Jakob Stoklund Olesen
4f76a2bdc8 Make it possible to have unallocatable register classes.
Some register classes are only used for instruction operand constraints.
They should never be used for virtual registers. Previously, those
register classes were given an empty allocation order, but now you can
say 'let isAllocatable=0' in the register class definition.

TableGen calculates if a register is part of any allocatable register
class, and makes that information available in TargetRegisterDesc::inAllocatableClass.

The goal here is to eliminate use cases for overriding allocation_order_*
methods.

llvm-svn: 132508
2011-06-02 23:07:20 +00:00
Devang Patel
73e16acee8 Preserve line number information while converting Invoke into a Call.
llvm-svn: 132505
2011-06-02 22:46:58 +00:00
Jakob Stoklund Olesen
52c6a75ee3 Just use a SmallVector.
I was confused whether new uint8_t[] would zero-initialize the returned
array, and it seems that so is gcc-4.0.

This should fix the test failures on darwin 9.

llvm-svn: 132500
2011-06-02 22:22:43 +00:00
Devang Patel
7b9fc618b2 Remove dead code.
llvm-svn: 132488
2011-06-02 21:31:00 +00:00
Devang Patel
6455c3f6ae Update DBG_VALUEs while breaking anti dependencies.
llvm-svn: 132487
2011-06-02 21:26:52 +00:00
Tanya Lattner
aa1f6df650 Fix encoding for VEXTdf.
llvm-svn: 132486
2011-06-02 21:25:24 +00:00
Eli Friedman
0db9c60959 PR10067: Add missing safety check to call return transformation in MemCpyOpt::processStore. If something accesses the dest of the "copy" between the call and the copy, the performCallSlotOptzn transformation is not valid.
llvm-svn: 132485
2011-06-02 21:24:42 +00:00
Devang Patel
1c30f3ac27 During post RA scheduling, do not try to chase reg defs. to preserve DBG_VALUEs. This approach has several downsides, for example, it does not work when dbg value is a constant integer, it does not work if reg is defined more than once, it places end of debug value range markers in the wrong place. It even causes misleading incorrect debug info when duplicate DBG_VALUE instructions point to same reg def.
Instead, use simpler approach and let DBG_VALUE follow its predecessor instruction. After live debug value analysis pass, all DBG_VALUE instruction are placed at the right place. Thanks Jakob for the hint!

llvm-svn: 132483
2011-06-02 20:07:12 +00:00
Rafael Espindola
1299f014d4 Revert 132424 to fix PR10068.
llvm-svn: 132479
2011-06-02 19:57:47 +00:00
Eric Christopher
0c337a44e9 Add a new parse hint for multi-letter constraints in inline asm.
Testcase will come when we use it.

Part of rdar://9119939

llvm-svn: 132476
2011-06-02 19:26:37 +00:00
Jakob Stoklund Olesen
b5392437c8 Use RegisterClassInfo::getOrder in RAFast.
This saves two virtual function calls and an Allocatable BitVector test,
making RAFast run 2% faster.

llvm-svn: 132471
2011-06-02 18:35:30 +00:00
Jim Grosbach
8a7731f951 .cfi directive register parsing flexibility.
Parsing a register name/number for .cfi directives can't assume that a
register name starts with a '%' token. Be more flexible and check for a
register number instead. Still unlikely to be perfect, but it allows us
to parse both plain identifiers as register names and integers as register
numbers, which is what we're wanting to support at this point.

llvm-svn: 132466
2011-06-02 17:14:04 +00:00
Stuart Hastings
8447f18f85 Omit unnecessary stack copy when x87 input is a load.
rdar://problem/6373334

llvm-svn: 132458
2011-06-02 15:57:11 +00:00
Benjamin Kramer
e149500163 Start with a zeroed CSRNum map.
Found by valgrind.

llvm-svn: 132457
2011-06-02 12:07:44 +00:00
Jakob Stoklund Olesen
a8db700d44 Initialize members to fix problem found by valgrind.
llvm-svn: 132456
2011-06-02 05:43:49 +00:00
Jakob Stoklund Olesen
25716baae0 Use TRI::has{Sub,Super}ClassEq() where possible.
No functional change.

llvm-svn: 132455
2011-06-02 05:43:46 +00:00
Rafael Espindola
ee123951a2 Don't hardcode the %reg format in the streamer.
llvm-svn: 132451
2011-06-02 02:34:55 +00:00
Jakob Stoklund Olesen
24726cedf4 Add a RegisterClassInfo class that lazily caches information about
register classes.

It provides information for each register class that cannot be
determined statically, like:

- The number of allocatable registers in a class after filtering out the
  reserved and invalid registers.

- The preferred allocation order with registers that overlap callee-saved
  registers last.

- The last callee-saved register that overlaps a given physical register.

This information usually doesn't change between functions, so it is
reused for compiling multiple functions when possible.  The many
possible combinations of reserved and callee saves registers makes it
unfeasible to compute this information statically in TableGen.

Use RegisterClassInfo to count available registers in various heuristics
in SimpleRegisterCoalescing, making the pass run 4% faster.

llvm-svn: 132450
2011-06-02 02:19:35 +00:00
Akira Hatanaka
1f91013bcb Detect FI|cst pattern in MipsDAGToDAGISel::SelectAddr. Patch by Sasa Stankovic.
llvm-svn: 132448
2011-06-02 01:03:14 +00:00
Akira Hatanaka
69ae562f33 Custom-lower FRAMEADDR. Patch by Sasa Stankovic.
llvm-svn: 132444
2011-06-02 00:24:44 +00:00
Eli Friedman
884a7d08b1 When marking a block as being unanalyzable, use "Clobber" on the terminator instead of the first instruction in the block. This is a bit of a hack; "Clobber" isn't really the right marking in the first place. memdep doesn't really have any way of properly expressing "unanalyzable" at the moment. Using it on the terminator is much less ambiguous than using it on an arbitrary instruction, though.
In the given testcase, the "Clobber" was pointing to a load, and GVN was incorrectly assuming that meant that the "Clobber" load overlapped the load being analyzed (when they are actually unrelated).

The included testcase tests both this commit and r132434.

Part two of rdar://9429882.  (r132434 was mislabeled.)

llvm-svn: 132442
2011-06-02 00:08:52 +00:00
Eli Friedman
37ed424905 In MemoryDependenceAnalysis::getNonLocalPointerDepFromBB, if a given block is is deemed unanalyzable (and we execute one of the "goto PredTranslationFailure" statements), make sure we don't put information about the predecessors of that block into the returned data structures; this can lead to, among other things, extraneous results (which will confuse passes using memdep). Fixes an assert in GVN compiling ruby. Part of rdar://problem/9521954 .
Testcase coming up soon.

llvm-svn: 132434
2011-06-01 23:16:53 +00:00
Devang Patel
03708bbb55 A DBG_VALUE that truncates a range does not start another dbg value range.
llvm-svn: 132433
2011-06-01 23:00:17 +00:00
Devang Patel
1a3058d727 Do not drop constant values when a variable's content is described using .debug_loc entries.
llvm-svn: 132427
2011-06-01 22:03:25 +00:00
Stuart Hastings
9a085fb9d8 Recommit 132404 with fixes. rdar://problem/5993888
llvm-svn: 132424
2011-06-01 21:33:14 +00:00
Eric Christopher
9fe91039e4 Allow bitcasts between valid types of the same size and vector
types if the vector type is legal.

Fixes rdar://9306086

llvm-svn: 132420
2011-06-01 19:55:10 +00:00
Stuart Hastings
4b33767382 Revert 132404 to appease a buildbot. rdar://problem/5993888
llvm-svn: 132419
2011-06-01 19:52:20 +00:00
Nadav Rotem
4b8e7afe7d Refactor LegalizeTypes: Erase LegalizeAction and make the type legalizer use
the TargetLowering enum.

llvm-svn: 132418
2011-06-01 19:47:10 +00:00
Andrew Trick
b92801a07e SCEV: missing null check fix for r132360, dragonegg crash.
llvm-svn: 132416
2011-06-01 19:14:56 +00:00
Jakob Stoklund Olesen
1e7aea1b5e Revert r132358 "Simplify the eviction policy by making the failsafe explicit."
This commit caused regressions in i386 flops-[568], matrix, salsa20,
256.bzip2, and enc-md5.

llvm-svn: 132413
2011-06-01 18:45:02 +00:00
Stuart Hastings
b75a0be551 Fix double FGETSIGN to work on x86_32; followup to 132396.
rdar://problem/5660695

llvm-svn: 132411
2011-06-01 18:32:25 +00:00
Stuart Hastings
23f5ceda96 Add support for x86 CMPEQSS and friends. These instructions do a
floating-point comparison, generate a mask of 0s or 1s, and generally
DTRT with NaNs.  Only profitable when the user wants a materialized 0
or 1 at runtime.  rdar://problem/5993888

llvm-svn: 132404
2011-06-01 17:17:45 +00:00
Stuart Hastings
904f5d9bd7 Reapply 132348 with fixes. rdar://problem/6501862
llvm-svn: 132402
2011-06-01 16:42:47 +00:00
Jakob Stoklund Olesen
283a7e46b5 Fix PR10059 and future variations by handling all register subclasses.
Add TargetRegisterInfo::hasSubClassEq and use it to check for compatible
register classes instead of trying to list all register classes in
X86's getLoadStoreRegOpcode.

llvm-svn: 132398
2011-06-01 15:32:10 +00:00
Stuart Hastings
6309f11cc6 Turn on FGETSIGN for x86. Followup to 132388. rdar://problem/5660695
llvm-svn: 132396
2011-06-01 14:04:17 +00:00
Joerg Sonnenberger
ffa79cb359 Add new -d option to tblgen. It writes a make(1)-style dependency file.
llvm-svn: 132395
2011-06-01 13:10:15 +00:00
Nadav Rotem
111ad2f6ce This patch is another step in the direction of adding vector select. In this
patch we add a flag to enable a new type legalization decision - to promote
integer elements in vectors. Currently, the rest of the codegen does not support
this kind of legalization.  This flag will be removed when the transition is
complete.

llvm-svn: 132394
2011-06-01 12:51:46 +00:00
Stuart Hastings
fdc9e4af68 FGETSIGN support for x86, using movmskps/pd. Will be enabled with a
patch to TargetLowering.cpp.  rdar://problem/5660695

llvm-svn: 132388
2011-06-01 04:39:42 +00:00
Andrew Trick
fa54b35483 Add an issue width check to the postRA scheduler. Patch by Max Kazakov!
For targets with no itinerary (x86) it is a nop by default. For
targets with issue width already expressed in the itinerary (ARM) it
bypasses a scoreboard check but otherwise does not affect the
schedule. It does make the code more consistent and complete and
allows new targets to specify their issue width in an arbitrary way.

llvm-svn: 132385
2011-06-01 03:27:56 +00:00
John McCall
18921da759 First, do no harm -- even if we can't find a selector for an enclosing
landing pad, forward llvm.eh.resume calls to it instead of turning them
invalidly into invokes.

llvm-svn: 132382
2011-06-01 02:17:11 +00:00
Bill Wendling
a03522829c The ARM stuff already calls the Resume function, not the Resume_or_Rethrow. It
turns out that it could cause an infinite loop in some situations. If this code
is triggered and it converts a cleanup into a catchall, but that cleanup was in
already in a cleanup, then the _Unwind_SjLj_Resume could infinite loop. I.e.,
the code doesn't consume the exception object and passes it on to
_Unwind_SjLj_Resume. But _USjLjR expects it to be consumed (since it's landing
at a catchall instead of a cleanup). So it uses the values that are presently
there, which are the values that tell it to jump to the fake landing pad.
<rdar://problem/9508402>

llvm-svn: 132381
2011-06-01 01:49:35 +00:00
Devang Patel
4eab0639a4 Incomplete type may not have corresponding DIE, so do not check DIEEntry eagerly.
llvm-svn: 132377
2011-06-01 00:23:24 +00:00
Devang Patel
4077aa90ed Refactor.
llvm-svn: 132373
2011-05-31 23:30:30 +00:00
Devang Patel
a9f6a46390 Include global types, that are referenced through local variables, in debug_pubtypes list.
llvm-svn: 132371
2011-05-31 22:56:51 +00:00
Andrew Trick
60ad58febd scev: Better sign-extend removal. Normalize postincrement recurrences
so that their sign extended forms are congruent when no overflow occurs.

llvm-svn: 132360
2011-05-31 21:17:47 +00:00
Jakob Stoklund Olesen
a1976f5898 Simplify the eviction policy by making the failsafe explicit.
When assigned ranges are evicted, they are put in the RS_Evicted stage and are
not allowed to evict anything else. That prevents looping automatically.

When evicting ranges just to get a cheaper register, use only spill weights to
find the possible candidates. Avoid breaking hints for this purpose, it is not
worth it.

Start implementing more complex eviction heuristics, guarded by the temporary
-complex-eviction flag. The initial version permits a heavier range to be
evicted if it doesn't have any uses where the evicting range is live. This makes
it a good candidate for live ranfge splitting.

llvm-svn: 132358
2011-05-31 21:02:44 +00:00
Eli Friedman
05fea3b4a2 llvm.memcpy.* has two distinct associated address spaces; the source address space, and the destination address space. Fix up the interface on MemIntrinsic and MemTransferInst to make this clear, and fix InstructionDereferencesPointer in LazyValueInfo.cpp to use the interface properly.
llvm-svn: 132356
2011-05-31 20:40:16 +00:00
Bruno Cardoso Lopes
9231127d37 Fix uninitialized variables and silence warnings
llvm-svn: 132355
2011-05-31 20:25:26 +00:00
Eli Friedman
3c6167ed29 Add a minor missing -verify check. Found by inspection.
llvm-svn: 132353
2011-05-31 20:12:07 +00:00
Stuart Hastings
47cbd200e4 Revert to pacify a buildbot. rdar://problem/6501862
llvm-svn: 132351
2011-05-31 19:56:35 +00:00
Stuart Hastings
e226ec461c Followup to 132316; accept arbitrary constants, add with a constant,
sub with a non-constant.  Fix comments, enlarge test case.
rdar://problem/6501862

llvm-svn: 132348
2011-05-31 19:29:55 +00:00
Richard Osborne
660fe84614 Fix 80 column violations.
llvm-svn: 132341
2011-05-31 16:30:33 +00:00
Richard Osborne
4293c93896 Add XCore intrinsic for crc8.
llvm-svn: 132340
2011-05-31 16:24:49 +00:00
Richard Osborne
34a4652dcd Add XCore intrinsic for crc32.
llvm-svn: 132336
2011-05-31 14:47:36 +00:00
Bruno Cardoso Lopes
0bdb365634 Fix ssat and ssat16 encodings for ARM and Thumb. The bit position value
must be encoded decremented by one. Only add encoding tests for ssat16
because ssat can't be parsed yet.

llvm-svn: 132324
2011-05-31 03:33:27 +00:00
Bruno Cardoso Lopes
728ea362c3 This patch implements atomic intrinsics atomic.load.add (sub,and,or,xor,
nand), atomic.swap and atomic.cmp.swap, all in i8, i16 and i32 versions.
The intrinsics are implemented by creating pseudo-instructions, which are
then expanded in the method MipsTargetLowering::EmitInstrWithCustomInserter.

Patch by Sasa Stankovic.

llvm-svn: 132323
2011-05-31 02:54:07 +00:00
Bruno Cardoso Lopes
f6fa29e7a1 This patch implements the thread local storage. Implemented are General
Dynamic, Initial Exec and Local Exec TLS models.

Patch by Sasa Stankovic

llvm-svn: 132322
2011-05-31 02:53:58 +00:00
Rafael Espindola
33f7d7f9fa Use the dwarf->llvm mapping to print register names in the cfi
directives.

Fixes PR9826.

llvm-svn: 132317
2011-05-30 20:20:15 +00:00
Stuart Hastings
9f37a92c33 (1 - X) * (-2) -> (x - 1) * 2, for all positive nonzero powers of 2
rdar://problem/6501862

llvm-svn: 132316
2011-05-30 20:00:33 +00:00
Rafael Espindola
13607c5e91 Split ppc dwarf regnums into ppc64 and ppc32 flavours.
llvm-svn: 132315
2011-05-30 18:24:44 +00:00
Rafael Espindola
5917c1f6ec Introduce the DwarfRegAlias class for declaring that two registers have the
same dwarf number. This will be used for creating a dwarf number to register
mapping.

The only case that needs this so far is the XMM/YMM registers that unfortunately
do have the same numbers.

llvm-svn: 132314
2011-05-30 17:49:59 +00:00
Rafael Espindola
00ba4a56e0 Mark the 32 bit registers as invalid in 64 bit mode. In 64 bit mode they are
subregisters of the 64 bit ones.

llvm-svn: 132313
2011-05-30 16:04:54 +00:00
Rafael Espindola
33338e912b Remove the DwarfNumbers from the subregisters. They should use DW_OP_bit_piece
and for now the generic dwarf emission will automatically use the superregister
numbers.

llvm-svn: 132312
2011-05-30 15:56:04 +00:00
Jakob Stoklund Olesen
1c8d54ed9f Reapply r132245 with a fix for the bug that broke the darwin9/i386 build.
llvm-svn: 132309
2011-05-30 01:33:26 +00:00
Charles Davis
52d44a8a21 Emit the handler's data area. For GCC-style exceptions under Win64, the
handler's data area starts with a 4-byte reference to the personality
function, followed by the DWARF LSDA.

llvm-svn: 132302
2011-05-30 00:13:34 +00:00
Jakob Stoklund Olesen
939fb6f738 Revert r132245, "Create two BlockInfo entries when a live range is discontinuous through a block."
This commit seems to have broken a darwin 9 tester.

llvm-svn: 132299
2011-05-29 21:24:39 +00:00
Jakob Stoklund Olesen
49bf4dd965 Fix PR10046 by updating LiveVariables kill info when splitting live ranges.
This only affects targets like Mips where branch instructions may kill virtual
registers. Most other targets branch on flag values, so virtual registers are
not involved.

The problem is that MachineBasicBlock::updateTerminator deletes branches and
inserts new ones while LiveVariables keeps a list of pointers to instructions
that kill virtual registers. That list wasn't properly updated in
MBB::SplitCriticalEdge.

llvm-svn: 132298
2011-05-29 20:10:28 +00:00
John McCall
64ff21faa7 On Darwin ARM, set the UNWIND_RESUME libcall to _Unwind_SjLj_Resume.
This is important for the correct lowering of unwind instructions
(which doesn't matter at all) and llvm.eh.resume calls (which does).

Take 2, now with more basic competence.

llvm-svn: 132295
2011-05-29 19:50:32 +00:00
John McCall
645e5b19b7 ...this is not a good commit day for me.
llvm-svn: 132294
2011-05-29 19:44:55 +00:00
John McCall
ffdb2d5e70 I didn't mean to commit these residues of a personal project.
llvm-svn: 132293
2011-05-29 19:41:56 +00:00
John McCall
46c7b963b2 On Darwin ARM, set the UNWIND_RESUME libcall to _Unwind_SjLj_Resume.
This is important for the correct lowering of unwind instructions
(which doesn't matter at all) and llvm.eh.resume calls (which does).

llvm-svn: 132291
2011-05-29 19:39:04 +00:00
Nick Lewycky
58d87d5490 Don't crash owhen ComputeLoadResult can't compute the result of the load.
llvm-svn: 132290
2011-05-29 19:33:36 +00:00
Nick Lewycky
07ed4434b8 Obey the isVolatile bit on memory intrinsics when analyzing uses of a global
variable. Noticed by inspection.

Simulate memset in EvaluateFunction where the target of the memset and the
value we're setting are both the null value. Fixes PR10047!

llvm-svn: 132288
2011-05-29 18:41:56 +00:00
Nadav Rotem
77b328bd14 Fix warnings due to 132263; Thanks rdivacky.
llvm-svn: 132285
2011-05-29 08:10:47 +00:00
Charles Davis
850e4b68b1 When generating against the Win64 EH scheme, set the handler to the GCC-specific
handler.

At this moment, only GCC-style exceptions are supported. Other kinds
of exceptions, including "traditional" SEH and Microsoft Visual C++ exceptions,
need more work--and an compiler exception model that isn't specific to
GCC-style exceptions!

In particular, I imagine that it would be possible to mix "traditional" SEH
with GCC-style EH or Microsoft C++ EH. Currently LLVM has no way (beyond some
target-specific defaults and whole-module compiler switches) of knowing which
scheme to use when.

llvm-svn: 132283
2011-05-29 04:28:35 +00:00
Rafael Espindola
bfde930279 Fix to match the dwarf register numbers that gdb uses.
llvm-svn: 132278
2011-05-29 03:58:16 +00:00
Rafael Espindola
06c8318a60 Dwarf register 0 is r0, remove incorrect entries.
llvm-svn: 132276
2011-05-29 03:17:01 +00:00
John McCall
233946583f Fix this to work correctly with phis; test case to follow if this successfully
fixes self-host.

llvm-svn: 132275
2011-05-29 03:01:09 +00:00
Rafael Espindola
51a8fe13bc Remove the dwarf numbers from the D registers. They don't have dwarf numbers
and should probably be encoded as

DW_OP_reg 32 DW_OP_piece 4 DW_OP_reg 33

llvm-svn: 132274
2011-05-29 02:21:01 +00:00
Cameron Zwarich
72e034c331 Fix ARM fast isel to correctly flag memory operands to stores. This fixes
-verify-machineinstrs failures on several tests.

llvm-svn: 132268
2011-05-28 20:34:49 +00:00
Nadav Rotem
63c8747adf Refactor the type legalizer. Switch TargetLowering to a new enum - LegalizeTypeAction.
This patch does not change the behavior of the type legalizer. The codegen
produces the same code.
This infrastructural change is needed in order to enable complex decisions
for vector types (needed by the vector-select patch).

llvm-svn: 132263
2011-05-28 17:57:14 +00:00
Benjamin Kramer
ffcbcb72ef Erase instructions _after_ checking their type.
llvm-svn: 132256
2011-05-28 11:48:37 +00:00
Benjamin Kramer
129192d295 ConstantFoldInstOperands doesn't like compares, hand it off to instsimplify instead.
Fixes PR10040.

llvm-svn: 132254
2011-05-28 10:16:58 +00:00
John McCall
119a0222f5 Implement and document the llvm.eh.resume intrinsic, which is
transformed by the inliner into a branch to the enclosing landing pad
(when inlined through an invoke).  If not so optimized, it is lowered
DWARF EH preparation into a call to _Unwind_Resume (or _Unwind_SjLj_Resume
as appropriate).  Its chief advantage is that it takes both the
exception value and the selector value as arguments, meaning that there
is zero effort in recovering these;  however, the frontend is required
to pass these down, which is not actually particularly difficult.

Also document the behavior of landing pads a bit better, and make it
clearer that it's okay that personality functions don't always land at
landing pads.  This is just a fact of life.  Don't write optimizations that
rely on pushing things over an unwind edge.

llvm-svn: 132253
2011-05-28 07:45:59 +00:00
Charles Davis
6702c786ed When generating code for Win64 EH, emit StartProc and EndProc directives.
llvm-svn: 132250
2011-05-28 04:21:04 +00:00
Bruno Cardoso Lopes
6d5e369a10 Add support for ARM ldrexd/strexd intrinsics. They both use i32 register pairs
to load/store i64 values. Since there's no current support to explicitly
declare such restrictions, implement it by using specific hardcoded register
pairs during isel.

llvm-svn: 132248
2011-05-28 04:07:29 +00:00
Eric Christopher
a2fa6edef9 This actually starts at offset 0, not 1.
llvm-svn: 132246
2011-05-28 03:16:22 +00:00
Jakob Stoklund Olesen
56bd697f79 Create two BlockInfo entries when a live range is discontinuous through a block.
Delete the Kill and Def markers in BlockInfo. They are no longer
necessary when BlockInfo describes a continuous live range.

This only affects the relatively rare kind of basic block where a live
range looks like this:

 |---x   o---|

Now live range splitting can pretend that it is looking at two blocks:

 |---x
         o---|

This allows the code to be simplified a bit.

llvm-svn: 132245
2011-05-28 02:33:00 +00:00
Jakob Stoklund Olesen
394d198d2e Add SplitAnalysis::getNumLiveBlocks().
It is important that this function returns the same number of live blocks as
countLiveBlocks(CurLI) because live range splitting uses the number of live
blocks to ensure it is making progress.

This is in preparation of supporting duplicate UseBlock entries for basic blocks
that have a virtual register live-in and live-out, but not live-though.

llvm-svn: 132244
2011-05-28 02:32:57 +00:00
Akira Hatanaka
45b3f52c41 Change the set of callee-saved registers for non-MIPS32 architectures specified
in MipsRegisterInfo::getCalleeSavedRegs so that both registers paired for a
double precision register get saved.

 

llvm-svn: 132243
2011-05-28 01:41:05 +00:00
Eric Christopher
000dd7d0e6 Implement the 'M' output modifier for arm inline asm. This is fairly
register allocation dependent and will occasionally break. WIP in the
register allocator to model paired/etc registers.

rdar://9119939

llvm-svn: 132242
2011-05-28 01:40:44 +00:00
Akira Hatanaka
1590e4eab1 Define a wrapper node for target constant nodes (tglobaladdr, etc.).
Need this to prevent emitting illegal conditional move instructions. 

llvm-svn: 132240
2011-05-28 01:07:07 +00:00
Devang Patel
93e78e996f Select DW_AT_const_value size based on global variable size.
llvm-svn: 132239
2011-05-28 00:39:18 +00:00
Rafael Espindola
707fa44bc0 Add 132187 back now that the real problem is fixed.
llvm-svn: 132238
2011-05-28 00:24:37 +00:00
Rafael Espindola
386c4259db Fix the root cause of the bootstrap failure:
There was no way to check if a given register/mode pair was valid. We now return
an error code (-2) instead of asserting. If anyone thinks that an assert
at this point  is really needed, we can autogen a hasValidDwarfRegNum instead.

llvm-svn: 132236
2011-05-28 00:13:01 +00:00
Cameron Zwarich
cd3c1b5829 Fix the remaining atomic intrinsics to use the right register classes on Thumb2,
and add some basic tests for them.

llvm-svn: 132235
2011-05-27 23:54:00 +00:00
Charles Davis
cf8d922dbe Stub out support for Win64-style exceptions. Note that this is merely using
the Win64 EH mechanism to implement GCC-style exceptions. LLVM supports
hardly anything else at this point!

llvm-svn: 132234
2011-05-27 23:47:32 +00:00
Bruno Cardoso Lopes
93eae0fd19 ARM asm parser wasn't able to parse a "mov" instruction while in Thumb
mode (only the "mov.w" variant). Now, when parsing "mov" in thumb mode,
default to the Thumb 1 versions/encodings.

llvm-svn: 132233
2011-05-27 23:46:09 +00:00
Rafael Espindola
8ed6285c8d It looks like 132187 might have broken the llvm-gcc bootstrap. Revert while I check.
llvm-svn: 132230
2011-05-27 23:36:02 +00:00
Cameron Zwarich
ded03d4e24 Add a GR32_NOREX_NOSP register class and fix a bug where getMatchingSuperRegClass()
was saying that the matching superregister class of GR32_NOREX in GR64_NOREX_NOSP
is GR64_NOREX, which drops the NOSP constraint. This fixes PR10032.

llvm-svn: 132225
2011-05-27 22:26:04 +00:00
Rafael Espindola
9ce5cebde6 Fix a regression I recently introduced by removing DwarfRegNum of
subregisters:

When a value is in a subregister, at least report the location as being
the superregister. We should extend the .td files to encode the bit
range so that we can produce a DW_OP_bit_piece.

llvm-svn: 132224
2011-05-27 22:15:01 +00:00
Rafael Espindola
2230168a0f Make size computation less brittle.
llvm-svn: 132222
2011-05-27 22:05:41 +00:00
Charles Davis
cb20ea9935 Add the suffix to the Win64 EH data sections' names if given. Add a test for
this. XFAIL'd, because the COFF AsmParser can't handle .section yet.

llvm-svn: 132220
2011-05-27 21:38:47 +00:00
Nadav Rotem
531aa71d22 Refactor getActionType and getTypeToTransformTo ; place all of the 'decision'
code in one place. Re-apply 131534 and fix the multi-step promotion of integers.

llvm-svn: 132217
2011-05-27 21:03:13 +00:00
Eli Friedman
fe707571fc Attempt to preserve debug line info in LICM; as the comment in the code says, it's hard to pick good line numbers for this transformation, but something is better than nothing.
rdar://9143729

llvm-svn: 132215
2011-05-27 20:31:51 +00:00
Evan Cheng
0fcb465bab Don't use movw / movt for iOS static codegen for now to workaround some tools issues. rdar://9514789
llvm-svn: 132211
2011-05-27 20:11:27 +00:00
Chad Rosier
f2b2b472cc CRC32 intrinsics were renamed at revision 132163. This submission
fixes aliasing issues with the old and new names as well as adds test
cases for the auto-upgrader.
Fixes rdar 9472944.

llvm-svn: 132207
2011-05-27 19:38:10 +00:00
Devang Patel
2872ac051d Keep this simple. Use DIType to get signness and size of a type. Based on size, select appropraite form.
llvm-svn: 132206
2011-05-27 19:13:26 +00:00
Charles Davis
f835c87c83 Add a parameter to the Win64 EH section getters to get a section with a
suffix (e.g. .xdata$myfunc). The suffix part isn't implemented yet, but
I'll get to it in the next patch.

Fix up all callers of the affected functions. Make them pass said suffix to
the function.

llvm-svn: 132205
2011-05-27 19:09:24 +00:00
Dan Gohman
20949164a3 Update this comment.
llvm-svn: 132202
2011-05-27 18:42:33 +00:00
Eli Friedman
1062ba1e1f Don't sink or hoist debug info instrinsics; it isn't useful. This also prevents LICM sinking from erasing debug intrinsics which don't dominate any exit block of the loop.
rdar://9143943 .

llvm-svn: 132201
2011-05-27 18:37:52 +00:00
John McCall
2f479c4d42 Fix the inliner to maintain the current de facto invoke semantics:
- the selector for the landing pad must provide all available information
    about the handlers, filters, and cleanups within that landing pad
  - calls to _Unwind_Resume must be converted to branches to the enclosing
    lpad so as to avoid re-entering the unwinder when the lpad claimed it
    was going to handle the exception in some way
This is quite specific to libUnwind-based unwinding.  In an effort to not
interfere too badly with other unwinders, and with existing hacks in frontends,
this only triggers on _Unwind_Resume (not _Unwind_Resume_or_Rethrow) and does
nothing with selectors if it cannot find a selector call for either lpad.

llvm-svn: 132200
2011-05-27 18:34:38 +00:00
Jakob Stoklund Olesen
021b1ff0c7 Delete MethodBodies that only filtered reserved registers.
The register allocators know to filter reserved registers from the allocation
orders, so we don't need all of this boilerplate.

llvm-svn: 132199
2011-05-27 18:27:13 +00:00
Devang Patel
c0bffe6366 Handle signed types gracefully.
This fixes regressions reported by buildbots as a fallout of r132193.

llvm-svn: 132197
2011-05-27 18:15:52 +00:00
Eli Friedman
17000790d8 Oops, wasn't intending to commit this. Partial revert of r132194.
llvm-svn: 132195
2011-05-27 18:04:04 +00:00
Eli Friedman
560532051b Fix a silly mistake (which trips over an assertion) in r132099. rdar://9515076
llvm-svn: 132194
2011-05-27 18:02:04 +00:00
Devang Patel
62a7038a9f Select DW_AT_const_value size based on variable size.
llvm-svn: 132193
2011-05-27 16:45:18 +00:00
Rafael Espindola
c74e8fda1f Remove DwarfRegNum from the individual bits of the condition register.
These should be DW_OP_bit_piece of CR (64).

llvm-svn: 132192
2011-05-27 16:15:27 +00:00
Rafael Espindola
a275f4cfc7 Remove DwarfRegNum from CARRY. I should be encoded with DW_OP_bit_piece.
llvm-svn: 132190
2011-05-27 16:01:08 +00:00
Charles Davis
01cde4d080 Assorted fixes for Win64 EH unwind info emission:
- Flip order of bitfields. This gets our output matching GAS.
- Handle case where the end of the prolog wasn't specified.
- If the resulting unwind info struct is less than 8 bytes, pad to 8 bytes.

Add a test for the latter two.

llvm-svn: 132188
2011-05-27 15:10:25 +00:00
Rafael Espindola
7e68d3bf57 Remove dwarf numbers from subregs. We should use DW_OP_bit_piece to
refer to them.

I tested this with both check-all and the gdb testsuite.

llvm-svn: 132187
2011-05-27 15:08:24 +00:00
Benjamin Kramer
5b491b9d0e InstCombine: Make switch folding with equality compares more aggressive by trying instsimplify on the arm where we know the compared value.
Stuff like "x == y ? y : x&y" now folds into "x&y".

llvm-svn: 132185
2011-05-27 13:00:16 +00:00
Cameron Zwarich
a9c418b1c3 Fix PR10029 - VerifyCoalescing failure on patterns_dfa.c of 445.gobmk.
llvm-svn: 132181
2011-05-27 05:04:51 +00:00
Eric Christopher
0e12efbed1 Make the branch encoding for tBcc more obvious that it's a 4-byte opcode
followed by a conditional and imm8.

llvm-svn: 132179
2011-05-27 03:50:53 +00:00
Eric Christopher
cfce589451 Fix comment.
llvm-svn: 132178
2011-05-27 03:46:51 +00:00
Charles Davis
5ebea6fc5f Start keeping track of where the various unwind instructions are in the prolog.
Use them to calculate the offset inside the prolog. Emit this value when
emitting the unwind codes.

llvm-svn: 132177
2011-05-27 03:25:01 +00:00
Charles Davis
f64d56f9e2 Add missing break statements. Align UNWIND_INFO and RUNTIME_FUNCTION structs
to 4 bytes.

I'm surprised no one caught the missing break statements.

llvm-svn: 132176
2011-05-27 02:43:19 +00:00
Charles Davis
823e8a90ce My attempt at fixing the leak reported by the valgrind buildbots. Valgrind will
still report leaks, but they're spurious now. Valgrind cannot peer into
std::vector objects--or any dynamic array, for that matter--because it doesn't
know how big the array is.

llvm-svn: 132174
2011-05-27 02:01:08 +00:00
Charles Davis
32b363ded1 Fix inverted conditional in SaveReg and SaveXMM. Err when the frame pointer is
already defined, and err when the PushMachFrame operation isn't the first
operation (if specified at all).

llvm-svn: 132173
2011-05-27 01:42:17 +00:00
Eli Friedman
d619bcd565 One more debug line number miss in instcombine (although the code in question isn't actually in instcombine).
llvm-svn: 132170
2011-05-27 01:00:36 +00:00
Eli Friedman
6937c422a0 Final step of instcombine debuginfo; switch a couple more places over to InsertNewInstWith, and use setDebugLoc for the cases which can't be easily handled by the automated mechanisms.
llvm-svn: 132167
2011-05-27 00:19:40 +00:00
Chandler Carruth
6a41ac0d30 Fix warning about || and && without explicit grouping.
This looks like it flagged an actual bug. Devang, please review. I added
the parentheses that change behavior, but make the behavior more closely
match commit log's intent.

llvm-svn: 132165
2011-05-26 23:37:58 +00:00
Devang Patel
5e3f883ddf Do not insert anything after terminator.
llvm-svn: 132164
2011-05-26 23:16:48 +00:00
Chad Rosier
b87c4a6945 Renamed llvm.x86.sse42.crc32 intrinsics; crc64 doesn't exist.
crc32.[8|16|32] have been renamed to .crc32.32.[8|16|32] and
crc64.[8|16|32] have been renamed to .crc32.64.[8|64].

llvm-svn: 132163
2011-05-26 23:13:19 +00:00
Devang Patel
c67e8c5d45 Do not move DBG_VALUE in middle of PHI nodes.
llvm-svn: 132161
2011-05-26 22:43:14 +00:00
Devang Patel
52e803e053 If llvm.dbg.value and the value instruction it refers to are far apart then iSel may not be able to find corresponding Node for llvm.dbg.value during DAG construction. Make iSel's life easier by removing this distance between llvm.dbg.value and its value instruction.
llvm-svn: 132151
2011-05-26 21:51:06 +00:00
Devang Patel
177dbe2de1 Add comment.
llvm-svn: 132149
2011-05-26 21:49:28 +00:00
Devang Patel
e0b7ab9296 During branch folding avoid inserting redundant DBG_VALUE machine instructions.
llvm-svn: 132148
2011-05-26 21:47:59 +00:00
Akira Hatanaka
71839b355d Use MachineFrameInfo::hasCalls instead of MipsFunctionInfo::hasCall to check if
a function has any function calls.

llvm-svn: 132140
2011-05-26 20:30:31 +00:00
Rafael Espindola
a77d692299 Fix some dwarf register numbers.
llvm-svn: 132136
2011-05-26 19:25:47 +00:00
Rafael Espindola
0395db684a Fix LTO builds with xcode 4.
llvm-svn: 132132
2011-05-26 18:59:54 +00:00
Akira Hatanaka
5bfbea9ef2 Add support for C++ exception handling.
llvm-svn: 132131
2011-05-26 18:59:03 +00:00
Eric Christopher
4fc5b88850 Reorganize these slightly according to operand type.
llvm-svn: 132128
2011-05-26 18:22:26 +00:00
Akira Hatanaka
5a8bd76f99 Set HasSetDirective to true.
llvm-svn: 132127
2011-05-26 18:16:18 +00:00
Charles Davis
4becdc727e Revert r132111. I built Release (without Asserts), so I didn't know about the
assert that prevented setting alignment on section creation.

llvm-svn: 132113
2011-05-26 05:35:55 +00:00
Charles Davis
44fb280873 Align Win64 EH Table sections to 4 bytes.
llvm-svn: 132111
2011-05-26 05:19:54 +00:00
Stuart Hastings
837a958ff6 Reverting 132105: it broke some LLVM-GCC DejaGNU tests.
llvm-svn: 132108
2011-05-26 04:09:49 +00:00
Cameron Zwarich
9c871755b6 Mark tBX as an indirect branch rather than a return.
llvm-svn: 132107
2011-05-26 03:41:12 +00:00
Charles Davis
0021487a8e Test .seh_startchained and .seh_endchained parsing.
Rework how the MCWin64EHUnwindInfo instances are stored. Fix issues with
chained unwind areas exposed by the test that were related to this.

The ChainedParent field had the wrong address, because when the chained unwind
info was added, the addresses shifted around. Now we store the pointers to the
structures, which are now allocated from the MC heap.

llvm-svn: 132106
2011-05-26 02:45:47 +00:00
Stuart Hastings
e704bfb21e Correctly handle a one-word struct passed byval on x86_64.
rdar://problem/6920088

llvm-svn: 132105
2011-05-26 02:44:56 +00:00
Andrew Trick
0577c5768b indvars: incremental fixes for -disable-iv-rewrite and testcases.
Use a proper worklist for use-def traversal without holding onto an
iterator. Now that we process all IV uses, we need complete logic for
resusing existing derived IV defs. See HoistStep.

llvm-svn: 132103
2011-05-26 00:46:11 +00:00
Jakob Stoklund Olesen
6c654330dc Add a RAGreedy::canEvict function.
This doesn't change functionality (much), but it allows for a more fine-grained
eviction policy. The current policy only compares spill weights, and that is not
always the best thing to do.  Spill weights are designed to serve linear scan,
and they don't consider live range splitting.

Add a mechanism so canEvict() can request that a live range be evicted and
split/spilled. This is to avoid infinite eviction loops.

llvm-svn: 132101
2011-05-25 23:58:36 +00:00
Eli Friedman
93ffb875ad Rewrite fast-isel integer cast handling to handle more cases, and to be simpler and more consistent.
The practical effects here are that x86-64 fast-isel can now handle trunc from i8 to i1, and ARM fast-isel can handle many more constructs involving integers narrower than 32 bits (including loads, stores, and many integer casts).

rdar://9437928 .

llvm-svn: 132099
2011-05-25 23:49:02 +00:00
Akira Hatanaka
3f49cbeb37 Define WeakRefDirective.
llvm-svn: 132098
2011-05-25 23:30:30 +00:00
Eli Friedman
5cd755549b PR9998: ashr exact %x, 31 is not equivalent to sdiv exact %x, -2147483648.
llvm-svn: 132097
2011-05-25 23:26:20 +00:00
Devang Patel
7e814e1e36 Remove unused statistical counter.
llvm-svn: 132087
2011-05-25 21:55:40 +00:00
Cameron Zwarich
9c19995747 Convert tBX_CALL / tBXr9_CALL to actual pseudoinstructions.
llvm-svn: 132086
2011-05-25 21:53:50 +00:00
Charles Davis
ede0f07dae Add tests for .seh_setframe and .seh_handlerdata parsing. Fix issues with
them.

I had to add a special SwitchSectionNoChange method to MCStreamer just for
.seh_handlerdata. If this isn't OK, please let me know, and I'll find some
other way to fix .seh_handlerdata streaming.

llvm-svn: 132084
2011-05-25 21:43:45 +00:00
Eric Christopher
e02bd15dbc Clean up comment a bit.
llvm-svn: 132083
2011-05-25 21:19:19 +00:00
Eric Christopher
807da21e47 Implement the 'm' modifier. Note that it only works for memory operands.
Part of rdar://9119939

llvm-svn: 132081
2011-05-25 20:51:58 +00:00
Akira Hatanaka
4806508364 Remove MipsTargetLowering::LowerFP_TO_SINT. Patterns for fp_to_sint have already
been defined in MipsInstrFPU.td.

llvm-svn: 132076
2011-05-25 20:08:05 +00:00
Akira Hatanaka
32b5043265 Custom-lower FCOPYSIGN nodes.
llvm-svn: 132074
2011-05-25 19:32:07 +00:00
Eli Friedman
2bdd096540 Prepare ARMFastISel::SelectSIToFP for getRegForValue returning registers for i8 and i16 values.
llvm-svn: 132073
2011-05-25 19:09:45 +00:00
Evan Cheng
335fcad6bc Simplify r132022 based on Cameron's feedback.
llvm-svn: 132071
2011-05-25 18:17:13 +00:00
Akira Hatanaka
ae2e2d557a Update MaxCallFrameSize regardless of the relocation model selected.
llvm-svn: 132070
2011-05-25 18:08:32 +00:00
Akira Hatanaka
953e0a3c45 Change initial value of MaxCallFrameSize. MipsFI::getMaxCallFrameSize() should
return 0 if there are no function calls made. 

llvm-svn: 132065
2011-05-25 17:52:48 +00:00
Akira Hatanaka
33415b8179 Coding style fixes. Added comments.
llvm-svn: 132063
2011-05-25 17:32:06 +00:00
Francois Pichet
b2042fbfe2 Remove unused OpcodeMask enumerator.
llvm-svn: 132062
2011-05-25 17:02:53 +00:00
Francois Pichet
fab3c58733 Fix MSVC warning: "is out of range for enum constant"
MSVC doesn't support 64 bit enum. 
OpcodeMask is not used anywhere in the code base.

llvm-svn: 132057
2011-05-25 15:58:10 +00:00
Charles Davis
6b67ee5130 Add tests for .seh_savereg and .seh_savexmm parsing. Once again, fix the
buggy methods that parse these directives.

llvm-svn: 132045
2011-05-25 04:51:25 +00:00
Cameron Zwarich
5c410bd5f6 Restore an accidentally removed comment.
llvm-svn: 132044
2011-05-25 04:48:17 +00:00
Cameron Zwarich
4f47b296d8 Move some code to a more logical place.
llvm-svn: 132043
2011-05-25 04:45:29 +00:00
Cameron Zwarich
beae5f20e8 Make tTAILJMPr/tTAILJMPrND emit a tBX without a preceding MOV of PC to LR. This
fixes <rdar://problem/9495913>

llvm-svn: 132042
2011-05-25 04:45:27 +00:00
Cameron Zwarich
5a32e53e3f Change the order of tBX's operands so that the predicate operands come after the
target register, matching BX. I filed this bug because I was confused at first:

PR10007 - ARM branch instructions have inconsistent predicate operand placement
<http://llvm.org/bugs/show_bug.cgi?id=10007>

llvm-svn: 132041
2011-05-25 04:45:23 +00:00
Cameron Zwarich
08753a605b Rename tBX_Rm to tBX.
llvm-svn: 132040
2011-05-25 04:45:20 +00:00
Cameron Zwarich
d9707488bb Rename the existing tBX/tBXr9 instructions to tBX_CALL/tBXr9_CALL to better
reflect their actual meaning and match the ARM instructions.

llvm-svn: 132039
2011-05-25 04:45:14 +00:00
Andrew Trick
0aa40b2f8f indvars: fixed IV cloning in -disable-iv-rewrite mode with associated
cleanup and overdue test cases.

llvm-svn: 132038
2011-05-25 04:42:22 +00:00
Charles Davis
14a32a9608 Add a test for .seh_pushframe parsing. Fix the bug exposed by it (and another
one I found by inspection).

llvm-svn: 132037
2011-05-25 04:08:15 +00:00
Rafael Espindola
70213c7c5f Replace the -unwind-tables option with a per function flag. This is more
LTO friendly as we can now correctly merge files compiled with or without
-fasynchronous-unwind-tables.

llvm-svn: 132033
2011-05-25 03:44:17 +00:00
Akira Hatanaka
a5b11ee449 Fix lowering of DYNAMIC_STACKALLOC nodes.
llvm-svn: 132030
2011-05-25 02:20:00 +00:00
Charles Davis
967ee6a30b Add a test for the .seh_handler directive. Fix problems with the parsing
method exposed by the test. While we're at it, simplify the .seh_proc
parsing method.

llvm-svn: 132028
2011-05-25 01:33:42 +00:00
Bruno Cardoso Lopes
3a4aae57f4 Fix PR9762
Enable the parsing of the operand "cpsr_all" for the ARM msr instruction

llvm-svn: 132026
2011-05-25 00:35:03 +00:00
Evan Cheng
d359a7cab3 Forgot dyn_cast check.
llvm-svn: 132025
2011-05-24 23:47:50 +00:00
Eric Christopher
4f193f9555 Implement the arm 'L' asm modifier.
Part of rdar://9119939

llvm-svn: 132024
2011-05-24 23:27:13 +00:00
Eric Christopher
a6d7ccb170 Implement the immediate part of the 'B' modifier.
Part of rdar://9119939

llvm-svn: 132023
2011-05-24 23:15:43 +00:00
Evan Cheng
9466b36c02 Fix LoopUnswitch bug. RewriteLoopBodyWithConditionConstant can delete a dead
case of a switch instruction. Back off this optimization when this would
eliminate all of the predecessors to the latch.

Sorry, I am unable to reduce a reasonably sized test case.

rdar://9486843

llvm-svn: 132022
2011-05-24 23:12:57 +00:00
Eric Christopher
4783e5e316 Add more unimplemented asm modifiers and some documentation of what they
do.

Part of rdar://9119939.

llvm-svn: 132015
2011-05-24 22:27:43 +00:00
Eric Christopher
03965fa3b6 Add support for the arm 'y' asm modifier.
Fixes part of rdar://9444657

llvm-svn: 132011
2011-05-24 22:10:34 +00:00
Charles Davis
d943eb05ed Test basic SEH directive-parsing functionality. Fix a latent bug exposed by
this test.

llvm-svn: 132004
2011-05-24 21:22:53 +00:00
Akira Hatanaka
161f211628 Enable printing of immediates that do not fit in 16-bit. .cprestore can have
offsets that are larger than 0x10000.

llvm-svn: 132003
2011-05-24 21:22:21 +00:00
Eli Friedman
654dd382bc Change condition for determining whether a function is small for inlining metrics so that very long functions
with few basic blocks are not re-analyzed.

llvm-svn: 131994
2011-05-24 20:22:24 +00:00
Charles Davis
1084ac5bb1 Implement the rest of the SEH directive-parsing methods in the COFFAsmParser.
Add a size alignment check to the .seh_stackalloc directive parser. Add a
more descriptive error message to the .seh_handler directive parser.

Add methods to the TargetAsmInfo struct in support of all this.

llvm-svn: 131992
2011-05-24 20:06:30 +00:00
Akira Hatanaka
f4c853e3e4 Implement byval structure argument passing. The following limitations or
deficiencies exist:

- Works only if ABI is o32.
- Zero-sized structures cannot be passed.
- There is a lot of redundancy in generated code.

llvm-svn: 131986
2011-05-24 19:18:33 +00:00
Eli Friedman
5ae1b40f55 Make instcombine O(N) instead of O(N^2) in code where the same simplifiable constant is used many times.
Part of rdar://9471075.

llvm-svn: 131979
2011-05-24 18:52:07 +00:00
Devang Patel
0b44360610 Remove dead code.
llvm-svn: 131974
2011-05-24 18:27:52 +00:00
Dan Gohman
5b2ad67709 Make DecomposeGEPExpression check SimplifyInstruction only
after checking for a GEP, so that it matches what GetUnderlyingObject
does. This fixes an obscure bug turned up by bugpoint in the testcase
for PR9931.

llvm-svn: 131971
2011-05-24 18:24:08 +00:00
Charles Davis
3ac82d9bb2 Add a method to TargetRegisterInfo to get the register number that the Win64 EH
scheme uses internally. Implement it for x86 (the only architecture that LLVM
supports for which this matters right now).

llvm-svn: 131969
2011-05-24 16:57:53 +00:00
Cameron Zwarich
e425894eaf Clean up the lazy initialization of DIBuilder a bit.
llvm-svn: 131956
2011-05-24 06:00:08 +00:00
Cameron Zwarich
462b5db500 Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values when
promoting allocas to SSA variables. Fixes <rdar://problem/9479036>.

llvm-svn: 131953
2011-05-24 03:10:43 +00:00
Rafael Espindola
8e44a53856 Explain FIXME.
llvm-svn: 131952
2011-05-24 03:10:31 +00:00
Rafael Espindola
176fe6a0e0 Fix the defaults for .eh_frame. We were marking it as writable.
llvm-svn: 131951
2011-05-24 02:50:20 +00:00
Evan Cheng
b5950697e8 - Teach SelectionDAG::isKnownNeverZero to return true (op x, c) when c is
non-zero.
- Teach X86 cmov optimization to eliminate the cmov from ctlz, cttz extension
  when the source of X86ISD::BSR / X86ISD::BSF is proven to be non-zero.

rdar://9490949

llvm-svn: 131948
2011-05-24 01:48:22 +00:00
Akira Hatanaka
d0694fb652 Simplify offset calculation of stack frame objects for $gp restore location and
variable arguments in LowerCall and LowerFormalArguments. This should also fix
the bug in which handling of variable arguments is incorrect when the front-end
optimizes away unused fixed arguments.

llvm-svn: 131942
2011-05-24 00:23:52 +00:00
Devang Patel
5bce258c3d Fix debug info for blocks' variable.
llvm-svn: 131940
2011-05-24 00:22:25 +00:00
Devang Patel
8a90970a54 Remove unnecessary comment.
llvm-svn: 131936
2011-05-23 23:16:14 +00:00
Akira Hatanaka
e2e584df0e Expand f64 FPOW.
llvm-svn: 131928
2011-05-23 22:23:58 +00:00
Akira Hatanaka
5b696387f7 Add pattern for double-to-integer conversion. Patch by Sasa Stankovic.
llvm-svn: 131927
2011-05-23 22:16:43 +00:00
Devang Patel
e829168e05 Revert 121907 (it causes llc crash) and apply original patch from PR9817.
llvm-svn: 131926
2011-05-23 22:04:42 +00:00
Akira Hatanaka
daa4afec69 Fixes related to coding style.
llvm-svn: 131922
2011-05-23 21:13:59 +00:00
Dan Gohman
e6a4a2aa6f When checking for signed multiplication overflow, watch out for INT_MIN and -1.
This fixes PR9845.

llvm-svn: 131919
2011-05-23 21:07:39 +00:00
Jim Grosbach
76f8f3d479 Propagate error correctly in the MC Asm parser for leading '$' expressions.
llvm-svn: 131918
2011-05-23 20:36:04 +00:00
Akira Hatanaka
123ee4388c Fix MipsAsmPrinter::printSavedRegsBitmaskChange. Remove functions and variables
in MipsFunctionInfo that are no longer used.

llvm-svn: 131917
2011-05-23 20:34:30 +00:00
Chris Lattner
f58c2c02b5 clarify this, apparently it is confusing :)
llvm-svn: 131916
2011-05-23 20:17:44 +00:00
Akira Hatanaka
6ddbe02441 Change StackDirection from StackGrowsUp to StackGrowsDown.
The following improvements are accomplished as a result of applying this patch:
- Fixed frame objects' offsets (relative to either the virtual frame pointer or
  the stack pointer) are set before instruction selection is completed. There is
  no need to wait until Prologue/Epilogue Insertion is run to set them.
- Calculation of final offsets of fixed frame objects is straightforward. It is
  no longer necessary to assign negative offsets to fixed objects for incoming
  arguments in order to distinguish them from the others.
- Since a fixed object has its relative offset set during instruction
  selection, there is no need to conservatively set its alignment to 4.
- It is no longer necessary to reorder non-fixed frame objects in 
  MipsFrameLowering::adjustMipsStackFrame.

llvm-svn: 131915
2011-05-23 20:16:59 +00:00
Devang Patel
37ab34a49f Preserve debug info during iSel by keeping DanglingDebugInfoMap live until end of function.
Patch by Micah Villmow

llvm-svn: 131908
2011-05-23 17:44:13 +00:00
Devang Patel
5920de5c8c While replacing all uses of a SDValue with another value, do not forget to transfer SDDbgValue.
llvm-svn: 131907
2011-05-23 17:35:08 +00:00
Devang Patel
791327d23b Clear list of instructions without DebugLoc.
llvm-svn: 131906
2011-05-23 17:34:18 +00:00
Charles Davis
b38506e3a7 Implement .seh_stackalloc and .seh_pushframe parsing.
I haven't implemented any of the ones that take registers yet. The problem is
that for x86-64 the streamer methods expect a native x86 register number (note:
%r8-%r15 want 8-15 instead of 0-7; same for %xmm8-%xmm15). I haven't figured
out exactly how I want to do that yet.

llvm-svn: 131899
2011-05-23 16:43:09 +00:00
Chris Lattner
c64a4d1170 fix a really nasty basicaa mod/ref calculation bug that was causing miscompilation of
UnitTests/ObjC/messages-2.m with the recent optimizer improvements.

llvm-svn: 131897
2011-05-23 05:15:43 +00:00
Cameron Zwarich
5a416bda73 Fix <rdar://problem/9476260> by having tail calls always generate 32-bit branches
in Darwin Thumb2 code. Tail calls are already disabled on Thumb1.

llvm-svn: 131894
2011-05-23 01:57:17 +00:00
Chris Lattner
bee56202ba rearrange two transforms, since one subsumes the other. Make the shift-exactness
xform recurse.

llvm-svn: 131888
2011-05-23 00:32:19 +00:00
Chris Lattner
ec35f49b3e Transform any logical shift of a power of two into an exact/NUW shift when
in a known-non-zero context.

llvm-svn: 131887
2011-05-23 00:21:50 +00:00
Chris Lattner
498f516575 use the valuetracking isPowerOfTwo function, which is more powerful than checking
for a constant directly.  Thanks to Duncan for pointing this out.

llvm-svn: 131885
2011-05-23 00:09:55 +00:00
Chris Lattner
c277b19e97 Teach valuetracking that byval arguments with a specified alignment are
aligned.

Teach memcpyopt to not give up all hope when confonted with an underaligned
memcpy feeding an overaligned byval.  If the *source* of the memcpy can be
determined to be adequeately aligned, or if it can be forced to be, we can
eliminate the memcpy.

This addresses PR9794.  We now compile the example into:

define i32 @f(%struct.p* nocapture byval align 8 %q) nounwind ssp {
entry:
  %call = call i32 @g(%struct.p* byval align 8 %q) nounwind
  ret i32 %call
}

in both x86-64 and x86-32 mode.  We still don't get a tailcall though,
because tailcalls apparently can't handle byval.

llvm-svn: 131884
2011-05-23 00:03:39 +00:00
Chris Lattner
5fd8380a35 add a helper method to get the byval alignment of an argument.
llvm-svn: 131883
2011-05-22 23:57:23 +00:00
Chris Lattner
ca9723d80b Eliminate some temporary variables, and don't call getByValTypeAlignment
when we're just going to throw the result away.  No functionality change.

llvm-svn: 131880
2011-05-22 23:23:02 +00:00
Chris Lattner
5442c034a8 add a missing alias to make us more bug compatible with gcc, PR9378
llvm-svn: 131874
2011-05-22 22:31:57 +00:00
Chris Lattner
78663aa9f5 implement PR9315, constant folding exp2 in terms of pow (since hosts without
C99 runtimes don't have exp2).

llvm-svn: 131872
2011-05-22 22:22:35 +00:00
Renato Golin
759db3cbe3 RTABI chapter 4.3.4 specifies __eabi_mem* calls. Specifically, __eabi_memset accepts parameters (ptr, size, value) in a different order than GNU's memset (ptr, value, size), therefore the special lowering in AAPCS mode. Implementation by Evzen Muller.
llvm-svn: 131868
2011-05-22 21:41:23 +00:00
Charles Davis
a4187a96c9 Add methods to parse the SEH directives to the COFFAsmParser. Implement some
of them, particularly the ones that don't take arguments. Also implement
.seh_proc and .seh_handler.

llvm-svn: 131866
2011-05-22 21:12:15 +00:00
Chris Lattner
3066a7e5ad add a note.
llvm-svn: 131863
2011-05-22 18:28:46 +00:00
Chris Lattner
84f101ea45 add some random notes.
llvm-svn: 131862
2011-05-22 18:26:48 +00:00
Evan Cheng
a2e8770368 Teach ValueTracking about x86 crc32 intrinsics.
llvm-svn: 131861
2011-05-22 18:25:30 +00:00
Chris Lattner
8ed794f599 Carve out a place in instcombine to put transformations which work knowing that their
result is non-zero.  Implement an example optimization (PR9814), which allows us to
transform:
  A / ((1 << B) >>u 2)
into:
  A >>u (B-2)

which we compile into:

_divu3:                                 ## @divu3
	leal	-2(%rsi), %ecx
	shrl	%cl, %edi
	movl	%edi, %eax
	ret

instead of:

_divu3:                                 ## @divu3
	movb	%sil, %cl
	movl	$1, %esi
	shll	%cl, %esi
	shrl	$2, %esi
	movl	%edi, %eax
	xorl	%edx, %edx
	divl	%esi, %eax
	ret

llvm-svn: 131860
2011-05-22 18:18:41 +00:00
Johnny Chen
6e8aeaa2f4 Fix Bug 9386 - ARM disassembler failed to disassemble conditional bx
Modified the patch to .td file supplied by Jyun-Yan You.  Add a test case and
modified ARMDisassemblerCore.cpp a little bit.

llvm-svn: 131859
2011-05-22 17:51:04 +00:00
Chris Lattner
44516c3ba3 Fix PR9815: I was trying to get out of "generating code and then
failing to form a memset, then having to delete it" but my approximation
isn't safe for self recurrent loops.  Instead of doign a hack, just
do it the right way.

llvm-svn: 131858
2011-05-22 17:39:56 +00:00
Frits van Bommel
df58ece78a Add a parameter to ConstantFoldTerminator() that callers can use to ask it to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior.
I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this.

llvm-svn: 131855
2011-05-22 16:24:18 +00:00
Chris Lattner
98ce5cd957 fix PR9856, an incorrectly conservative assertion: a global can be
"stored once" even if its address is compared.

llvm-svn: 131849
2011-05-22 07:15:13 +00:00
Chris Lattner
6cce3b63ab fix PR9841 by having GVN not process dead loads. This was
causing it to get into infinite loops when it would widen a 
load (which can necessarily leave around dead loads).

llvm-svn: 131847
2011-05-22 07:03:34 +00:00
Chris Lattner
75adf06d44 fix a bug for hosts without round, PR8893.
llvm-svn: 131842
2011-05-22 06:03:53 +00:00
Chris Lattner
9359dea740 move PR9408 here.
llvm-svn: 131841
2011-05-22 05:45:06 +00:00
Nick Lewycky
9f7644d549 Teach the inliner to emit llvm.lifetime.start/end, to scope the local variables
of the inlinee to the code representing the original function.

llvm-svn: 131838
2011-05-22 05:22:10 +00:00
Chris Lattner
7eb3367809 switch to using a smallvector to avoid allocations for most normal size instructions.
llvm-svn: 131837
2011-05-22 04:53:24 +00:00