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

1234 Commits

Author SHA1 Message Date
Chris Lattner
52bdc9d978 Pull the LiveRange and LiveInterval classes out of LiveIntervals.h (which
will soon be renamed) into their own file.  The new file should not emit
DEBUG output or have other side effects.  The LiveInterval class also now
doesn't know whether its working on registers or some other thing.

In the future we will want to use the LiveInterval class and friends to do
stack packing.  In addition to a code simplification, this will allow us to
do it more easily.

llvm-svn: 15134
2004-07-23 17:49:16 +00:00
Chris Lattner
0ceb79ba34 Improve comments a bit
Use an explicit LiveRange class to represent ranges instead of an std::pair.
This is a minor cleanup, but is really intended to make a future patch simpler
and less invasive.

Alkis, could you please take a look at LiveInterval::liveAt?  I suspect that
you can add an operator<(unsigned) to LiveRange, allowing us to speed up the
upper_bound call by quite a bit (this would also apply to other callers of
upper/lower_bound).  I would do it myself, but I still don't understand that
crazy liveAt function, despite the comment. :)

Basically I would like to see this:
    LiveRange dummy(index, index+1);
    Ranges::const_iterator r = std::upper_bound(ranges.begin(),
                                                ranges.end(),
                                                dummy);

Turn into:
    Ranges::const_iterator r = std::upper_bound(ranges.begin(),
                                                ranges.end(),
                                                index);

llvm-svn: 15130
2004-07-23 08:24:23 +00:00
Chris Lattner
a894b79444 Update live intervals more accurately for PHI elim. This slightly reduces
the live intervals for some registers.

llvm-svn: 15125
2004-07-23 05:27:43 +00:00
Chris Lattner
e04cefc866 Force coallescing of live ranges that have a single definition, even if they
interfere.  Because these intervals have a single definition, and one of them
is a copy instruction, they are always safe to merge even if their lifetimes
interfere.  This slightly reduces the amount of spill code, for example on
252.eon, from:

 12837 spiller               - Number of loads added
  7604 spiller               - Number of stores added
  5842 spiller               - Number of register spills
 18155 liveintervals         - Number of identity moves eliminated after coalescing

to:

  12754 spiller               - Number of loads added
   7585 spiller               - Number of stores added
   5803 spiller               - Number of register spills
  18262 liveintervals         - Number of identity moves eliminated after coalescing

The much much bigger win would be to merge intervals with multiple definitions
(aka phi nodes) but this is not that day.

llvm-svn: 15124
2004-07-23 05:26:05 +00:00
Chris Lattner
9c326b6cc8 costmetic changes
llvm-svn: 15118
2004-07-22 23:05:12 +00:00
Chris Lattner
54f8932b3b Fix broken -debug printing
llvm-svn: 15115
2004-07-22 21:54:22 +00:00
Chris Lattner
0fbe7e1e60 The default has not been 'simple' for AGES!
llvm-svn: 15114
2004-07-22 21:46:02 +00:00
Chris Lattner
767638fe6d Make linear scan the default
llvm-svn: 15111
2004-07-22 18:42:00 +00:00
Alkis Evlogimenos
4b4712b58d Put variable name to a separate line.
llvm-svn: 15108
2004-07-22 15:30:33 +00:00
Misha Brukman
752cdcc2a5 Fix indentation and wrap code at 80 cols
llvm-svn: 15107
2004-07-22 15:26:23 +00:00
Alkis Evlogimenos
ba7fdf3568 Sorting is now handled by both linearscan and iterative scan so live
intervals need not be sorted anymore. Removing this redundant step
improves LiveIntervals running time by 5% on 176.gcc.

llvm-svn: 15106
2004-07-22 15:18:10 +00:00
Alkis Evlogimenos
717d6cd988 Fit to 80 columns.
llvm-svn: 15105
2004-07-22 14:29:31 +00:00
Alkis Evlogimenos
0292045897 Some compile time improvements resulting in a 1sec speedup in the 5sec
compilation of gcc:

* Use vectors instead of lists for the intervals sets
* Use a heap for the unhandled set to keep intervals always sorted and
  makes insertions back to the heap very fast (compared to scanning a
  list)

llvm-svn: 15103
2004-07-22 08:14:44 +00:00
Chris Lattner
21c0ddacf2 Remove extraneous punctuation
llvm-svn: 15098
2004-07-22 05:51:56 +00:00
Alkis Evlogimenos
1cae25921d Use reverse iterators when updating the vector, since scanning from
the end will reduce erase() runtimes.

llvm-svn: 15093
2004-07-22 02:16:53 +00:00
Chris Lattner
25dd6b0a24 That funny 2-address lowering pass can also cause multiple definitions,
fortunately, they are easy to handle if we know about them.  This patch fixes
some serious pessimization of code produced by the linscan register allocator.

llvm-svn: 15092
2004-07-22 00:04:14 +00:00
Chris Lattner
eb21652fba Minor cleanups
llvm-svn: 15091
2004-07-21 23:17:57 +00:00
Brian Gaeke
f18cdca667 These files don't need to include <iostream> since they include "Support/Debug.h".
llvm-svn: 15089
2004-07-21 20:50:33 +00:00
Alkis Evlogimenos
40d8d044fe Fix analysis name.
llvm-svn: 15078
2004-07-21 17:23:44 +00:00
Alkis Evlogimenos
183f8af791 Clear spilled list at once. Remove unused vector.
llvm-svn: 15073
2004-07-21 12:00:10 +00:00
Alkis Evlogimenos
c767432a26 Change std::list into a std::vector for IntervalSets. This reduces
compile time for 176.gcc from 5.6 secs to 4.7 secs.

