1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

41195 Commits

Author SHA1 Message Date
Eric Christopher
3aa2bb55d8 Rework arm fast-isel load and store handling. Move offset computation
into the "address selection" routine and handle constant materialization
for stores.

llvm-svn: 112788
2010-09-02 00:53:56 +00:00
Jim Grosbach
82a4ac2c83 Add a bit of debug output for register scavenging
llvm-svn: 112787
2010-09-02 00:51:37 +00:00
Jim Grosbach
94a445d9d1 trivial cleanup
llvm-svn: 112779
2010-09-02 00:02:26 +00:00
Jim Grosbach
2a3afa421b Simplify the tGPR register class now that the register allocators know not
to try to allocate reserved registers.

llvm-svn: 112774
2010-09-01 23:50:23 +00:00
Bob Wilson
3348d2eb50 Remove NEON vmull, vmlal, and vmlsl intrinsics, replacing them with multiply,
add, and subtract operations with zero-extended or sign-extended vectors.
Update tests.  Add auto-upgrade support for the old intrinsics.

llvm-svn: 112773
2010-09-01 23:50:19 +00:00
Chris Lattner
b1c861e28c deepen my MMX/SRoA hack to avoid hurting non-x86 codegen.
llvm-svn: 112763
2010-09-01 23:09:27 +00:00
Bruno Cardoso Lopes
b73f0cbc7a Revert r112689, avoid those kind of checks cause they mess up with mmx
llvm-svn: 112760
2010-09-01 22:59:03 +00:00
Jim Grosbach
9df54659d3 Tweak to ignoring reserved regs. The allocator was occasionally still looking
at them since they'd end up in the register weights list. Tell it to stop
doing that.

llvm-svn: 112756
2010-09-01 22:48:34 +00:00
Bruno Cardoso Lopes
601bf4c6d3 Using target specific nodes for shuffle nodes makes the mask
check more strict, breaking some cases not checked in the
testsuite, but also exposes some foldings not done before,
as this example:

  movaps  (%rdi), %xmm0
  movaps  (%rax), %xmm1
  movaps  %xmm0, %xmm2
  movss %xmm1, %xmm2
  shufps  $36, %xmm2, %xmm0

now is generated as:

  movaps  (%rdi), %xmm0
  movaps  %xmm0, %xmm1
  movlps  (%rax), %xmm1
  shufps  $36, %xmm1, %xmm0

llvm-svn: 112753
2010-09-01 22:33:20 +00:00
Eric Christopher
abf61f76c9 Some basic store support.
llvm-svn: 112752
2010-09-01 22:16:27 +00:00
Jakob Stoklund Olesen
fe11c81560 Teach RemoveCopyByCommutingDef to check all aliases, not just subregisters.
This caused a miscompilation in WebKit where %RAX had conflicting defs when
RemoveCopyByCommutingDef was commuting a %EAX use.

llvm-svn: 112751
2010-09-01 22:15:35 +00:00
Jim Grosbach
69ffc23491 tidy up trailing whitespace and an 80 column violation.
llvm-svn: 112746
2010-09-01 21:48:06 +00:00
Dan Gohman
d0dc80485c Fix loop unswitching's assumption that a code path which either
infinite loops or exits will eventually exit. This fixes PR5373.

llvm-svn: 112745
2010-09-01 21:46:45 +00:00
Jim Grosbach
250d5e6af4 cleanup per feedback. use a helper function for getting the first non-reserved
physical register in a register class. Make sure to assert if the register
class is empty.

llvm-svn: 112743
2010-09-01 21:34:41 +00:00
Jim Grosbach
6de7c3ef19 The register allocator shouldn't consider allocating reserved registers. PBQP version.
llvm-svn: 112742
2010-09-01 21:23:03 +00:00
Jim Grosbach
18fc90c535 The register allocator shouldn't consider allocating reserved registers.
r112728 did this for fast regalloc.

