Commit Graph

14432 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
7eafc3e7be Add a new hook for providing register allocator hints more flexibly.
The TargetRegisterInfo::getRegAllocationHints() function is going to
replace the existing mechanisms for providing target-dependent hints to
the register allocator: ResolveRegAllocHint() and
getRawAllocationOrder().

The new hook is more flexible because it allows the target to provide
multiple preferred candidate registers for each virtual register, and it
is easier to use because targets are not required to return a reference
to a constant array like getRawAllocationOrder().

An optional VirtRegMap argument can be used to provide target-dependent
hints that depend on the provisional assignments of other virtual
registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169154 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 21:17:00 +00:00
Eli Bendersky
d4a05e0c2c Fix PR12942: Allow two CUs to be generated from the same source file.
Thanks Eric for the review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 18:45:45 +00:00
Chandler Carruth
d04a8d4b33 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 16:50:05 +00:00
Nadav Rotem
a569a80e58 Allow merging multiple store sequences on the same chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-02 17:14:09 +00:00
Andrew Trick
657b75b994 misched: Fix RegisterPressureTracker handling of DebugVals.
Assertion failed: (TopRPTracker.getPos() == RegionBegin && "bad initial Top tracker").
rdar://12790302.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169072 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:22:49 +00:00
Andrew Trick
177d87ac8d misched: Fix the DAG builder to handle an undef operand at ExitSU.
Assertion failed: (VNI && "No value to read by operand")
rdar://12790267.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169071 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:22:44 +00:00
Andrew Trick
30fe61aa35 misched: Fix LiveInterval update to better handle DebugVal.
Assertion failed: (itr != mi2iMap.end() && "Instruction not found in maps.")
rdar://12777252.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169070 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:22:41 +00:00
Andrew Trick
67bdd42d1e misched: fix RegionBegin when DebugValues get shuffled to the top.
assert (RemainingInstrs == 0 && "Instruction count mismatch!")

rdar://12776937.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:22:38 +00:00
Jakob Stoklund Olesen
8c3dccde92 Simplify REG_SEQUENCE lowering.
The TwoAddressInstructionPass takes the machine code out of SSA form by
expanding REG_SEQUENCE instructions into copies. It is no longer
necessary to rewrite the registers used by a REG_SEQUENCE instruction
because the new coalescer algorithm can do it now.

REG_SEQUENCE is just converted to a sequence of sub-register copies now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169067 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:06:44 +00:00
Eric Christopher
98e237fc69 Add some first skeleton work for the DWARF5 Fission proposal. Emit
part of the compile unit CU and start separating out information into
the various sections that will be pulled out later.

WIP.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169061 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:59:06 +00:00
Jakob Stoklund Olesen
3e77747eba Convert COPY instructions into KILLs if they have implicit defs.
MachineCopyPropagation doesn't understand super-register liveness well
enough to be able to remove implicit defs of super-registers.

This fixes a problem in ARM/2012-01-26-CopyPropKills.ll that is exposed
by an future TwoAddressInstructionPass change. The KILL instructions are
removed before the machine code is emitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169060 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:53:00 +00:00
Bill Wendling
08510b14d4 Replace r168930 with a more reasonable patch.
The original patch removed a bunch of code that the SjLjEHPrepare pass placed
into the entry block if all of the landing pads were removed during the
CodeGenPrepare class. The more natural way of doing things is to run the CGP
*before* we run the SjLjEHPrepare pass.

Make it so!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169044 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 22:08:55 +00:00
Eric Christopher
5cf823cd82 More comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168952 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 22:56:13 +00:00
Justin Holewinski
db62a883a7 Cleanup recent addition of DAGTypeLegalizer::SplitVecOp_VSELECT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168932 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 19:42:09 +00:00
Benjamin Kramer
5175fd990c misched: Recompute priority queue when DFSResults are updated.
This was found by MSVC10's STL debug mode on a test from the test suite. Sadly
std::is_heap isn't standard so there is no way to assert this without writing
our own heap verify, which looks like overkill to me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168885 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 14:36:26 +00:00
Justin Holewinski
7f128ea00c Teach the legalizer how to handle operands for VSELECT nodes
If we need to split the operand of a VSELECT, it must be the mask operand. We
split the entire VSELECT operand with EXTRACT_SUBVECTOR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168883 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 14:26:28 +00:00
Justin Holewinski
3d200255d5 Allow targets to prefer TypeSplitVector over TypePromoteInteger when computing the legalization method for vectors
For some targets, it is desirable to prefer scalarizing <N x i1> instead of promoting to a larger legal type, such as <N x i32>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168882 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 14:26:24 +00:00
Jakob Stoklund Olesen
39b5c0c049 Use MCPhysReg for RegisterClassInfo allocation orders.
This saves a bit of memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168852 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 03:34:17 +00:00
Jakob Stoklund Olesen
89bea17af2 Avoid rewriting instructions twice.
This could cause miscompilations in targets where sub-register
composition is not always idempotent (ARM).

<rdar://problem/12758887>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168837 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:26:11 +00:00
Nadav Rotem
90e11dc8ad When combining consecutive stores allow loads in between the stores, if the loads do not alias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168832 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:00:08 +00:00
Jakob Stoklund Olesen
1ead68d769 Make the LiveRegMatrix analysis available to targets.
No functional change, just moved header files.