llvm-svn: 15072
2004-07-21 09:46:55 +00:00
Alkis Evlogimenos
8a162136e1 Improve file comment.
llvm-svn: 15069
2004-07-21 08:28:39 +00:00
Alkis Evlogimenos
b5f60641f4 Add Iterative scan register allocator.
llvm-svn: 15068
2004-07-21 08:24:35 +00:00
Alkis Evlogimenos
75dbcf6d06 Linearscan is no longer experimental.
llvm-svn: 15067
2004-07-21 08:18:50 +00:00
Alkis Evlogimenos
cb3b2fc439 Add function to clear all virtual->physical mappings but not assigned
stack slots. This is in preparation for the iterative linear scan.

llvm-svn: 15032
2004-07-20 13:28:17 +00:00
Alkis Evlogimenos
89ae43ca19 Remove unneeded functor. LiveInterval has a < operator.
llvm-svn: 15031
2004-07-20 10:20:03 +00:00
Alkis Evlogimenos
25fb592aa6 Remove dead code.
llvm-svn: 15011
2004-07-19 23:35:55 +00:00
Chris Lattner
c07b7fff45 Fix a bug that occurs when the last instruction in a range is dead
llvm-svn: 15005
2004-07-19 15:16:53 +00:00
Chris Lattner
bc53c119ac When joining intervals, join intervals in deeply nested loops first. This
is a simple change, but seems to improve code a little.  For example, on
256.bzip2, we went from 75.0s -> 73.33s (2% speedup).

llvm-svn: 15004
2004-07-19 14:40:29 +00:00
Chris Lattner
997f36e53f Split joinIntervals into two methods
llvm-svn: 15003
2004-07-19 14:08:10 +00:00
Chris Lattner
22728e2f27 There is no need to store the MBB along with the MI any more, we can now
ask instructions for their parent.

llvm-svn: 14998
2004-07-19 07:04:55 +00:00
Chris Lattner
6c34920110 Simplify the interface to LiveVariables::addVirtualRegister(Killed|Dead)
llvm-svn: 14997
2004-07-19 06:55:21 +00:00
Chris Lattner
53fa752649 Remove the DefBlock element of VarInfo. DefBlock is always DefInst->getParent()
llvm-svn: 14996
2004-07-19 06:26:50 +00:00
Chris Lattner
e7104f6f7b Two changes, both very significant:
* vreg <-> vreg joining now works, enable it unconditionally when joining
  is enabled (which is the default).
* Fix a serious pessimization of spill code where we were saying that a
  spilled DEF operand was live into the subsequent instruction.  This allows
  for substantially better code when spilling starts to happen.

llvm-svn: 14993
2004-07-19 05:55:50 +00:00
Chris Lattner
70d06b5c25 See comments. The live intervals were not coming out of the spiller in sorted
order, causing the inactive list in the linearscan list to get unsorted, which
basically fuxored everything up severely.

These seems to fix the joiner, so with more testing I will enable it by default.

llvm-svn: 14992
2004-07-19 05:15:10 +00:00
Chris Lattner
f5bdaf62f8 Fix assertion to not dereference end!
llvm-svn: 14991
2004-07-19 05:02:09 +00:00
Chris Lattner
42b44d3d1c Add some asserts that the list of intervals returned by addIntervalsForSpills
is sorted.  This is not the case currently, which is causing no end of
problems.

llvm-svn: 14990
2004-07-19 04:47:36 +00:00
Chris Lattner
10caeead75 remove the mbbi2mbbMap_, which was just keeping track of mbb order anyway.
Heavily refactor handleVirtualRegisterDef, adding comments and making it more
efficient.  It is also much easier to follow and convince ones self that it is
correct :)

Add -debug output to the joine, showing the result of joining the intervals.

llvm-svn: 14989
2004-07-19 02:15:56 +00:00
Chris Lattner
caba8651cd fill comment to 80 cols
remove map that is not needed

llvm-svn: 14988
2004-07-19 02:13:59 +00:00
Chris Lattner
a2b1dbead8 It looks like physref->virtreg joining is working fine. Enable it by default
but make virtreg->virtreg joining stay off by default

llvm-svn: 14916
2004-07-17 21:51:25 +00:00
Chris Lattner
c014005d53 Fix IA64 compatibility
llvm-svn: 14866
2004-07-16 00:06:01 +00:00
Chris Lattner
53c9460cde Use new macro
llvm-svn: 14865
2004-07-16 00:04:54 +00:00
Chris Lattner
47c6a06211 Fix for PR341
llvm-svn: 14845
2004-07-15 02:40:04 +00:00
Chris Lattner
456583c52c Add checks to ensure that there are no unreachable blocks in the function
llvm-svn: 14725
2004-07-09 16:44:37 +00:00
Misha Brukman
abbe59490b * Doxygenify comments
* Fix spacing, grammar in comment
* Make code layout consistent
* Wrap code at 80 cols
* Delete spurious blank lines

No functional changes.

