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

13200 Commits

Author SHA1 Message Date
James Molloy
1038b57cac Fix a codegen fault in which log2 or exp2 could be dead-code eliminated even though they could have sideeffects.
Only allow log2/exp2 to be converted to an intrinsic if they are declared "readnone".

llvm-svn: 151807
2012-03-01 14:32:18 +00:00
Jakob Stoklund Olesen
2055fc1331 Make InlineSpiller bundle-aware.
Simply treat bundles as instructions. Spill code is inserted between
bundles, never inside a bundle.  Rewrite all operands in a bundle at
once.

Don't attempt and memory operand folding inside bundles.

llvm-svn: 151787
2012-03-01 01:43:25 +00:00
Jakob Stoklund Olesen
1885bf0ac7 Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in
getInstructionIndex().

Also provide a const version. C++ is great for touch typing practice.

llvm-svn: 151782
2012-03-01 01:26:01 +00:00
Lang Hames
6cd018d0bc Don't redundantly copy implicit operands when rematerializing.
While we're at it - don't copy vreg implicit operands while rematerializing.
This fixes PR12138.

llvm-svn: 151779
2012-03-01 00:41:17 +00:00
Benjamin Kramer
1b5aa9f5cd LegalizeIntegerTypes: Reorder operations in the "big shift by small amount" optimization, making the lives of later passes easier.
llvm-svn: 151722
2012-02-29 13:27:00 +00:00
Jakob Stoklund Olesen
99c9b19c27 Add an analyzeVirtReg() function.
This function does more or less the same as
MI::readsWritesVirtualRegister(), but it supports bundles as well.

It also determines if any constraint requires reading and writing
operands to use the same register.  Most clients want to know.

Use the more modern MO.readsReg() instead of trying to sort out undefs
and partial redefines.  Stop supporting the extra full <imp-def> operand
as an alternative to <def,undef> sub-register defines.

llvm-svn: 151690
2012-02-29 01:40:37 +00:00
Jakob Stoklund Olesen
55ff251cc1 Move the operand iterator into MachineInstrBundle.h where it belongs.
Extract a base class and provide four specific sub-classes for iterating
over const/non-const bundles/instructions.

This eliminates the mystery bool constructor argument.

llvm-svn: 151684
2012-02-29 00:33:41 +00:00
Lang Hames
61e76ce0cf Kill off LiveRangeEdit::getNewVRegs and LiveRangeEdit::getUselessVRegs. These
methods are no longer needed now that LinearScan has gone away.

(Contains tweaks trivialSpillEverywhere to enable the removal of getNewVRegs).

llvm-svn: 151658
2012-02-28 22:07:24 +00:00
Evan Cheng
c5ead6c49e Re-commit r151623 with fix. Only issue special no-return calls if it's a direct call.
llvm-svn: 151645
2012-02-28 18:51:51 +00:00
Benjamin Kramer
9bff93fd22 Fix off-by one in comment.
llvm-svn: 151644
2012-02-28 18:37:06 +00:00
Benjamin Kramer
daa291f4fd LegalizeIntegerTypes: Reenable the large shift with small amount optimization.
To avoid problems with zero shifts when getting the bits that move between words
we use a trick: first shift the by amount-1, then do another shift by one. When
amount is 0 (and size 32) we first shift by 31, then by one, instead of by 32.

Also fix a latent bug that emitted the low and high words in the wrong order
when shifting right.

Fixes PR12113.

llvm-svn: 151637
2012-02-28 17:58:00 +00:00
Daniel Dunbar
b448d31a6b Revert r151623 "Some ARM implementaions, e.g. A-series, does return stack prediction. ...", it is breaking the Clang build during the Compiler-RT part.
llvm-svn: 151630
2012-02-28 15:36:07 +00:00
Nadav Rotem
9c1789a96c Code cleanup following CR by Duncan.
llvm-svn: 151627
2012-02-28 14:13:19 +00:00
Nadav Rotem
75b36e6716 Fix a bug in the code that builds SDNodes from vector GEPs.
When the GEP index is a vector of pointers, the code that calculated the size
of the element started from the vector type, and not the contained pointer type.
As a result, instead of looking at the data element pointed by the vector, this
code used the size of the vector. This works for 32bit members (on 32bit
systems), but not for other types. Added code to peel the vector type and
added a test.

llvm-svn: 151626
2012-02-28 11:54:05 +00:00
Evan Cheng
d29a22e4b0 Some ARM implementaions, e.g. A-series, does return stack prediction. That is,
the processor keeps a return addresses stack (RAS) which stores the address
and the instruction execution state of the instruction after a function-call
type branch instruction.