llvm-svn: 112741
2010-09-01 21:04:27 +00:00
Jim Grosbach
4672574f24 The register allocator shouldn't consider allocating reserved registers.
llvm-svn: 112728
2010-09-01 19:28:41 +00:00
Jim Grosbach
f727f525cd tidy up a few 80-column and trailing whitespace bits.
llvm-svn: 112726
2010-09-01 19:16:29 +00:00
Owen Anderson
e036dd5b0b JumpThreading keeps LazyValueInfo up to date, so we don't need to rerun it
if we schedule another LVI-using pass afterwards.

llvm-svn: 112722
2010-09-01 18:27:22 +00:00
Eric Christopher
92238b2b5a Add some more load types in.
llvm-svn: 112721
2010-09-01 18:01:32 +00:00
Eric Christopher
f72b7040a2 Speculatively revert 112699 and 112702, they seem to be causing
self host errors on clang-x86-64.

llvm-svn: 112719
2010-09-01 17:29:10 +00:00
Chris Lattner
707d1b96a2 have the makefiles check the llvm-config error code instead of charging
on an producing weird link errors.  Patch by Yuri Gribov!

llvm-svn: 112714
2010-09-01 16:11:17 +00:00
Chris Lattner
118bf38c3f dead code patrol
llvm-svn: 112713
2010-09-01 16:06:39 +00:00
Chris Lattner
b911e51b26 zap dead code.
llvm-svn: 112712
2010-09-01 16:04:34 +00:00
Chris Lattner
b74759a9fa temporarily revert r112664, it is causing a decoding conflict, and
the testcases should be merged.

llvm-svn: 112711
2010-09-01 16:00:50 +00:00
Dan Gohman
f9e09104f1 Make tool_output_file's raw_ostream instance a member variable instead
of a base class.

This makes it possible to unregister the file from FilesToRemove when
the file is done. Also, this eliminates the need for
formatted_tool_output_file.

llvm-svn: 112706
2010-09-01 14:20:41 +00:00
Dan Gohman
5f2118dd6f Add an interface for unregistering a file from the FilesToRemove list.
llvm-svn: 112705
2010-09-01 14:17:34 +00:00
Duncan Sands
6aa2784156 Use the SSAUpdator to turn calls to eh.exception that are not in a
landing pad into uses of registers rather than loads from a stack
slot.  Doesn't touch the 'orrible hack code - Bill needs to persuade
me harder :)

llvm-svn: 112702
2010-09-01 14:07:47 +00:00
Duncan Sands
f7e2f45e1a If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory.  Instead, simply pass
in the type and name explicitly, which is all that was used anyway.

llvm-svn: 112699
2010-09-01 10:29:33 +00:00
Chris Lattner
9759e898f0 add a gross hack to work around a problem that Argiris reported
on llvmdev: SRoA is introducing MMX datatypes like <1 x i64>,
which then cause random problems because the X86 backend is
producing mmx stuff without inserting proper emms calls.

In the short term, force off MMX datatypes.  In the long term,
the X86 backend should not select generic vector types to MMX
registers.  This is being worked on, but won't be done in time
for 2.8.  rdar://8380055

llvm-svn: 112696
2010-09-01 05:14:33 +00:00
Bruno Cardoso Lopes
9375b2f67d Use movlps, movlpd, movss and movsd specific nodes instead of pattern matching with movlp pattern fragment
llvm-svn: 112694
2010-09-01 05:08:25 +00:00
Dan Gohman
ad593f9d93 Revert 112442 and 112440 until the compile time problems introduced
by 112440 are resolved.

llvm-svn: 112692
2010-09-01 01:45:53 +00:00
Bruno Cardoso Lopes
b69568ab33 minor change, simplify some logic
llvm-svn: 112689
2010-09-01 00:57:08 +00:00
Bruno Cardoso Lopes
c31697f68c Move some functions around so they can be used for some other to come function
llvm-svn: 112687
2010-09-01 00:51:36 +00:00
Devang Patel
9e8ee9242f Use absolute label for DW_AT_stmt_list if a target does not prefer offset here.
This patch was developed on top of original patch by Artur Pietrek.

llvm-svn: 112678
2010-08-31 23:50:19 +00:00
Chris Lattner
5ed5e29575 licm is wasting time hoisting constant foldable operations,
instead of hoisting them, just fold them away.  This occurs in the
testcase for PR8041, for example.