llvm-svn: 14721
2004-07-09 14:45:17 +00:00
Alkis Evlogimenos
d8e8396e33 Fix typo.
llvm-svn: 14720
2004-07-09 11:25:27 +00:00
Alkis Evlogimenos
57839c592a Improve code comments.
llvm-svn: 14719
2004-07-09 11:10:00 +00:00
Alkis Evlogimenos
e7e19f771f Add viewCFG() and viewCFGOnly() APIs.
llvm-svn: 14679
2004-07-08 00:47:58 +00:00
Alkis Evlogimenos
51dda289a7 Disable coalescing.
llvm-svn: 14655
2004-07-07 02:03:12 +00:00
Alkis Evlogimenos
e0c8d140a9 Do not crash when joining two intervals of registers of different
classes: just ignore that move. Thanks to Vladimir Prus who found the
bug!

llvm-svn: 14644
2004-07-06 16:03:21 +00:00
Chris Lattner
d450ccbc91 Fix a bug in the unreachable block elim pass. Dropping all references on a
basic block clear()'s all of the operands lists, including phis.  This
caused removePredecessor to get confused later.  Because of this, we just
nuke (without prejudice) PHI nodes in unreachable blocks.

llvm-svn: 14635
2004-07-06 06:36:11 +00:00
Alkis Evlogimenos
69ea68d4b6 Correctly compute the ration of iterations/#intervals.
llvm-svn: 14626
2004-07-04 17:23:35 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Alkis Evlogimenos
8ff35c1ce8 Add efficiency statistic.
llvm-svn: 14590
2004-07-04 07:59:06 +00:00
Chris Lattner
5b96ed7d1b Revert patches 1.79 and 1.80 which had to do with dead MBB's. Now that they
don't exist, we don't have to pretend to handle them.

llvm-svn: 14567
2004-07-02 05:52:23 +00:00
Chris Lattner
1e20aefbcb Add a trivially simple pass to delete unreachable blocks from the CFG. This
pass is required to paper over problems in the code generator (primarily
live variables and its clients) which doesn't really have any well defined
semantics for unreachable code.

The proper solution to this problem is to have instruction selectors not
select blocks that are unreachable.  Until we have a instruction selection
framework available for use, however, we can't expect all instruction
selector writers to do this.  Until then, this pass should be used.

llvm-svn: 14563
2004-07-02 05:46:10 +00:00
Chris Lattner
91662f48b8 Make sure that we destroy the MBB's, with all of their instructions, before
any other data structures

llvm-svn: 14524
2004-07-01 06:29:07 +00:00
Chris Lattner
93bf3a5985 Now that MachineFunction/MachineBasicBlock keep a mapping of blocks to ID #'s
use them instead of a local LiveVariables numbering

llvm-svn: 14523
2004-07-01 06:15:32 +00:00
Chris Lattner
43e765d61c Change MBB autonumber a bit to get the reverse mapping as well as a forward
mapping

llvm-svn: 14521
2004-07-01 06:02:27 +00:00
Chris Lattner
a2481b7e82 Instance var no longer exists
llvm-svn: 14520
2004-07-01 06:02:07 +00:00
Chris Lattner
ae4f21e30a Start using MBB numbers directly instead of going through the live variables
map.

llvm-svn: 14518
2004-07-01 04:29:47 +00:00
Chris Lattner
0bb956cda7 Instead of building a private numbering of MBB's use brg's nifty auto-numbering.
Also convert df_iterator -> df_ext_iterator for subsequent stuff I'm doing.

llvm-svn: 14517
2004-07-01 04:24:29 +00:00
Chris Lattner
41c3157c70 In line with the previous patch, do not assert out if analyzing a dead basic block.
llvm-svn: 14475
2004-06-29 07:16:23 +00:00
Chris Lattner
27c176234c Do not dereference end iterators. It hurts when you do that.
llvm-svn: 14474
2004-06-29 06:56:51 +00:00
Chris Lattner
fd25f66f50 Do not find these ugly sparc-specific objects by using the annotation API on
instructions.  Instead, keep a map of instructions -> MCFI objects in the
already sparc-specific class MachineFunctionInfo.  This will slow down the
sparc backend a bit, but it does not penalize the rest of LLVM!

llvm-svn: 14438
2004-06-27 18:52:17 +00:00
Tanya Lattner
da38dc5180 Made a fix so that you can print out MachineInstrs that belong to a MachineBasicBlock that is not yet attached to a MachineFunction. This change includes changing the third operand (TargetMachine) to a pointer for the MachineInstr::print function.
llvm-svn: 14389
2004-06-25 00:13:11 +00:00
Misha Brukman
0a98455ab9 Convert tabs to spaces.
llvm-svn: 14373
2004-06-24 21:31:16 +00:00
Misha Brukman
f1da4cac4b Making an archive version of the CodeGen library is unnecessary if we just
move InstructionLowering itself.

llvm-svn: 14324
2004-06-22 17:52:30 +00:00
Misha Brukman
261c779bd6 Provide archive version of CodeGen library (for those tools that only need
IntrinsicLowering, for instance).

llvm-svn: 14323
2004-06-22 17:28:43 +00:00
Chris Lattner
6be1c456a8 Rename Interval class to LiveInterval to avoid conflicting with the already
existing llvm::Interval class.

Patch contributed by Vladimir Prus!
http://mail.cs.uiuc.edu/pipermail/llvmbugs/2004-June/000710.html

