Commit Graph

397 Commits

Author SHA1 Message Date
Owen Anderson
a41e47afc1 Allow the fast-path spilling code to attempt folding, but still leaving out remat and splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 22:12:11 +00:00
Owen Anderson
712c9f0690 The fast-path still needs to set kill markers and spill/restore points as appropriate.
With this patch, all of MultiSource/Applications and all of SPEC2000/2006 pass with
the SimpleSpiller and this fast-path enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 20:09:52 +00:00
Owen Anderson
ae339babb2 Add a flag to enable the fast spilling path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54958 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 00:17:30 +00:00
Owen Anderson
1719731d3d Fix a few more bugs:
1) Assign stack slots to new temporaries.
  2) Don't insert an interval into the return vector more than once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 23:41:04 +00:00
Owen Anderson
9a03293145 Fix several bugs in the new fast-path:
1) Remove an incorrect assertion.
  2) Set the stack slot weight properly.
  3) Resize the VirtRegMap when needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54949 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 21:20:32 +00:00
Owen Anderson
133f10f9bd Clients of addIntervalForSpills expect the added intervals to be returned sorted by starting index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 19:52:22 +00:00
Owen Anderson
8dc2cbe793 Simplify the fast-patch interval spilling by using MachineRegisterInfo::reg_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 18:38:12 +00:00
Owen Anderson
d6664311ac Resurrect some ancient code to add spill ranges without attempting folding, remat, or splitting. This code has been updated to current APIs
in so far as it compiles and, in theory, works, but does not take advantage of recent advancements.  For instance, it could be improved by using
MachineRegisterInfo::use_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 18:05:32 +00:00
Owen Anderson
289983123b Expunge the last uses of std::map from LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 22:28:50 +00:00
Owen Anderson
20e2839cb9 Move r2iMap_ over to DenseMap from std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54765 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 22:08:30 +00:00
Owen Anderson
03857b29d8 Make the allocation of LiveIntervals explicit, rather than holding them in the r2iMap_ by value. This will prevent references to them from being invalidated
if the map is changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:49:13 +00:00
Owen Anderson
aa111080df Oops, didn't mean to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 20:58:38 +00:00
Owen Anderson
788d04152a Only remap each VNInfo once when doing renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:35:45 +00:00
Owen Anderson
912923925f Value numbers whose def index is a special sentinel value should not be remapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 17:42:47 +00:00
Owen Anderson
9382b9310f More fixes for corner cases when remapping live range indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:22:56 +00:00
Owen Anderson
a0c032f9b2 Don't decrement the BB remap when we don't need to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 21:15:44 +00:00
Dan Gohman
fed90b6d09 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 21:51:04 +00:00
Dan Gohman
0471a79f20 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 18:43:51 +00:00
Owen Anderson
0a7615af25 Revert my previous patch. In retrospect, this is completely the wrong way to fix this problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 23:06:59 +00:00
Owen Anderson
0c525ca72f Special cases are needed in renumbering when dealing with renumbering after a PHI has been removed. The interval previously defined
by the PHI needs to be extended to the beginning of its basic block, and the intervals that were inputs need to be trimmed to the end 
of their basic blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 22:32:01 +00:00
Owen Anderson
8d0cc0af5a Properly remap live ranges whose end indices are the end of the function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:07:13 +00:00
Owen Anderson
d7dcbecdbc Make the remapping of interval indices (particularly ending indices) more robust.
This is tricky business, and will probably take a few more iterations to get
the last kinks out of it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:50:48 +00:00
Dan Gohman
4c8f87038d Disable the new aggressive remat logic introduced in 54000; it causes some
regressions, such as PR2595. Also, there is a significant code-quality
issue in SPEC 464.h264ref and a few others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 15:08:37 +00:00
Dan Gohman
6d69ba8a69 Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow
constants to be rematerialized in PIC mode -- the extra indirection is a
complication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:02:30 +00:00
Owen Anderson
7fbad27cfb Enable the insertion of empty indices into LiveInterals, thereby making renumbering possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 21:37:49 +00:00
Owen Anderson
496bac5b08 Fix a compile-time regression introduced by my heuristic-changing patch. I forgot
to multiply the instruction count by a constant factor in a few places, which
caused the register allocator to require many more iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 19:47:27 +00:00
Owen Anderson
a1566f2e12 Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is 
not affected by inserting empty indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 22:46:49 +00:00
Evan Cheng
1ed9922794 Fix a memory leak in LiveIntervalAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 00:37:25 +00:00
Dan Gohman
2c3f7ae384 Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
Fix a leak that this turned up in LowerSubregs.cpp.
And, comment a leak in LiveIntervalAnalysis.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 23:49:46 +00:00
Evan Cheng
b9890ae3c3 Typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 02:22:07 +00:00
Evan Cheng
79a796c2b1 Fix PR2536: a nasty spiller bug. If a two-address instruction uses a register but the use portion of its live range is not part of its liveinterval, it must be defined by an implicit_def. In that case, do not spill the use. e.g.
8   %reg1024<def> = IMPLICIT_DEF
12  %reg1024<def> = INSERT_SUBREG %reg1024<kill>, %reg1025, 2

