Commit Graph

82 Commits

Author SHA1 Message Date
Lang Hames
6cc91e39c0 Oops. Renamed remaining MachineInstrIndex references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 04:31:31 +00:00
Lang Hames
cc3b0650f1 Renamed MachineInstrIndex to LiveIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 04:21:37 +00:00
Lang Hames
9647994e09 Removed static qualifier from a few index related methods. These methods may require a LiveIntervals instance in future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 20:14:17 +00:00
Lang Hames
8651125d28 Replaces uses of unsigned for indexes in LiveInterval and VNInfo with
a new class, MachineInstrIndex, which hides arithmetic details from
most clients. This is a step towards allowing the register allocator
to update/insert code during allocation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 20:41:11 +00:00
Chris Lattner
45cfe545ec Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 06:03:38 +00:00
Lang Hames
52c1afcaea Modified VNInfo. The "copy" member is now a union which holds the copy for a register interval, or the defining register for a stack interval. Access is via getCopy/setCopy and getReg/setReg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 23:43:28 +00:00
Dan Gohman
845012e6d3 Use setPreservesAll and setPreservesCFG in CodeGen passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 23:37:33 +00:00
Evan Cheng
378445303b Let callers decide the sub-register index on the def operand of rematerialized instructions.
Avoid remat'ing instructions whose def have sub-register indices for now. It's just really really hard to get all the cases right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 09:20:10 +00:00
Torok Edwin
f36892335b Fix assert(0) conversion, as suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 20:07:01 +00:00
Torok Edwin
7d696d8040 Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
and abort()/exit() -> llvm_report_error().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 13:10:19 +00:00
Lang Hames
ffd1326ff8 Improved tracking of value number kills. VN kills are now represented
as an (index,bool) pair. The bool flag records whether the kill is a
PHI kill or not. This code will be used to enable splitting of live
intervals containing PHI-kills.

A slight change to live interval weights introduced an extra spill
into lsr-code-insertion (outside the critical sections). The test 
condition has been updated to reflect this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 03:57:02 +00:00
Lang Hames
857c4e01f8 VNInfo cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:01:20 +00:00
Evan Cheng
c781a243a3 In some rare cases, the register allocator can spill registers but end up not utilizing registers at all. The fundamental problem is linearscan's backtracking can end up freeing more than one allocated registers. However, reloads and restores might be folded into uses / defs and freed registers might not be used at all.
VirtRegMap keeps track of allocations so it knows what's not used. As a horrible hack, the stack coloring can color spill slots with *free* registers. That is, it replace reload and spills with copies from and to the free register. It unfold instructions that load and store the spill slot and replace them with register using variants.

Not yet enabled. This is part 1. More coming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 18:32:42 +00:00
Bob Wilson
d9df501704 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 17:16:43 +00:00
Owen Anderson
696a1307ba Remove the "fast" cases for spill and restore point determination, as these were subtlely wrong in obscure cases. Patch the testcase
to account for this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:27:09 +00:00
Owen Anderson
420dd37326 Give the pre-alloc splitter access to the VirtRegMap. It doesn't do anything
useful with it at the moment, but it will in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14 21:40:05 +00:00
Owen Anderson
a2bfb54e4d (Hopefully) silence a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 08:23:20 +00:00
Owen Anderson
323c58d862 Be more careful about choosing restore points when doing restore folding. This fixes some subtle miscompilations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 07:19:18 +00:00
Owen Anderson
c93023a89e Add a restore folder, which shaves a dozen or so machineinstrs off oggenc. Update a testcase to check this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 08:52:31 +00:00
Owen Anderson
4cafbb58e2 Fix a crash in the pre-alloc splitter exposed by recent codegen changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65121 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 10:02:23 +00:00
Evan Cheng
4350eb86a7 Add TargetInstrInfo::isSafeToMoveRegisterClassDefs. It returns true if it's safe to move an instruction which defines a value in the register class. Replace pre-splitting specific IgnoreRegisterClassBarriers with this new hook.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 17:17:30 +00:00
Owen Anderson
5734c94ec2 Pre-alloc splitting needs to be more careful to avoid inserting spills/restores
between call frame setup/restore points.  Unfortunately, this regresses 
code size a bit, but at least it's correct now!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 05:58:41 +00:00
Owen Anderson
5b93f6fa82 MergeValueInto is too smart: it might choose to do the merge the opposite direction.
Live interval reconstruction needs to account for this, and scour its maps to
prevent dangling references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 22:42:01 +00:00
Evan Cheng
19a725851d Refactor PerformPHIConstruction, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 18:33:18 +00:00
Owen Anderson
4a6d13e8fb Fix test failures causes by my previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-01 08:41:54 +00:00
Owen Anderson
5caedc0f09 Fix an issue in PHI construction that was exposed by GCC 4.2 producing a different set iteration order for the reg_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-01 07:06:00 +00:00
Owen Anderson
3ef4549d9d Correct the algorithms for choosing spill and restore points so that we don't try to insert loads/stores between call frame setup and the actual call.
This fixes the last known failure for the pre-alloc-splitter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 22:13:06 +00:00
Owen Anderson
c0f3a0353c Fix an issue where restores could be inserted after a terminator instruction,
and an iterator invalidation issue.