llvm-svn: 14281
2004-06-21 13:10:56 +00:00
Chris Lattner
cc465361d9 Move the IntrinsicLowering header into the CodeGen directory, as per PR346
llvm-svn: 14266
2004-06-20 07:49:54 +00:00
Brian Gaeke
6f6eb93de3 Make debugging dumps w/ multiple MachineBBs for a given LLVM BB readable.
llvm-svn: 14205
2004-06-17 22:26:53 +00:00
Chris Lattner
0cd29ae2cd Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner
1b8f37597d Fix a recent regression in Applications/sgefa that Alkis pointed out to me.
The vector may actually be empty if the register that we are marking as
recently used is not actually allocatable.  This happens for physical registers
that are not allocatable, like the ST(x) registers on X86.

llvm-svn: 14195
2004-06-16 06:57:29 +00:00
Chris Lattner
84269aa91e Fix fallout from getOffsetOfLocalArea() being negated. Debugging dumps were being
printed incorrectly, and we were reserving 8 extra bytes of stack space for functions
on X86.

llvm-svn: 14152
2004-06-11 06:37:11 +00:00
Chris Lattner
71f351ddf9 Fix the prolog epilog code inserter to match the documentation and support
targets whose stack grows up.

Patch contributed by Vladimir Prus

llvm-svn: 14111
2004-06-10 06:23:35 +00:00
Chris Lattner
a764d77ed3 Oops, this was not to go in
llvm-svn: 13958
2004-06-02 06:06:45 +00:00
Chris Lattner
ee2687a351 Adjust to the new TargetMachine interface
llvm-svn: 13957
2004-06-02 06:06:20 +00:00
Chris Lattner
0046ea7105 Adjust to new TargetMachine interface
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Chris Lattner
1dbe919e91 Inline findOptimalStorageSize into it's caller, both of which are sparc specific
llvm-svn: 13955
2004-06-02 05:56:52 +00:00
Chris Lattner
7d6b37af05 Finegrainify namespacification
llvm-svn: 13948
2004-06-02 04:28:06 +00:00
Chris Lattner
98a6bb89cf Fix a trivial but blatant bug
llvm-svn: 13947
2004-06-02 03:57:43 +00:00
Alkis Evlogimenos
f410424283 Pull Interval class out of LiveIntervals.
llvm-svn: 13910
2004-05-30 07:46:27 +00:00
Alkis Evlogimenos
2598a63586 When spilling an register, introduce a new temporary for each of its
spills. This allows for more flexibility when allocating registers for
spill code.

llvm-svn: 13907
2004-05-30 07:24:39 +00:00
Brian Gaeke
2281858cf6 Fix typo in head-of-file comment.
llvm-svn: 13903
2004-05-30 03:33:48 +00:00
Alkis Evlogimenos
516e16441b Add method to assign stack slot to virtual register without creating a
new one.

llvm-svn: 13895
2004-05-29 20:38:05 +00:00
Alkis Evlogimenos
c5923ac8b1 Add grow() member that grows the maps when the number of virtual
registers in the function has changed.

llvm-svn: 13893
2004-05-29 19:03:29 +00:00
Alkis Evlogimenos
d50a5109ff Remove defs vector from live intervals.
llvm-svn: 13892
2004-05-29 16:18:57 +00:00
Tanya Lattner
a275dfcce4 updates to ModuloSched
llvm-svn: 13881
2004-05-28 20:14:12 +00:00
Tanya Lattner
8c5d9dcc42 Adding scheduling class.
llvm-svn: 13783
2004-05-26 06:27:36 +00:00
Tanya Lattner
bd1298d574 Updating my cvs versions. THis is still in progress and much will be changed.
llvm-svn: 13782
2004-05-26 06:27:18 +00:00
Tanya Lattner
7cf16701f7 Moved MachineBasicBlock deconstructor to cpp file and removed it from LeakDetector to fix memory leak bug.
llvm-svn: 13718
2004-05-24 07:14:35 +00:00
Tanya Lattner
aabaaec037 Added MachineFunction parent* to MachineBasicBlock. Customized ilist template
to set the parent when a MachineBasicBlock is added to a MachineFunction.

llvm-svn: 13716
2004-05-24 06:11:51 +00:00
Chris Lattner
f38d51ea42 Eliminate an explicit use of the LLVM basic block, using getParent instead,
which simplifies the code

llvm-svn: 13707
2004-05-24 03:44:52 +00:00
Tanya Lattner
55477a5af1 Changed clone to be const.
Changed copy constructor to set parent, prev, and next pointers to null.

llvm-svn: 13706
2004-05-24 03:14:18 +00:00
Tanya Lattner
e755fc6689 Fixed up my changes to add support for cloning Machine Instructions.
llvm-svn: 13665
2004-05-23 20:58:02 +00:00
Tanya Lattner
2848065a29 Adding support to clone MachineInstr
llvm-svn: 13661
2004-05-23 19:35:12 +00:00
Chris Lattner
f29acd5214 Fix a really nasty bug from my changes on Monday to PHIElim. These changes
broke obsequi and a lot of other things.  It all boiled down to MBB being
overloaded in an inner scope and me confusing it with the one in the outer
scope.  Ugh!