llvm-svn: 112669
2010-08-31 23:00:16 +00:00
Kevin Enderby
cc1c9257f6 This is the second of three patches to implement support for the .loc directive
and output the dwarf line number tables.  This takes the current loc info after
an instruction is assembled and saves the needed info into an object that has
vector and for each section.  These objects will be used for the final patch to 
build and emit the encoded dwarf line number tables.  Again for now this is only
in the Mach-O streamer but at some point will move to a more generic place.

llvm-svn: 112668
2010-08-31 22:55:11 +00:00
Dan Gohman
fb64948296 Reapply r112432, now that the real problem is addressed.
llvm-svn: 112667
2010-08-31 22:53:17 +00:00
Dan Gohman
cadc463790 Reapply r112433, now that the real problem is addressed.
llvm-svn: 112666
2010-08-31 22:52:12 +00:00
Dan Gohman
a9b5b6bd36 Revert r110916. This patch is buggy because the code inside the
inner loop doesn't update all the variables in the outer loop.

llvm-svn: 112665
2010-08-31 22:50:31 +00:00
Bill Wendling
bb6052cfd6 We have a chance for an optimization. Consider this code:
int x(int t) {
  if (t & 256)
    return -26;
  return 0;
}

We generate this:

     tst.w   r0, #256
     mvn     r0, #25
     it      eq
     moveq   r0, #0

while gcc generates this:

     ands    r0, r0, #256
     it      ne
     mvnne   r0, #25
     bx      lr

Scandalous really!

During ISel time, we can look for this particular pattern. One where we have a
"MOVCC" that uses the flag off of a CMPZ that itself is comparing an AND
instruction to 0. Something like this (greatly simplified):

  %r0 = ISD::AND ...
  ARMISD::CMPZ %r0, 0         @ sets [CPSR]
  %r0 = ARMISD::MOVCC 0, -26  @ reads [CPSR]

All we have to do is convert the "ISD::AND" into an "ARM::ANDS" that sets [CPSR]
when it's zero. The zero value will all ready be in the %r0 register and we only
need to change it if the AND wasn't zero. Easy!

llvm-svn: 112664
2010-08-31 22:41:22 +00:00
Anton Korobeynikov
1fa6799edc Some fixes for NetBSD
llvm-svn: 112662
2010-08-31 22:38:00 +00:00
Bruno Cardoso Lopes
80613a070e Use x86 specific MOVSLDUP node, add more patterns to match it and remove useless load nodes
llvm-svn: 112661
2010-08-31 22:35:05 +00:00
Devang Patel
46570e6783 Reapply r112623. Included additional check for unused byval argument.
llvm-svn: 112659
2010-08-31 22:22:42 +00:00
Bruno Cardoso Lopes
8fc83b1960 Use x86 specific MOVSHDUP node and add more patterns to match it
llvm-svn: 112657
2010-08-31 22:22:11 +00:00
Bill Wendling
4a52e8fec0 And ANDS pattern to match the t2ANDS pattern.
llvm-svn: 112654
2010-08-31 22:05:37 +00:00
Jakob Stoklund Olesen
7ffcddc113 Make %EFLAGS unallocatable.
No CCR virtual registers should exist, and %EFLAGS is used in ways that can
surprise RegAllocFast.

llvm-svn: 112650
2010-08-31 21:51:07 +00:00
Jakob Stoklund Olesen
9fe6b84fb2 Track liveness of unallocatable, unreserved registers in machine DCE.
Reserved registers are unpredictable, and are treated as always live by machine
DCE.

Allocatable registers are never reserved, and can be used for virtual registers.

Unreserved, unallocatable registers can not be used for virtual registers, but
otherwise behave like a normal allocatable register. Most targets only have
the flag register in this set.

