Commit Graph

68 Commits

Author SHA1 Message Date
Chris Lattner 5943c5078c Reduce usage of MRegisterInfo::getRegClass
llvm-svn: 15784
2004-08-15 22:23:09 +00:00
Chris Lattner afe8e34940 Nuke ifdef'd out code
llvm-svn: 15777
2004-08-15 22:03:57 +00:00
Chris Lattner c66f27fd29 Stop using CreateStackObject(RegClass*)
llvm-svn: 15775
2004-08-15 22:02:22 +00:00
Chris Lattner 98de1d7795 These methods no longer take a TargetRegisterClass* operand.
llvm-svn: 15774
2004-08-15 21:56:44 +00:00
Brian Gaeke 902dcf0729 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
Chris Lattner 6f4a596234 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 2150542af9 Adjust to new TargetMachine interface
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Alkis Evlogimenos 48da2f8a6d 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 61719d48d2 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 28a0885929 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 d8bace7f60 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
Alkis Evlogimenos af2de4848e 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
Chris Lattner 19aef9e757 Another bug fix for empty MBB's
llvm-svn: 11716
2004-02-22 19:37:31 +00:00
Chris Lattner 84b406650e 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 334114bdf1 Make 'fold' statistic's description the same in both allocators.
llvm-svn: 11687
2004-02-21 18:07:33 +00:00
Chris Lattner f5c5e1f458 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
Alkis Evlogimenos d0a60b71fc Rename reloads/spills to loads/stores.
llvm-svn: 11619
2004-02-19 06:19:09 +00:00
Chris Lattner 3d894dd3ab 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 4e21b2352c 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 d1289d0fcd Fix a bug in my previous refactoring change... arg!
llvm-svn: 11535
2004-02-17 07:02:17 +00:00
Chris Lattner ba9e3e2fb1 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
Chris Lattner ddedac59fe 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
Alkis Evlogimenos bbf53937a4 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

Also use MRegisterInfo::is{Physical,Virtual}Register where
appropriate.

llvm-svn: 11477
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos 8cdd0215bf Remove getAllocatedRegNum(). Use getReg() instead.
llvm-svn: 11393
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos de6a381691 Use getNumVirtualRegs().
Whitespace cleanups.

llvm-svn: 11389
2004-02-13 18:20:47 +00:00
Alkis Evlogimenos 80da865f77 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.

llvm-svn: 11340
2004-02-12 02:27:10 +00:00
Chris Lattner 5dd5be3ec3 Do not use MachineOperand::isVirtualRegister either!
llvm-svn: 11283
2004-02-10 21:12:22 +00:00
Chris Lattner 373fba5c1d Eliminate users of MachineOperand::isPhysicalRegister
llvm-svn: 11278
2004-02-10 20:41:10 +00:00
Chris Lattner 80cbed4f61 Another nice speedup for the register allocator. This time, we replace
the Virt2PhysRegMap std::map with an std::vector.  This speeds up the
register allocator another (almost) 40%, from .72->.45s in a release build
of LLC on 253.perlbmk.

llvm-svn: 11219
2004-02-09 02:12:04 +00:00
Chris Lattner 490627a404 Change the PhysRegsUsed map into a dense array. Seeing that this is a mapping
from physical registers, and they are always dense, it makes sense to not have
a ton of RBtree overhead.  This change speeds up regalloclocal about ~30% on
253.perlbmk, from .35s -> .27s in the JIT (in LLC, it goes from .74 -> .55).