llvm-svn: 13517
2004-05-12 21:47:57 +00:00
Brian Gaeke
79c7de0723 Start NextMBBNumber out at zero.
llvm-svn: 13515
2004-05-12 21:35:23 +00:00
Brian Gaeke
6009468edd Add non-const MachineBasicBlock::getParent() accessor method.
MBBs start out as #-1. When a MBB is added to a MachineFunction, it
gets the next available unique MBB number. If it is removed from a
MachineFunction, it goes back to being #-1.

llvm-svn: 13514
2004-05-12 21:35:22 +00:00
Chris Lattner
279d8e8e2d Switch this from using an std::map to using a DenseMap. This speeds up
phi-elimination from 0.6 to 0.54s on kc++.

llvm-svn: 13454
2004-05-10 19:17:36 +00:00
Chris Lattner
3fb5488b5e Use a new VRegPHIUseCount to compute uses of PHI values by other phi values
in the basic block being processed.  This fixes PhiElimination on kimwitu++
from taking 105s to taking a much more reasonable 0.6s (in a debug build).

llvm-svn: 13453
2004-05-10 19:06:37 +00:00
Chris Lattner
8b57a31ff4 Now that we use an ilist of machine instructions, iterators are more robust
than before.  Because this is the case, we can compute the first non-phi
instruction once when de-phi'ing a block.  This shaves ~4s off of
phielimination of _Z7yyparsev in kimwitu++ from 109s -> 105s.  There are
still much more important gains to come.

llvm-svn: 13452
2004-05-10 18:47:18 +00:00
Chris Lattner
b37490a331 Patch to fix PR337. Make sure to mark all aliased physical registers as used
when we see a read of a register.  This is important in cases like:

AL = ...
AH = ...

   = AX

The read of AX must make both the AL and AH defs live until the use.

llvm-svn: 13444
2004-05-10 05:12:43 +00:00
Tanya Lattner
57339f67d6 Updating my versions of ModuloScheduling in cvs. Still not complete.
llvm-svn: 13424
2004-05-08 16:12:10 +00:00
Alkis Evlogimenos
76be543a64 Add required header
llvm-svn: 13417
2004-05-08 03:50:03 +00:00
Alkis Evlogimenos
6022169db7 Remove unneeded header
llvm-svn: 13416
2004-05-08 03:49:35 +00:00
Chris Lattner
5f18bec9e6 numeric_limits::infinity() apparently does not work on all systems. As a
workaround, use the C HUGE_VAL macro instead.

llvm-svn: 13377
2004-05-06 16:25:59 +00:00
Chris Lattner
c09a94de9e Operate on the Machine CFG instead of on the LLVM CFG
llvm-svn: 13302
2004-05-01 21:24:39 +00:00
Chris Lattner
769668c09a Stop LiveVariables from using BasicBlocks as part of the mapping, instead
use MachineBasicBlocks.  To do this, we traverse the Machine CFG instead of
the LLVM CFG, which is also *MUCH* more efficient by having fewer levels of
indirections and mappings.

llvm-svn: 13301
2004-05-01 21:24:24 +00:00
Brian Gaeke
1b07a2282a Include SparcV9RegInfo.h instead of TargetRegInfo.h. This serves as a bit of
documentation that this module needs to be made independent of the
register file description of the current target.

llvm-svn: 13125
2004-04-23 18:15:46 +00:00
Brian Gaeke
bc25b3b28a Implement emitWordAt() for the debug emitter and the file printer emitter. (I
am not so sure about the file printer emitter, but the debug emitter change
should be harmless.)

llvm-svn: 13117
2004-04-23 17:11:13 +00:00
Alkis Evlogimenos
40d8a6802b Fix bug introduced in previous commit.
llvm-svn: 12872
2004-04-12 20:26:39 +00:00
Alkis Evlogimenos
38984637d9 Correctly compute spill weights
llvm-svn: 12869
2004-04-12 17:39:20 +00:00
Alkis Evlogimenos
bb422833e4 Print def lists a bit more compactly
llvm-svn: 12866
2004-04-12 15:57:58 +00:00
Alkis Evlogimenos
f66a23d573 Add definition list to each live interval.
llvm-svn: 12791
2004-04-09 18:07:57 +00:00
Chris Lattner
bfe4dd0f90 MBB::remove should not modify the iterator passed in
llvm-svn: 12572
2004-03-31 21:59:59 +00:00
Chris Lattner
2cc4a29665 MachineBasicBlock::remove should not modify the iterator passed in
llvm-svn: 12571
2004-03-31 21:59:29 +00:00
Alkis Evlogimenos
45cb0b871d Correctly update LiveVariables when an instruction changes
llvm-svn: 12561
2004-03-30 22:44:39 +00:00
Brian Gaeke
27be9eb265 Change how the beginnings and ends of MachineFunctions are printed. Get
rid of the funny cast.

llvm-svn: 12537
2004-03-29 21:58:31 +00:00
Alkis Evlogimenos
81c6957eab Make the set of fixed (preallocated) intervals be a fixed superset of
unhandled + handled. So unhandled is now including all fixed intervals
and fixed intervals never changes when processing a function.

llvm-svn: 12462
2004-03-17 00:48:59 +00:00
Chris Lattner
5541c82383 Fix PR294
llvm-svn: 12425
2004-03-16 01:45:55 +00:00
Alkis Evlogimenos
ff9482b664 Change MRegisterInfo::foldMemoryOperand to return the folded
instruction to make the API more flexible.

