Commit Graph

427 Commits

Author SHA1 Message Date
Alkis Evlogimenos
39a0d5c112 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11654 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:15:40 +00:00
Chris Lattner
da8ab2ea45 ADd a method for when an instruction moves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11626 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:28:22 +00:00
Chris Lattner
5e61fa9519 Add a MachineBasicBlock::getParent() method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
52f8f56ef4 Move unused typedefs in private section. Add method to return interval
given a register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11608 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:14:52 +00:00
Chris Lattner
9b2c31c5cb eliminate a pair of really inefficient methods now that noone uses them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11579 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:45:22 +00:00
Alkis Evlogimenos
7093d37304 Add LiveIntervals::Interval::empty() member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11520 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:14:37 +00:00
Alkis Evlogimenos
aad5c05051 Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11497 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 07:17:43 +00:00
Alkis Evlogimenos
843b160a20 Eliminate the use of spill (reserved) registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11476 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 10:24:21 +00:00
Chris Lattner
46ccf6d382 finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11469 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:52:36 +00:00
Alkis Evlogimenos
be766c7246 Remove getAllocatedRegNum(). Use getReg() instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11393 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos
903b22cd51 Mark MachineBasicBlock::operator[] deprecated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11392 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 20:05:56 +00:00
Alkis Evlogimenos
87af94b291 Add getNumVirtualRegs().
Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11388 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 18:07:06 +00:00
Brian Gaeke
f13a3f4dd1 Include <iosfwd>.
Add prototypes for MachineBasicBlock's dump() and print() methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11365 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 04:40:15 +00:00
Alkis Evlogimenos
94dc07728f Move ilist_trairs<MachineInstr> in MachineBasicBlock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11358 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 19:12:03 +00:00
Alkis Evlogimenos
ab8672c8bb Add parent pointer to MachineInstr that points to owning
MachineBasicBlock. Also change opcode to a short and numImplicitRefs
to an unsigned char so that overall MachineInstr's size stays the
same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11357 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 18:49:07 +00:00
Chris Lattner
2a90ba6017 Rename the opCode instance variable to Opcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11348 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:09:53 +00:00
Chris Lattner
9fc77d1358 Remove a dead field from MachineInstr!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11347 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:05:03 +00:00
Brian Gaeke
0eda78a372 Add one more doxygen comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11344 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 04:26:49 +00:00
Brian Gaeke
56aa531f93 Express one of MachineOperand's many constructors in terms of another, by means of default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11343 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 04:15:00 +00:00
Brian Gaeke
2d58f0691e Remove these MachineOpCodeFlags and their accessor - they are never set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11341 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 04:00:55 +00:00
Alkis Evlogimenos
c0b9dc5be7 Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11340 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 02:27:10 +00:00
Brian Gaeke
cd0b3a90aa Remove getOpCode(). Help doxygenify some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11338 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 01:34:03 +00:00
Chris Lattner
d6b5e5f637 Urg, the X86 backend DOES use virtual register operands. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11288 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:43:11 +00:00
Chris Lattner
376ad9fa9f Remove and simplify some of the bewildering collection of isFOORegister
methods which have strangely different semantics in different backends,
and noone knew what any did.