llvm-svn: 112649
2010-08-31 21:51:05 +00:00
Bruno Cardoso Lopes
dfa177cf81 Use MOVHLPS node instead of matching using movhlps and movhlps_undef pattern fragments
llvm-svn: 112644
2010-08-31 21:38:49 +00:00
Chris Lattner
f2ee739a2b tidy up
llvm-svn: 112643
2010-08-31 21:21:25 +00:00
Bruno Cardoso Lopes
6fbe7b9ddd Use MOVLHPS and MOVHLPS x86 nodes whenever possible. Also remove some useless nodes
llvm-svn: 112642
2010-08-31 21:15:21 +00:00
Dan Gohman
6822b9d177 Revert r112432. It appears to be exposing a problem in the emacs build.
llvm-svn: 112638
2010-08-31 20:58:44 +00:00
Owen Anderson
233463074b More cleanups of my JumpThreading transforms, including extracting some duplicated code into a helper function.
llvm-svn: 112634
2010-08-31 20:26:04 +00:00
Jakob Stoklund Olesen
d76e5132e7 Ignore unallocatable registers in RegAllocFast.
llvm-svn: 112632
2010-08-31 19:54:25 +00:00
Devang Patel
b94251aea0 Revert r112623. It is causing self host build failures.
llvm-svn: 112631
2010-08-31 19:41:03 +00:00
Owen Anderson
66b51ff843 Add an RAII helper to make cleanup of the RecursionSet more fool-proof.
llvm-svn: 112628
2010-08-31 19:24:27 +00:00
Owen Anderson
5e2c04e417 Only try to clean up the current block if we changed that block already.
llvm-svn: 112625
2010-08-31 18:55:52 +00:00
Jim Grosbach
9cc0a6397a SP relative offsets need to be adjusted by the local allocation size when
determining if they're likely to be in range of the SP when resolving
frame references.

llvm-svn: 112624
2010-08-31 18:52:31 +00:00
Devang Patel
414cbc940a Remember byval argument's frame index during argument lowering and use this info to emit debug info.
Fixes Radar 8367011.

llvm-svn: 112623
2010-08-31 18:50:09 +00:00
Jim Grosbach
d0ebe535e9 this assert should just be a condition, since this function is just asking if
the offset is legally encodable, not actually trying to do the encoding.

llvm-svn: 112622
2010-08-31 18:49:31 +00:00
Owen Anderson
e2b5bd3a7f Refactor my fix for PR5652 to terminate the predecessor lookups after the first failure.
llvm-svn: 112620
2010-08-31 18:48:48 +00:00
Jim Grosbach
ddc265a982 Improve virtual frame base register allocation heuristics.
1. Allocate them in the entry block of the function to enable function-wide
     re-use. The instructions to create them should be re-materializable, so
     there shouldn't be additional cost compared to creating them local
     to the basic blocks where they are used.
  2. Collect all of the frame index references for the function and sort them
     by the local offset referenced. Iterate over the sorted list to
     allocate the virtual base registers. This enables creation of base
     registers optimized for positive-offset access of frame references.
     (Note: This may be appropriate to later be a target hook to do the
     sorting in a target appropriate manner. For now it's done here for
     simplicity.)

llvm-svn: 112609
2010-08-31 17:58:19 +00:00
Dan Gohman
47865eb626 Speculatively revert r112433.
llvm-svn: 112608
2010-08-31 17:56:47 +00:00
Benjamin Kramer
3f8b8c1f5b Allow creation of SHT_NULL sections, from Roman Divacky.
llvm-svn: 112605
2010-08-31 17:03:33 +00:00
Duncan Sands
2a1c11e104 Stop using the dom frontier in DwarfEHPrepare by not promoting alloca's
any more.  I plan to reimplement alloca promotion using SSAUpdater later.
It looks like Bill's URoR logic really always needs domtree, so the pass
now always asks for domtree info.

llvm-svn: 112597
2010-08-31 09:05:06 +00:00
Nick Lewycky
66fe124a92 Fix an infinite loop; merging two functions will create a new function (if the
two are weak, we make them thunks to a new strong function) so don't iterate
through the function list as we're modifying it.

Also add back the outermost loop which got removed during the cleanups.

llvm-svn: 112595
2010-08-31 08:29:37 +00:00
Owen Anderson
bf12defee5 Don't perform an extra traversal of the function just to do cleanup. We can safely simplify instructions after each block has been processed without worrying about iterator invalidation.
llvm-svn: 112594
2010-08-31 07:55:56 +00:00
Bill Wendling
0409e77e99 - Cleanup some whitespaces.
- Convert {0,1} and friends into 0b01, which is identical and more consistent.