llvm-svn: 12386
2004-03-14 07:19:51 +00:00
Alkis Evlogimenos
0e0433a791 Spill explicit physical register defs as well.
llvm-svn: 12260
2004-03-09 08:35:13 +00:00
Alkis Evlogimenos
02e8f14c6a As I wrote in the docs, simple is the default spiller :-)
llvm-svn: 12189
2004-03-06 23:08:44 +00:00
Alkis Evlogimenos
467364b706 Add simple spiller.
llvm-svn: 12188
2004-03-06 22:38:29 +00:00
Brian Gaeke
aa96ff7926 Make MachineOperand's value named 'contents'. Make really, really sure
it is always completely initialized and copied.
Also, fix up many comments and asserts.

llvm-svn: 12100
2004-03-03 19:07:27 +00:00
Alkis Evlogimenos
c4ad8080f7 Add a spiller option to llc. A simple spiller will come soon. When we get CFG in the machine code represenation a global spiller will also be possible. Also document the linear scan register allocator but mark it as experimental for now.
llvm-svn: 12062
2004-03-01 23:18:15 +00:00
Alkis Evlogimenos
64e76a0d43 Add the long awaited memory operand folding support for linear scan
llvm-svn: 12058
2004-03-01 20:05:10 +00:00
Brian Gaeke
b78f8498f0 TargetCacheInfo has been removed; its only uses were to propagate a constant
(16) into certain areas of the SPARC V9 back-end. I'm fairly sure the US IIIi's
dcache has 32-byte lines, so I'm not sure where the 16 came from. However, in
the interest of not breaking things any more than they already are, I'm going
to leave the constant alone.

llvm-svn: 12043
2004-03-01 06:43:29 +00:00
Tanya Lattner
27c08f11bf Adding new Modulo Scheduling graph files.
llvm-svn: 12031
2004-03-01 02:50:57 +00:00
Tanya Lattner
55de04447c Removing old graph files with new graph files that I wrote. Updated ModuloScheduling pass, but still in progress.
llvm-svn: 12030
2004-03-01 02:50:01 +00:00
Chris Lattner
33b5dd0463 Add an assert
llvm-svn: 12010
2004-02-29 22:01:51 +00:00
Chris Lattner
37418d74a1 Add back #include I messed up
llvm-svn: 12009
2004-02-29 21:40:53 +00:00
Chris Lattner
b82a16f3a5 Urg, forgot to check this in.
llvm-svn: 12007
2004-02-29 21:03:08 +00:00
Chris Lattner
fe38629411 Move the private MachineInstrAnnot.h into a private directory.
llvm-svn: 12003
2004-02-29 19:12:51 +00:00
Chris Lattner
b73a182845 Remove use of an ugly header
llvm-svn: 12002
2004-02-29 19:04:31 +00:00
Chris Lattner
0acd73e11f Move methods out of .h file
llvm-svn: 12001
2004-02-29 19:02:39 +00:00
Chris Lattner
b5f0e162c7 Eliminate the distinction between "real" and "unreal" instructions
llvm-svn: 11986
2004-02-29 06:31:16 +00:00
Chris Lattner
8b7ac81d2e int64_t -> int
llvm-svn: 11977
2004-02-29 05:07:02 +00:00
Alkis Evlogimenos
ddfd27ff97 Rename member function to be consistent with the rest.
llvm-svn: 11898
2004-02-27 06:11:15 +00:00
Alkis Evlogimenos
63fda9c474 Make spiller push stores right after the definition of a register so
that they are as far away from the loads as possible.

llvm-svn: 11895
2004-02-27 04:51:35 +00:00
Alkis Evlogimenos
3093de5bfb Fix crash caused by passing register 0 to
MRegisterInfo::isPhysicalRegister().

llvm-svn: 11894
2004-02-27 01:52:34 +00:00
Alkis Evlogimenos
cff0fc180c Clear maps right after basic block is processed.
llvm-svn: 11892
2004-02-26 23:22:23 +00:00
Alkis Evlogimenos
b15631fcfa Uncomment assertions that register# != 0 on calls to
MRegisterInfo::is{Physical,Virtual}Register. Apply appropriate fixes
to relevant files.

llvm-svn: 11882
2004-02-26 22:00:20 +00:00
Chris Lattner
ac94c441b6 No need to clear the map here, it will always be empty
llvm-svn: 11868
2004-02-26 05:21:21 +00:00
Alkis Evlogimenos
af42cbf42f Fix bugs found with recent addition of assertions in
MRegisterInfo::is{Physical,Virtual}Register.

llvm-svn: 11849
2004-02-25 23:21:52 +00:00
Brian Gaeke
4f0a829a68 Great sparc renaming fallout IV: Sparc --> SparcV9.
llvm-svn: 11844
2004-02-25 22:09:36 +00:00
Alkis Evlogimenos
2caa729f02 Remove asssert since it is breaking cases that it shouldn't.
llvm-svn: 11841
2004-02-25 22:01:06 +00:00
Alkis Evlogimenos
f1516015af Add DenseMap template and actually use it for for mapping virtual regs
to objects.

llvm-svn: 11840
2004-02-25 21:55:45 +00:00
Chris Lattner
ccae3f6d60 Add an assertion
llvm-svn: 11830
2004-02-25 19:37:44 +00:00
Brian Gaeke
eae0364189 FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
llvm-svn: 11804
2004-02-24 19:46:00 +00:00
Alkis Evlogimenos
6d7150e9bb Move machine code rewriter and spiller outside the register
allocator.