Targets can inject custom passes between register allocation and
rewriting. This makes it possible to tweak the register allocation
before rewriting, using the full global interference checking available
from LiveRegMatrix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168806 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 19:13:06 +00:00
Andrew Trick
8b1496c922 misched: Analysis that partitions the DAG into subtrees.
This is a simple, cheap infrastructure for analyzing the shape of a
DAG. It recognizes uniform DAGs that take the shape of bottom-up
subtrees, such as the included matrix multiplication example. This is
useful for heuristics that balance register pressure with ILP. Two
canonical expressions of the heuristic are implemented in scheduling
modes: -misched-ilpmin and -misched-ilpmax.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 05:13:28 +00:00
Andrew Trick
53e98a2c4a misched: rename ScheduleDAGILP to ScheduleDFS to prepare for other heuristics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168772 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 05:13:24 +00:00
Andrew Trick
8f82a08673 misched: better alias analysis.
This fixes a hole in the "cheap" alias analysis logic implemented within
the DAG builder itself, regardless of whether proper alias analysis is
enabled. It now handles this pattern produced by LSR+CodeGenPrepare.

%sunkaddr1 = ptrtoint * %obj to i64
%sunkaddr2 = add i64 %sunkaddr1, %lsr.iv
%sunkaddr3 = inttoptr i64 %sunkaddr2 to i32*
store i32 %v, i32* %sunkaddr3

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168768 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:42:49 +00:00
Andrew Trick
b422104f35 misched: Debug output fix. Use an always valid iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:42:47 +00:00
Jakob Stoklund Olesen
fa2d98632c Move the guts of TargetInstrInfoImpl into the TargetInstrInfo class.
The *Impl class no longer serves a purpose now that the super-class
implementation is in CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168759 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 02:35:13 +00:00
Jakob Stoklund Olesen
11fad6ec66 Move Target{Instr,Register}Info.cpp into lib/CodeGen.
The Target library is not allowed to depend on the large CodeGen
library, but the TRI and TII classes provide abstract interfaces that
require both caller and callee to link to CodeGen.

The implementation files for these classes provide default
implementations of some of the hooks. These methods may need to
reference CodeGen, so they belong in that library.

We already have a number of methods implemented in the
TargetInstrInfoImpl sub-class because of that. I will merge that class
into the parent next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168758 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 02:35:09 +00:00
Chad Rosier
18bb0545ff Revert r168630, r168631, and r168633 as these are causing nightly test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168751 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 00:21:29 +00:00
Eric Christopher
b6dc8655e1 Attempt to make the comments for dwarf debug look more like
the coding standard would like.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168737 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 22:43:45 +00:00
Eric Christopher
4288502af9 Reapply section moving, make sure string section is output last.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168736 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 22:43:42 +00:00
Manman Ren
39834da697 CSE: allow PerformTrivialCoalescing to check copies across basic block
boundaries.

Given the following case:
BB0
  %vreg1<def> = SUBrr %vreg0, %vreg7
  %vreg2<def> = COPY %vreg7
BB1
  %vreg10<def> = SUBrr %vreg0, %vreg2
We should be able to CSE between SUBrr in BB0 and SUBrr in BB1.

rdar://12462006


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 18:58:41 +00:00
Jakub Staszak
9e3c3886d0 Remove duplicated #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 18:27:14 +00:00
Ulrich Weigand
dba37a3c43 Never use .lcomm on platforms where it does not accept an alignment
argument.  Instead, use a pair of .local and .comm directives.

This avoids spurious differences between binaries built by the
integrated assembler vs. those built by the external assembler,
since the external assembler may impose alignment requirements
on .lcomm symbols where the integrated assembler does not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168704 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 16:11:16 +00:00
Eric Christopher
fcdbecbbaf Revert rearrangement of debug info sections to unblock the bots
and O0 + debug codegen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168680 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 06:49:23 +00:00
Jakub Staszak
df22702db0 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168670 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:00:27 +00:00
Jakub Staszak
388ffa7f66 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:22:15 +00:00
NAKAMURA Takumi
a823f18af4 llvm/CodeGen: Remove empty files in r168659.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168663 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:21:50 +00:00
Jakub Staszak
07cde58fa0 Remove unused forward declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:16:37 +00:00
Jakub Staszak
af650354a1 Remove unused MachineLoopRanges analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168659 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:14:34 +00:00
Eric Christopher
4d26533234 Make comment names match function names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:41:57 +00:00
Eric Christopher
74802f7e43 Add in sections for the fission case (no change so incorrect) and
add a TODO for starting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168643 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:41:54 +00:00
Eric Christopher
8ba01175cc Reorder section output ordering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:13:58 +00:00
Eric Christopher
bdab800b02 Whitespace cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168637 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:13:51 +00:00
Chad Rosier
8d20b5f9ff Add an assertion to ensure freezeReservedRegs() is only ever called once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 23:37:07 +00:00
Chad Rosier
728aede2e9 Now that the X86 Maximal Stack Alignment Check pass has been removed (i.e.,
r168627), we no longer need to call the freezeReservedRegs() function a second
time.  Previously, this pass was conservatively adding the FP to the set of
reserved registers, requiring the second update to the reserved registers.
rdar://12719844

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168631 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 23:25:41 +00:00
Chad Rosier
216532ac0a Now that the X86 Maximal Stack Alignment Check pass has been removed (i.e.,
r168627), we no longer need to call the freezeReservedRegs() function a second
time.  Previously, this pass was conservatively adding the FP to the set of
reserved registers, requiring the second update to the reserved registers.
rdar://12719844

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168630 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 23:14:37 +00:00
Jakub Staszak
bb8ddc7e4f Don't use iterator after being erased.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 22:14:19 +00:00
Jakub Staszak
ec66ac5318 Remove unneeded #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 21:04:19 +00:00
Craig Topper
327e4cba09 Refactor to make helper method static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168557 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-25 08:08:58 +00:00
Craig Topper
c1aa638fff Remove duplicate check of LimitFloatPrecision. It was already checked earlier before IsExp10 could be set to true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168553 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-25 00:48:58 +00:00