llvm-svn: 112593
2010-08-31 07:50:46 +00:00
Owen Anderson
ccaee65189 Rename ValuePropagation to a more descriptive CorrelatedValuePropagation.
llvm-svn: 112591
2010-08-31 07:48:34 +00:00
Owen Anderson
6853ce863c Rename file to something more descriptive.
llvm-svn: 112590
2010-08-31 07:41:39 +00:00
Owen Anderson
ba28fe3dcb More Chris-inspired JumpThreading fixes: use ConstantExpr to correctly constant-fold undef, and be more careful with its return value.
This actually exposed an infinite recursion bug in ComputeValueKnownInPredecessors which theoretically already existed (in JumpThreading's
handling of and/or of i1's), but never manifested before.  This patch adds a tracking set to prevent this case.

llvm-svn: 112589
2010-08-31 07:36:34 +00:00
Michael J. Spencer
ab565264fa Cleanup Whitespace.
llvm-svn: 112587
2010-08-31 06:36:46 +00:00
Michael J. Spencer
3bca7bf84d System: Fix getMagicNumber on windows.
getMagicNumber was treating the _binary_ data it read in as a
null terminated string. This resulted in the std::string
calculating the length, and causing an assert in other code that
assumed that the length it passed was the same as the length of
the string it would get back.

llvm-svn: 112586
2010-08-31 06:36:33 +00:00
Devang Patel
a1ff33906b Offset is not always unsigned number.
llvm-svn: 112584
2010-08-31 06:12:08 +00:00
Devang Patel
2eeab37306 Simplify.
llvm-svn: 112583
2010-08-31 06:11:28 +00:00
Nick Lewycky
75dfadbaf9 Switch to DenseSet, simplifying much more code. We now have a single iteration
where we hash, compare and fold, instead of one iteration where we build up
the hash buckets and a second one to fold.

llvm-svn: 112582
2010-08-31 05:53:05 +00:00
Owen Anderson
bd9edea8a3 Remove r111665, which implemented store-narrowing in InstCombine. Chris discovered a miscompilation in it, and it's not easily
fixable at the optimizer level. I'll investigate reimplementing it in DAGCombine.

llvm-svn: 112575
2010-08-31 04:41:06 +00:00
Bruno Cardoso Lopes
ebe80d78ff zap unused method. x86 is the only user and already has a more powerfull version
llvm-svn: 112571
2010-08-31 02:36:20 +00:00
Bruno Cardoso Lopes
08d5d62dcb Use X86ISD::MOVSS and MOVSD to represent the movl mask pattern, also fix the handling of those nodes when seeking for scalars inside vector shuffles
llvm-svn: 112570
2010-08-31 02:26:40 +00:00
Eric Christopher
b2756a8b99 Rewrite slightly so we can expand for floating point types easier.
llvm-svn: 112568
2010-08-31 01:28:42 +00:00
Jakob Stoklund Olesen
6fa8a6ac6b Add experimental -disable-physical-join command line option.
Eventually, we want to disable physreg coalescing completely, and let the
register allocator do its job using hints.

This option makes it possible to measure the impact of disabling physreg
coalescing.

llvm-svn: 112567
2010-08-31 01:27:49 +00:00
Owen Anderson
f1cec75012 Fix a typo.
llvm-svn: 112560
2010-08-30 23:59:30 +00:00
Eric Christopher
21b355b522 If we have an unhandled type then assert, we shouldn't get here for
things we can't handle.

llvm-svn: 112559
2010-08-30 23:48:26 +00:00
Owen Anderson
c90a98e0a5 Cleanups suggested by Chris.
llvm-svn: 112553
2010-08-30 23:34:17 +00:00
Owen Anderson
af33f22b40 Re-apply r112539, being more careful to respect the return values of the constant folding methods. Additionally,
use the ConstantExpr::get*() methods to simplify some constant folding.

llvm-svn: 112550
2010-08-30 23:22:36 +00:00
Anton Korobeynikov
851437063a Expand MOVi32imm in ARM mode after regalloc. This provides
scheduling opportunities (extra instruction can go in between
MOVT / MOVW pair removing the stall).

llvm-svn: 112546
2010-08-30 22:50:36 +00:00
Owen Anderson
8e72b2f3f5 Add statistics to evaluate this pass.
llvm-svn: 112545
2010-08-30 22:45:55 +00:00
Owen Anderson
9d301e20e8 Revert r112539. It accidentally introduced a miscompilation.
llvm-svn: 112543
2010-08-30 22:33:41 +00:00
Owen Anderson
479c0c406f Fixes and cleanups pointed out by Chris. In general, be careful to handle 0 results from ComputeValueKnownInPredecessors
(indicating undef), and re-use existing constant folding APIs.

llvm-svn: 112539
2010-08-30 22:07:52 +00:00
Bill Wendling
7532e3418e Use the existing T2I_bin_s_irs pattern instead of creating T2I_bin_sw_irs, which
is meant to do exactly the same thing. Thanks to Jim Grosbach for pointing this
out! :-)