The implementation is completely rewritten and now employs several
optimizations not exercised before. For example for 164.gzip we have
997 loads and 699 stores vs the 1221 loads and 880 stores we have
before.

llvm-svn: 11798
2004-02-24 08:58:30 +00:00
Alkis Evlogimenos
042f01039b Add predicates for checking if a virtual register has a physical
register mapping or a stack slot mapping.

llvm-svn: 11795
2004-02-24 06:30:36 +00:00
Alkis Evlogimenos
0d0db88889 Make enum private as it is an implementation detail.
llvm-svn: 11782
2004-02-23 23:49:40 +00:00
Alkis Evlogimenos
9344a740be Remove '4Virt' from member function names as it is obvious.
llvm-svn: 11781
2004-02-23 23:47:10 +00:00
Alkis Evlogimenos
d192266264 Refactor VirtRegMap out of RegAllocLinearScan as the first part of bug
251 (providing a generic machine code rewriter/spiller).

llvm-svn: 11780
2004-02-23 23:08:11 +00:00
Alkis Evlogimenos
34f28e5d3f Add number of spilled registers statistic.
llvm-svn: 11759
2004-02-23 18:45:32 +00:00
Chris Lattner
82e1a3657d Fix bugs in finegrainification
llvm-svn: 11758
2004-02-23 18:40:08 +00:00
Chris Lattner
1bf9dde4a1 Finegrainify namespacification
llvm-svn: 11757
2004-02-23 18:38:20 +00:00
Alkis Evlogimenos
82a1d7d30e Use MachineBasicBlock::getParent().
llvm-svn: 11756
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
2863fbd178 Remove implementation of default constructor as it is useless now.
llvm-svn: 11755
2004-02-23 18:28:35 +00:00
Alkis Evlogimenos
9b103024ef Refactor rewinding code for finding the first terminator of a basic
block into MachineBasicBlock::getFirstTerminator().

This also fixes a bug in the implementation of the above in both
RegAllocLocal and InstrSched, where instructions where added after the
terminator if the basic block's only instruction was a terminator (it
shouldn't matter for RegAllocLocal since this case never occurs in
practice).

llvm-svn: 11748
2004-02-23 18:14:48 +00:00
Alkis Evlogimenos
50598d1135 Improved PhysRegTracker interface. RegAlloc lazily allocates the register tracker using a std::auto_ptr
llvm-svn: 11738
2004-02-23 06:10:13 +00:00
Alkis Evlogimenos
99af6ca36b Simplify iterator usage now that we have next(). Also don't pass iterators by reference now that MachineInstr* are in an ilist
llvm-svn: 11732
2004-02-23 04:12:30 +00:00
Alkis Evlogimenos
976f485826 Some code cleanups from Chris
llvm-svn: 11724
2004-02-23 01:57:39 +00:00
Alkis Evlogimenos
1525e120a6 Fix comments in PhysRegTracker and rename isPhysRegAvail to isRegAvail to be consistent with the other two
llvm-svn: 11723
2004-02-23 01:25:05 +00:00
Alkis Evlogimenos
ee3ef42726 Move LiveIntervals.h up to be the first included header
llvm-svn: 11721
2004-02-23 01:01:21 +00:00
Alkis Evlogimenos
ba2b9aec71 Pull PhysRegTracker out of RegAllocLinearScan as it can be used by other allocators as well
llvm-svn: 11720
2004-02-23 00:53:31 +00:00
Alkis Evlogimenos
850bd0819f Move LiveIntervals.h to lib/CodeGen since it shouldn't be exposed to other parts of the compiler
llvm-svn: 11719
2004-02-23 00:50:15 +00:00
Chris Lattner
5485375e5d Another bug fix for empty MBB's
llvm-svn: 11716
2004-02-22 19:37:31 +00:00
Chris Lattner
56a7886c8a Fix a bug where we were implicitly assuming that there would be at least
one terminator instruction in each basic block.

llvm-svn: 11714
2004-02-22 19:08:15 +00:00
Alkis Evlogimenos
ba33a0ab9b Print basic block boundaries in machine instruction debug output.
llvm-svn: 11704
2004-02-22 05:46:04 +00:00
Alkis Evlogimenos
32d12d31ae Abstract merging of ranges away from number of slots per instruction.
Also make it less aggressive as the current implementation breaks in
some cases.

llvm-svn: 11696
2004-02-22 04:05:13 +00:00
Alkis Evlogimenos
e39c21cc93 Make 'fold' statistic's description the same in both allocators.
llvm-svn: 11687
2004-02-21 18:07:33 +00:00
Alkis Evlogimenos
43431e117e Some more statistics improvements.
llvm-svn: 11676
2004-02-20 20:53:26 +00:00
Alkis Evlogimenos
6d57ed784f Disambiguate statistic descriptions.
llvm-svn: 11675
2004-02-20 20:46:49 +00:00
Alkis Evlogimenos
70f547d06e Rename statistic and add another one.
llvm-svn: 11674
2004-02-20 20:43:08 +00:00
Alkis Evlogimenos
168e4bf455 Fix crash in debug output.
llvm-svn: 11659
2004-02-20 06:41:12 +00:00
Alkis Evlogimenos
16744f2860 Fix instruction numbering in debug output.
llvm-svn: 11655
2004-02-20 06:29:51 +00:00
Alkis Evlogimenos
f32239a5c6 Too many changes in one commit:
1. LiveIntervals now implement a 4 slot per instruction model. Load,
   Use, Def and a Store slot. This is required in order to correctly
   represent caller saved register clobbering on function calls,
   register reuse in the same instruction (def resues last use) and
   also spill code added later by the allocator. The previous
   representation (2 slots per instruction) was insufficient and as a
   result was causing subtle bugs.