Now live variable analysis is the slowest codegen pass.  Of course it doesn't
help that we have to run it twice, because regalloclocal doesn't update it,
but even if it did it would be the slowest pass (now it's just the 2x slowest
pass :(

llvm-svn: 11215
2004-02-09 01:26:13 +00:00
Chris Lattner c330b98c1c Finegrainify namespacification, use new MRegisterInfo::isVirtualRegister
method

llvm-svn: 11037
2004-01-31 21:27:19 +00:00
Alkis Evlogimenos ebbd66c042 Correctly compute live variable information for physical registers
when an implicitely defined register is later used by an alias. For example:

         call foo
         %reg1024 = mov %AL

The call implicitely defines EAX but only AL is used. Before this fix
no information was available on AL. Now EAX and all its aliases except
AL get defined and die at the call instruction whereas AL lives to be
killed by the assignment.

llvm-svn: 10813
2004-01-13 06:24:30 +00:00
Alkis Evlogimenos 7139090fd2 Remove TwoAddressInstruction from the public headers and add an ID
instead, since this pass doesn't expose any state to its users.

llvm-svn: 10520
2003-12-18 22:40:24 +00:00
Alkis Evlogimenos c17d57bd82 Modify local register allocator to use the two-address instruction pass.
llvm-svn: 10513
2003-12-18 13:08:52 +00:00
Alkis Evlogimenos aaba4639f8 Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
    b) add isUse(), isDef()
    c) rename opHiBits32() to isHiBits32(),
              opLoBits32() to isLoBits32(),
              opHiBits64() to isHiBits64(),
              opLoBits64() to isLoBits64().

This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.

llvm-svn: 10461
2003-12-14 13:24:17 +00:00
Alkis Evlogimenos 9bced9455a Remove unecessary if statements when looping on ImplicitDefs.
llvm-svn: 10444
2003-12-13 01:20:58 +00:00
Alkis Evlogimenos e59ad4b441 Make assertion stricter. Since the source operands are allocated at
this point, the second operand must be a physical register (it cannot
be a virtual one).

llvm-svn: 10292
2003-12-05 11:31:39 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner 9ab7fbef60 standardize command line option names
llvm-svn: 9496
2003-10-24 20:05:58 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Alkis Evlogimenos 5f1f337d95 Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs
and TargetInstrDescriptor::ImplicitUses to always point to a null
terminated array and never be null. So there is no need to check for
pointer validity when iterating over those sets. Code that looked
like:

if (const unsigned* AS = TID.ImplicitDefs) {
  for (int i = 0; AS[i]; ++i) {
    // use AS[i]
  }
}

was changed to:

for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) {
  // use *AS
}

llvm-svn: 8960
2003-10-08 05:20:08 +00:00
Chris Lattner e6235443a5 Fix bug: Jello/2003-08-23-RegisterAllocatePhysReg.ll
llvm-svn: 8095
2003-08-23 23:49:42 +00:00
Chris Lattner 931947db18 Fix bug: Jello/2003-08-15-AllocaAssertion.ll
llvm-svn: 7916
2003-08-17 18:01:15 +00:00
Brian Gaeke 91e16e750b Fix typo in comment
llvm-svn: 7906
2003-08-15 21:19:25 +00:00
Brian Gaeke 89207943a1 Factory methods for FunctionPasses now return type FunctionPass *.
llvm-svn: 7823
2003-08-13 18:18:15 +00:00
Chris Lattner 92a199dca7 Fix bugs handling ESP in alloca references
llvm-svn: 7591
2003-08-05 04:13:58 +00:00
Chris Lattner 506fa6843e Revert previous change, and be really anal about what physical registers can do.
llvm-svn: 7588
2003-08-05 00:49:09 +00:00
Chris Lattner 4b637cc666 Don't bother calculating info unless its needed. May reduce number of stack slots created.
llvm-svn: 7584
2003-08-04 23:42:37 +00:00
Chris Lattner 815b85e3ba * Fix spelling of 'necessary'
* Add a lot more DEBUG output, which is better structured than before
* Fix bug: Jello/2003-08-04-PhysRegLiveFailure.llx

llvm-svn: 7583
2003-08-04 23:36:39 +00:00
Chris Lattner 74e4e9b44f Set debug types
llvm-svn: 7533
2003-08-03 21:47:31 +00:00