Getting rid of these ALSO allows the dependence of MachineInstr.h on
MRegisterInfo.h to be removed, which makes me much happier, and probably
alkis too.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11287 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:21:17 +00:00
Chris Lattner
9f42dd5472 Eliminate MachineOperand::isPhysicalRegister. The X86 backend should use
MRegisterInfo::isPhysicalRegister(MO.getReg()) and the Sparc backend should
use isMachineRegister()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11279 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:42:11 +00:00
Chris Lattner
b2e5db94cf Simplify condition, this does not change the predicate at all though
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11275 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:30:40 +00:00
Brian Gaeke
f7ecb9548d SchedGraph doesn't need to be friends with SchedGraphNodeCommon anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11240 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:43:06 +00:00
Alkis Evlogimenos
14be64018f Modify the two address instruction pass to remove the duplicate
operand of the instruction and thus simplify the register allocation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11124 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 22:17:40 +00:00
Brian Gaeke
fc1f6e835c Include <iosfwd> and <string> instead of <iostream>.
Take away the default iostream argument of createMachineFunctionPrinterPass(),
at Chris's request.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11121 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 21:41:10 +00:00
Alkis Evlogimenos
4e7854407c When an instruction like: A += B had both A and B virtual registers
spilled, A was loaded from its stack location twice. This fixes the bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11093 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-03 01:13:07 +00:00
Alkis Evlogimenos
9fe7602862 Revert changes. Will implement this using a different set of primitives
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11091 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-02 23:08:58 +00:00
Alkis Evlogimenos
782ce955b2 Add MachineOperand::setDef() and MachineOperand::setUse() so that the
TwoAddressInstructionPass can correctly update use/def information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-02 21:55:18 +00:00
Alkis Evlogimenos
08cec00588 Merge safe parts from last night's buggy commit. These do not break
any test cases :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11032 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-31 19:59:32 +00:00
Alkis Evlogimenos
4d46e1e521 Revert last night's changes as they broke some tests. Will remerge parts of the patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11029 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-31 14:37:41 +00:00
Alkis Evlogimenos
32bdd4ea65 Several performance enhancements and cleanups from Chris.
Simplification of LiveIntervals::Interval::overlaps() and addition of
examples to overlaps() and liveAt() to make them clearer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11028 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-31 04:56:07 +00:00
Chris Lattner
43549f710a Add a new lazily constructed mapping from Idx's the MBB they represent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-30 22:08:09 +00:00
Brian Gaeke
09caa3751f Give clients of MachineFunctionPrinter the ability to specify a banner and
choose an ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11016 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-30 21:53:46 +00:00
Alkis Evlogimenos
79b0c3f0b9 Fix failing test cases with joined live intervals. It turns out that
when joining we need to check if we overlap with the second interval
or any of its aliases.

Also make joining intervals the default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10973 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-23 13:37:51 +00:00
Alkis Evlogimenos
e88280a422 Add option to join live intervals. Two intervals are joined if there
is a move between two registers, at least one of the registers is
virtual and the two live intervals do not overlap.

This results in about 40% reduction in intervals, 30% decrease in the
register allocators running time and a 20% increase in peephole
optimizations (mainly move eliminations).

The option can be enabled by passing -join-liveintervals where
appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10965 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-22 23:08:45 +00:00
Tanya Lattner
a105c802b2 Moved iterators to common file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10925 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-20 17:49:42 +00:00
Alkis Evlogimenos
3b02cbe752 Fold open interval ends handling into
LiveIntervals::Interval::expiredAt() and simplify regalloc code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10894 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-16 20:17:05 +00:00
Alkis Evlogimenos
f5f1689ed2 Use a list instead of a vector to store intervals. This will be needed
when we join intervals and one of the two will need to be removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10892 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-16 16:06:59 +00:00
Alkis Evlogimenos
1a119e2410 Remove allocatable registers vector. It is already provided by
LiveVariables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-13 22:10:43 +00:00
Alkis Evlogimenos
b08bdc4a16 Make LiveVariables::HandlePhysRegUse and
LiveVariables::HandlePhysRegDef private they use information that is
not in memory when LiveVariables finishes the analysis.

Also update the TwoAddressInstructionPass to not use this interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10755 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-11 09:18:45 +00:00
Chris Lattner
f70e0c216c Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 21:23:38 +00:00
Alkis Evlogimenos
26bfc08b80 Add coalescing to register allocator. A hint is added to each interval
which denotes the register we would like to be assigned to (virtual or
physical). In register allocation, if this hint exists and we can map
it to a physical register (it is either a physical register or it is a
virtual register that already got assigned to a physical one) we use
that register if it is available instead of a random one in the free
pool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10634 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 17:58:18 +00:00
Chris Lattner
09c692bcef add argument
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10625 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 09:42:49 +00:00
Chris Lattner
624affb56f ABC's must have virtual dtors! Shame on me!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10624 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 08:55:50 +00:00
Chris Lattner
8a1931a942 Move header into top-level llvm dir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10622 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 08:30:07 +00:00
Chris Lattner
3f52c1561d Add new interface that allows removal of some code from the code generators,
provides for future extensibility, might help the LLVA project avoid having to
hack their own LLI, and provides support required for the experimental Venus
project.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10620 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 08:19:13 +00:00