Calling a "noreturn" function with normal call instructions (e.g. bl) can
corrupt RAS and causes 100% return misprediction so LLVM should use a
unconditional branch instead. i.e.
mov lr, pc
b _foo
The "mov lr, pc" is issued in order to get proper backtrace.

rdar://8979299

llvm-svn: 151623
2012-02-28 06:42:03 +00:00
Jakob Stoklund Olesen
c74b7b271e Handle regmasks in MachineCSE.
Don't attempt to extend physreg live ranges across calls.

<rdar://problem/10942095>

llvm-svn: 151610
2012-02-28 02:08:50 +00:00
Jakob Stoklund Olesen
e3a308c116 Handle regmasks in the machine code verifier.
llvm-svn: 151607
2012-02-28 01:42:41 +00:00
Chad Rosier
2eec1f2ac0 Fix 80-column violation.
llvm-svn: 151599
2012-02-28 00:23:01 +00:00
Evan Cheng
9627003887 Fix for PR12090: clear def maps of aliases when visiting a copy. e.g.
%S5<def> = COPY %S0<kill>
First clear def map of Q1, etc.

No small test case available.

llvm-svn: 151574
2012-02-27 21:46:42 +00:00
Jakob Stoklund Olesen
edc3446412 Update machine code verifier.
After the SlotIndex slot names were updated, it is possible to apply
stricter checks to live intervals.

Also treat bundles as bags of operands when checking live intervals.

llvm-svn: 151531
2012-02-27 18:24:30 +00:00
Lang Hames
25553028ff Make the peephole optimizer clear kill flags on a vreg if it's about to add new
uses of the vreg, since the old kills may no longer be valid.  This was causing
-verify-machineinstrs to complain about uses after kills, and could potentially
have been causing subtle register allocation issues, but I haven't come across a
test case yet.

llvm-svn: 151425
2012-02-25 02:01:00 +00:00
Lang Hames
6ec3b488f8 Fixed typo.
llvm-svn: 151417
2012-02-25 00:46:38 +00:00
Jakob Stoklund Olesen
090f01cde9 Add missing static
llvm-svn: 151396
2012-02-24 21:52:44 +00:00
Jakob Stoklund Olesen
c077e0f945 Add a -stress-regalloc=<N> option.
This will limit all register classes to N registers in order to stress
test register allocation.

llvm-svn: 151379
2012-02-24 18:34:20 +00:00
Hal Finkel
8c2c90c035 Don't crash when a glue node contains an internal CopyToReg
This is necessary to support the existing ppc lowering code for indirect calls.
Fixes PR12071.

llvm-svn: 151373
2012-02-24 17:53:59 +00:00
Benjamin Kramer
993a8a86dd SDAGBuilder: Remove register sets that were never read and prune dead code surrounding it.
llvm-svn: 151364
2012-02-24 14:01:17 +00:00
Nick Lewycky
04735e1180 ScheduleDAGInstrs.h:155: warning: suggest parentheses around &&' within ||'.
llvm-svn: 151355
2012-02-24 07:59:05 +00:00
Andrew Trick
5c9371d10f PostRA sched: speed up physreg tracking by not abusing SparseSet.
llvm-svn: 151348
2012-02-24 07:04:55 +00:00
Pete Cooper
135769381b Turn avx insert intrinsic calls into INSERT_SUBVECTOR DAG nodes and remove duplicate patterns for selecting the intrinsics
llvm-svn: 151342
2012-02-24 03:51:49 +00:00
Eric Christopher
ea7403bfe2 If the Address of a variable is an argument then treat the entire
variable declaration as an argument because we want that address
anyhow for our debug information.

This seems to fix rdar://9965111, at least we have more debug
information than before and from reading the assembly it appears
to be the correct location.

llvm-svn: 151335
2012-02-24 01:59:08 +00:00
Eric Christopher
a4f94b0c3e Tabs, formatting and long lines oh my!
llvm-svn: 151334
2012-02-24 01:59:01 +00:00
Bill Wendling
1a35321235 Allow an integer to be converted into an MMX type when it's used in an inline
asm.
<rdar://problem/10106006>

llvm-svn: 151303
2012-02-23 23:25:25 +00:00
Benjamin Kramer
386c7b5901 BitVectorize loop.
llvm-svn: 151274
2012-02-23 19:29:25 +00:00
Benjamin Kramer
33ba1e7f2b post-ra-sched: Turn the KillIndices vector into a bitvector, it only stored two meaningful states.
Rename it to LiveRegs to make it more clear what's stored inside.