llvm-svn: 112538
2010-08-30 22:05:23 +00:00
NAKAMURA Takumi
2c7cfc7bd4 Fix a comment.
llvm-svn: 112535
2010-08-30 21:54:03 +00:00
Jakob Stoklund Olesen
ce3cfe3e8b Remember to clear the shadow kill flag at the same time as clearing the real
kill flag.

This could cause duplicate kill flags when the same register was used twice in a
continuous sequence of STRs.

There is no small test case. <rdar://problem/8218046>

llvm-svn: 112534
2010-08-30 21:52:40 +00:00
Dan Gohman
6909a51674 Add comments explaining why it's not necessary to include the
is-function-local flag in metadata uniquing bits.

llvm-svn: 112528
2010-08-30 21:18:41 +00:00
Bob Wilson
826a677f94 Remove NEON vmovn intrinsic, replacing it with vector truncate operations.
Auto-upgrade the old intrinsic and update tests.

llvm-svn: 112507
2010-08-30 20:02:30 +00:00
Jim Grosbach
674b25ce31 Make ARM add rN, sp, #imm instructions rematerializable. That's how the address of locals is calculated, so this should
help relieve register pressure a bit. Recalculating the local address is
almost always going to be better than spilling.

llvm-svn: 112503
2010-08-30 19:49:58 +00:00
Chris Lattner
765e59210c two changes:
1) nuke ConstDataCoalSection, which is dead.
2) revise my previous patch for rdar://8018335,
  which was completely wrong.  Specifically, it doesn't 
  make sense to mark __TEXT,__const_coal as PURE_INSTRUCTIONS,
  because it is for readonly data.  templates (it turns out)
  go to const_coal_nt.  The real fix for rdar://8018335 was
  to give ConstTextCoalSection a section kind of ReadOnly 
  instead of Text.

llvm-svn: 112496
2010-08-30 18:12:35 +00:00
Bob Wilson
2b83684be8 When expanding NEON VST pseudo instructions, if the original super-register
operand is killed, add it to the expanded instruction as an implicit kill
operand instead of marking the individual subregs with kill flags.  This
should work better in general and also handles the case for VST3 where one
of the subregs was not referenced in the expanded instruction and so was
not marked killed.

llvm-svn: 112494
2010-08-30 18:10:48 +00:00
Benjamin Kramer
6c5076f317 MCELF: The value of all common symbols is the offset from the start of the section. Patch by Roman Divacky.
llvm-svn: 112492
2010-08-30 17:20:17 +00:00
Owen Anderson
d29fb4b991 It is possible to try to merge a not-constant with a constantrage, when dealing with ptrtoint ConstantExpr's.
Unfortunately, the only testcase I have for this is huge and doesn't reduce well because the error is
sensitive to iteration-order issues, since the problem only occurs when merging values in a particular order.

llvm-svn: 112489
2010-08-30 17:03:45 +00:00
Benjamin Kramer
b63bf8cf9b Don't print two "0x" prefixes. Use a raw_ostream overload instead of llvm::format.
llvm-svn: 112479
2010-08-30 14:46:53 +00:00