FreeBench/pifft no longer miscompiles with these fixes!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 08:22:06 +00:00
Owen Anderson
4bfc209721 Comments are good. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 05:41:02 +00:00
Owen Anderson
45e6855ea2 Add support for aggressive load-use-store folding. This takes care of the
vast majority of code size regressions introduced by pre-alloc-splitting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 05:28:55 +00:00
Owen Anderson
26562de2ef Make the pre-split-limit option more useful by using a per-function counter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 05:01:15 +00:00
Owen Anderson
b4b8436381 Reapply r63025 and r63026, with fixes for the failing testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 21:57:31 +00:00
Bill Wendling
826f093517 Also revert r63206
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 21:30:17 +00:00
Bill Wendling
34b946b8fb Temporarily revert r63025 until the testsuite failures can be fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 21:27:03 +00:00
Owen Anderson
d7250517b0 Get rid of a bunch of dead code now that interval reconstruction is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 19:18:06 +00:00
Owen Anderson
8af1e761f8 Fix an issue where LiveIntervals was trying to be smart about removing kill
markers, and ended up foiling the interval reconstruction.

This allows us to turn on reconstruction in the pre alloc splitter, which
fixes a number of miscompilations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 19:12:06 +00:00
Evan Cheng
b964f33873 Silence a bogus compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 18:33:51 +00:00
Owen Anderson
32ca8657b8 Some cleanups. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 10:07:43 +00:00
Owen Anderson
9ce499ab36 Stage two of fixing pre-alloc-splitting's code size issues: filter out restores that are just
going to be re-spilled again.

This also helps performance.  Pre-alloc-splitting now seems to be an overall win on SPEC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 03:28:53 +00:00
Owen Anderson
956ec27a99 Add an initial pass at dead spill/restore removal for pre alloc splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 00:23:32 +00:00
Owen Anderson
d3be46214c I accidentally removed this check in an earlier commit, which cause breakage in the pre alloc splitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 08:18:03 +00:00
Owen Anderson
6cf7c390ec Be more aggressive about renumbering vregs after splitting them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 00:13:28 +00:00
Evan Cheng
04ee5a1d92 Change TargetInstrInfo::isMoveInstr to return source and destination sub-register indices as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62600 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 19:12:24 +00:00
Owen Anderson
e1762c9826 More two-address fixes. This gets lua working with join-creation enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 03:10:40 +00:00
Owen Anderson
200ee7f521 The phi construction algorithm used for interval reconstruction is complicated by
two address instructions.  We need to keep track of things we've processed AS USES
independetly of whether we've processed them as defs.

This fixes all known miscompilations when reconstruction is turned on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 07:53:32 +00:00
Owen Anderson
d0ed240e30 Get rid of sentinel insertion in interval reconstruction. It just masked the
problem, rather than fixing it.  The problem has now been fixed the right way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:32:26 +00:00
Owen Anderson
7d211e299f Get live interval reconstruction several steps closer to working.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 02:00:25 +00:00
Duncan Sands
2b7fc1ef53 Add braces, as suggested by a gcc warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-29 08:05:02 +00:00
Owen Anderson
d4f6fe55eb Fix up kill/dead marking in the new live interval reconstruction code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-28 23:35:13 +00:00
Owen Anderson
60d4f6ded2 Add prototype code for recomputing a live interval's ranges and valnos through recursive phi construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-28 21:48:48 +00:00