llvm-svn: 151273
2012-02-23 19:15:40 +00:00
Benjamin Kramer
d18bd5e885 post-ra-sched: Replace a std::set of regs with a bitvector.
Assuming that a single std::set node adds 3 control words, a bitvector
can store (3*8+4)*8=224 registers in the allocated memory of a single
element in the std::set (x86_64). Also we don't have to call malloc
for every register added.

llvm-svn: 151269
2012-02-23 18:28:32 +00:00
Jakob Stoklund Olesen
030f090aee Make calls scheduling boundaries post-ra.
Before register allocation, instructions can be moved across calls in
order to reduce register pressure.  After register allocation, we don't
gain a lot by moving callee-saved defs across calls.  In fact, since the
scheduler doesn't have a good idea how registers are used in the callee,
it can't really make good scheduling decisions.

This changes the schedule in two ways: 1. Latencies to call uses and
defs are no longer accounted for, causing some random shuffling around
calls.  This isn't really a problem since those uses and defs are
inaccurate proxies for what happens inside the callee.  They don't
represent registers used by the call instruction itself.

2. Instructions are no longer moved across calls.  This didn't happen
very often, and the scheduling decision was made on dubious information
anyway.

As with any scheduling change, benchmark numbers shift around a bit,
but there is no positive or negative trend from this change.

This makes the post-ra scheduler 5% faster for ARM targets.

The secret motivation for this patch is the introduction of register
mask operands representing call clobbers.  The most efficient way of
handling regmasks in ScheduleDAGInstrs is to model them as barriers for
physreg live ranges, but not for virtreg live ranges.  That's fine
pre-ra, but post-ra it would have the same effect as this patch.

llvm-svn: 151265
2012-02-23 17:54:21 +00:00
Benjamin Kramer
3839bfa8d6 Strip a layer of boilerplate from the VLIWPacketizer by storing the scheduler as an opaque pointer.
llvm-svn: 151252
2012-02-23 13:39:13 +00:00
Anton Korobeynikov
fb863cd279 Fix to make sure that a comdat group gets generated correctly for a static member
of instantiated C++ templates.

Patch by Kristof Beyls!

llvm-svn: 151250
2012-02-23 10:36:04 +00:00
Eric Christopher
11256ac91b More newline cleanups.
llvm-svn: 151235
2012-02-23 03:39:43 +00:00
Eric Christopher
ab73f1be35 Add some handy-dandy newlines.
llvm-svn: 151234
2012-02-23 03:39:39 +00:00
Andrew Trick
913f302a31 misched: cleanup reaching def computation
Ignore undef uses completely.
Use a more explicit SlotIndex API.
Add more explicit comments.

llvm-svn: 151233
2012-02-23 03:16:24 +00:00
Andrew Trick
2cb2c4c487 PostRASched: Convert physreg def/use tracking to Jakob's SparseSet.
Added array subscript to SparseSet for convenience.
Slight reorg to make it easier to manage the def/use sets.

llvm-svn: 151228
2012-02-23 01:52:38 +00:00
Jakob Stoklund Olesen
160ff15f26 Handle regmasks in FixupKills.
llvm-svn: 151226
2012-02-23 01:22:15 +00:00
Jakob Stoklund Olesen
7888265c63 Handle regmasks in CriticalAntiDepBreaker.
llvm-svn: 151223
2012-02-23 01:15:26 +00:00
Jakob Stoklund Olesen
1ef46c1866 Track reserved registers separately from RegsAvailable.
The bulk masking operations from register mask operands don't account
for reserved registers.

llvm-svn: 151222
2012-02-23 01:13:32 +00:00
Jakob Stoklund Olesen
ff8fc50831 Don't compute latencies for regmask operands.
llvm-svn: 151211
2012-02-22 22:52:52 +00:00
Jakob Stoklund Olesen
d9600dff1c Handle regmasks in RegisterScavenging.
llvm-svn: 151210
2012-02-22 22:50:14 +00:00
Andrew Trick
1caa19b613 misched: Use SparseSet for VRegDegs for constant time clear().
llvm-svn: 151205
2012-02-22 21:59:00 +00:00
Hal Finkel
cfc8c850f6 Allow the use of an alternate symbol for calculating a function's size.
The standard function epilog includes a .size directive, but ppc64 uses
an alternate local symbol to tag the actual start of each function.

Until recently, binutils accepted the .size directive as:
 .size	test1, .Ltmp0-test1
however, using this directive with recent binutils will result in the error:
 .size expression for XXX does not evaluate to a constant
so we must use the label which actually tags the start of the function.

llvm-svn: 151200
2012-02-22 21:11:47 +00:00
Michael J. Spencer
24f6d49962 Properly emit _fltused with FastISel. Refactor to share code with SDAG.
Patch by Joe Groff!

llvm-svn: 151183
2012-02-22 19:06:13 +00:00