2. Fixes in spill code generation. This was the major cause of
   failures in the test suite.

3. Linear scan now has core support for folding memory operands. This
   is untested and not enabled (the live interval update function does
   not attempt to fold loads/stores in instructions).

4. Lots of improvements in the debugging output of both live intervals
   and linear scan. Give it a try... it is beautiful :-)

In summary the above fixes all the issues with the recent reserved
register elimination changes and get the allocator very close to the
next big step: folding memory operands.

llvm-svn: 11654
2004-02-20 06:15:40 +00:00
Alkis Evlogimenos
eed4727191 Fix RA::verifyAssignment()
llvm-svn: 11629
2004-02-19 19:24:17 +00:00
Chris Lattner
c37073f249 Fix problem fusing spill code into instructions: we didn't update the live
variable information to take into account the change of instruction
address.

llvm-svn: 11628
2004-02-19 18:34:02 +00:00
Chris Lattner
266206caed Fix an iterator invalidation problem. :(
llvm-svn: 11627
2004-02-19 18:32:29 +00:00
Chris Lattner
6b0030105e Add method to update livevar when an instruction moves
llvm-svn: 11625
2004-02-19 18:28:02 +00:00
Chris Lattner
8a9be6b652 Fix a __LONG__ term annoyance of mine: symbolic registers weren't being printed
by operator<< on MachineInstr's, and looking up what register "24" is all of the
time was greatly annoying.

llvm-svn: 11623
2004-02-19 16:17:08 +00:00
Chris Lattner
436ab13009 Add a MachineBasicBlock::getParent() method
llvm-svn: 11622
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
68f40cbfd3 Rename reloads/spills to loads/stores.
llvm-svn: 11619
2004-02-19 06:19:09 +00:00
Alkis Evlogimenos
310f641c9c Implement assignment correctness verification.
llvm-svn: 11609
2004-02-18 23:15:23 +00:00
Chris Lattner
e672426e5d Eliminate operator[] is deprecated warnings
llvm-svn: 11578
2004-02-18 16:43:51 +00:00
Chris Lattner
8acab89631 Fix deprecated operator[] warnings
llvm-svn: 11577
2004-02-18 16:38:18 +00:00
Alkis Evlogimenos
c394f7803b Be more agressive when joining ranges.
llvm-svn: 11575
2004-02-18 04:38:37 +00:00
Alkis Evlogimenos
5c90efed55 Fix overly conservative spill interval computation.
llvm-svn: 11574
2004-02-18 03:35:38 +00:00
Alkis Evlogimenos
7290ef1f5c Beautify debug output.
llvm-svn: 11573
2004-02-18 00:35:06 +00:00
Chris Lattner
ea22a3de13 Remove the -disable-kill option. The register allocator is buggy with it,
and it was only for debugging in the first place.

llvm-svn: 11557
2004-02-17 17:49:10 +00:00
Chris Lattner
a4e0020e54 Add support to the local allocator for fusing spill code into the instructions
that need them.  This is very useful on CISCy targets like the X86 because it
reduces the total spill pressure, and makes better use of it's (large)
instruction set.  Though the X86 backend doesn't know how to rewrite many
instructions yet, this already makes a substantial difference on 176.gcc for
example:

Before:
Time:
   8.0099 ( 31.2%)   0.0100 ( 12.5%)   8.0199 ( 31.2%)   7.7186 ( 30.0%)  Local Register Allocator

Code quality:
734559 asm-printer           - Number of machine instrs printed
111395 ra-local              - Number of registers reloaded
 79902 ra-local              - Number of registers spilled
231554 x86-peephole          - Number of peephole optimization performed

After:
Time:
   7.8700 ( 30.6%)   0.0099 ( 19.9%)   7.8800 ( 30.6%)   7.7892 ( 30.2%)  Local Register Allocator
Code quality:
733083 asm-printer           - Number of machine instrs printed
  2379 ra-local              - Number of reloads fused into instructions
109046 ra-local              - Number of registers reloaded
 79881 ra-local              - Number of registers spilled
230658 x86-peephole          - Number of peephole optimization performed

So by fusing 2300 instructions, we reduced the  static number of instructions
by 1500, and reduces the number of peepholes (and thus the work) by about 900.
This also clearly reduces the number of reload/spill instructions that are
emitted.

llvm-svn: 11542
2004-02-17 08:09:40 +00:00
Chris Lattner
f93308ec17 Fix a bug in my previous refactoring change... arg!
llvm-svn: 11535
2004-02-17 07:02:17 +00:00
Chris Lattner
bb0cfb0429 Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
llvm-svn: 11517
2004-02-17 04:08:37 +00:00
Alkis Evlogimenos
c6ea9a6b65 Fix spilled interval update. It was too conservative.
llvm-svn: 11516
2004-02-17 04:04:20 +00:00
Chris Lattner
7b3342d814 Refactor code a bit. No functionality changes, though the comment hints at things to come.
llvm-svn: 11515
2004-02-17 03:57:19 +00:00