The live range [12, 14) are not part of the r1024 live interval since it's defined by an implicit def. It will not conflicts with live interval of r1025. Now suppose both registers are spilled, you can easily see a situation where both registers are reloaded before the INSERT_SUBREG and both target registers that would overlap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:56:02 +00:00
Evan Cheng
ef0732d25a - Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 07:35:43 +00:00
Dan Gohman
8e5f2c6f65 Pool-allocation for MachineInstrs, MachineBasicBlocks, and
MachineMemOperands. The pools are owned by MachineFunctions.

This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 23:14:23 +00:00
Evan Cheng
9f1c8317a4 - Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc.
- Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 09:09:37 +00:00
Owen Anderson
6b098dee28 Remember which MachineOperand we were processing, so we don't have to scan the list to find it again later.
This speeds up live intervals from 0.37s to 0.30s on instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 23:39:39 +00:00
Evan Cheng
c3417609ae Undo spill weight tweak. Need to investigate the performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 06:45:54 +00:00
Owen Anderson
29b039976f Revert my last patch, which was causing regression test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 05:29:34 +00:00
Evan Cheng
bdf34bc12b Minor spiller tweak to unfavor reload into load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:16:17 +00:00
Owen Anderson
6c5e561668 Insert empty slots into the instruction numbering in live intervals, so that we can more easily
add new instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 00:10:49 +00:00
Evan Cheng
f26e8557de Live-through live interval is [mbb start, mbb end+1].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 20:13:36 +00:00
Owen Anderson
31ec841be1 Remove special case handling of empty MBBs now that we assign indices to them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:32:40 +00:00
Owen Anderson
1fbb4545d4 Re-enable empty block indexing by default, since it doesn't seem to have any
impact on code quality or compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 16:58:24 +00:00
Owen Anderson
3557801289 Make indexing empty basic blocks an option for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 07:10:49 +00:00
Owen Anderson
8892b6f307 Assign indices to empty basic blocks. This will be necessary for StrongPHIElimination in the near future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:18:41 +00:00
Evan Cheng
9c3c221364 Refine stack slot interval weight computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 07:54:39 +00:00
Owen Anderson
c4dc132c8a Add a helper for constructing new live ranges that ended from an instruction to the end of its MBB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 17:15:43 +00:00
Evan Cheng
3f32d65912 Add a stack slot coloring pass. Not yet enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 09:18:41 +00:00
Owen Anderson
e3abb0a858 Correctly handle removed instructions at the beginning of MBBs when renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:36:36 +00:00
Owen Anderson
7eec0c2433 Make the renumbering correct in the face of deleted instructions that have been removed from the LiveIntervals maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 23:01:22 +00:00
Bill Wendling
ec58498dc9 Remove <iostream>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:29:39 +00:00