Brian Gaeke
213538a039
Add machine-code CFG support: MachineBasicBlocks may now have their own
...
predecessors and successors
llvm-svn: 13208
2004-04-28 02:16:33 +00:00
Brian Gaeke
2f5697a29f
Add emitWordAt() - a quick and dirty interface that the machine-dependent
...
emitters can use to emit "relocations".
llvm-svn: 13116
2004-04-23 17:11:12 +00:00
Brian Gaeke
2a087ad673
Include <string> for compatibility with gcc 3.0.x (the system compiler on
...
Debian.)
llvm-svn: 12985
2004-04-16 15:57:14 +00:00
Brian Gaeke
95213bd702
This file does not appear to be included anywhere.
...
llvm-svn: 12777
2004-04-08 19:36:26 +00:00
Brian Gaeke
14dadd43e1
This file is no longer used.
...
llvm-svn: 12767
2004-04-07 21:01:22 +00:00
Chris Lattner
c241db65d6
Allow converting a builder to an iterator
...
llvm-svn: 12586
2004-04-01 04:03:10 +00:00
Brian Gaeke
e7f4f73f67
Add clear() forwarding method.
...
llvm-svn: 12580
2004-03-31 22:43:12 +00:00
Chris Lattner
3f24ea6ccf
MachineBasicBlock::remove should not change the iterator passed into it
...
llvm-svn: 12569
2004-03-31 21:58:50 +00:00
Alkis Evlogimenos
64aa7f3708
Fix bug introduced by yesterday's changes.
...
llvm-svn: 12119
2004-03-04 18:02:07 +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
Chris Lattner
4c7ed6793e
Remove public header. It's been moved to lib/Target/SparcV9
...
llvm-svn: 12004
2004-02-29 19:13:20 +00:00
Chris Lattner
df24575c31
Do not use explicit casts that hide the dependence on Instruction being
...
annotable
llvm-svn: 12000
2004-02-29 19:02:26 +00:00
Chris Lattner
768b31fc77
Remove unneeded #include
...
llvm-svn: 11978
2004-02-29 05:15:56 +00:00
Chris Lattner
34977159b3
Continue Alkis's int64_t cleanup. This makes all of the immediate related
...
methods take an int or unsigned value instead of int64_t.
Also, add an 'addImm' method to the MachineInstrBuilder class, because the
fact that the hardware sign or zero extends it does not/should not matter
to the code generator. Once the old sparc backend is removed the difference
can be eliminated.
llvm-svn: 11976
2004-02-29 05:06:49 +00:00
Chris Lattner
85dd74a158
Add BuildMI variants that take a MBB::iterator
...
llvm-svn: 11975
2004-02-29 04:55:28 +00:00
Alkis Evlogimenos
5193c08a8a
Make MachineOperand's immediate value an int and save 4 bytes out of
...
each MachineOperand. We don't really need an int64_t immediate :-).
llvm-svn: 11906
2004-02-27 15:05:28 +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
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
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
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
Alkis Evlogimenos
7f7d70a53c
Move MOTy::UseType enum into MachineOperand. This eliminates the
...
switch statements in the constructors and simplifies the
implementation of the getUseType() member function. You will have to
specify defs using MachineOperand::Def instead of MOTy::Def though
(similarly for Use and UseAndDef).
llvm-svn: 11715
2004-02-22 19:23:26 +00:00
Alkis Evlogimenos
abc8efe386
Fix silly bug in implementation of getUseType(). Thanks Misha.
...
llvm-svn: 11711
2004-02-22 07:24:19 +00:00
Alkis Evlogimenos
6998610eda
When folding memory operands in machine instructions be careful to
...
leave register operands with the same use/def flags as the original
instruction.
llvm-svn: 11709
2004-02-22 06:54:26 +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
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
Chris Lattner
6c338f7627
ADd a method for when an instruction moves
...
llvm-svn: 11626
2004-02-19 18:28:22 +00:00
Chris Lattner
436ab13009
Add a MachineBasicBlock::getParent() method
...
llvm-svn: 11622
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
d4fd43dee8
Move unused typedefs in private section. Add method to return interval
...
given a register.
llvm-svn: 11608
2004-02-18 23:14:52 +00:00
Chris Lattner
34f3bce70c
eliminate a pair of really inefficient methods now that noone uses them
...
llvm-svn: 11579
2004-02-18 16:45:22 +00:00
Alkis Evlogimenos
a479dc4715
Add LiveIntervals::Interval::empty() member function.
...
llvm-svn: 11520
2004-02-17 05:14:37 +00:00
Alkis Evlogimenos
790b000aa7
Add LeakDetection to MachineInstr.
...
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.
llvm-svn: 11497
2004-02-16 07:17:43 +00:00
Alkis Evlogimenos
1026a01d5a
Eliminate the use of spill (reserved) registers.
...
llvm-svn: 11476
2004-02-15 10:24:21 +00:00
Chris Lattner
bbe538e930
finegrainify namespacification
...
llvm-svn: 11469
2004-02-15 05:52:36 +00:00
Alkis Evlogimenos
6d6ab846af
Remove getAllocatedRegNum(). Use getReg() instead.
...
llvm-svn: 11393
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos
e504fa6710
Mark MachineBasicBlock::operator[] deprecated.
...
llvm-svn: 11392
2004-02-13 20:05:56 +00:00
Alkis Evlogimenos
c109214f58
Add getNumVirtualRegs().
...
Whitespace cleanups.
llvm-svn: 11388
2004-02-13 18:07:06 +00:00
Brian Gaeke
7707461afa
Include <iosfwd>.
...
Add prototypes for MachineBasicBlock's dump() and print() methods.
llvm-svn: 11365
2004-02-13 04:40:15 +00:00
Alkis Evlogimenos
00d97b6a13
Move ilist_trairs<MachineInstr> in MachineBasicBlock.
...
llvm-svn: 11358
2004-02-12 19:12:03 +00:00
Alkis Evlogimenos
3ecdcd18c5
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.
llvm-svn: 11357
2004-02-12 18:49:07 +00:00
Chris Lattner
ef375052c6
Rename the opCode instance variable to Opcode
...
llvm-svn: 11348
2004-02-12 16:09:53 +00:00
Chris Lattner
04c37927bd
Remove a dead field from MachineInstr!
...
llvm-svn: 11347
2004-02-12 16:05:03 +00:00
Brian Gaeke
57484e290d
Add one more doxygen comment.
...
llvm-svn: 11344
2004-02-12 04:26:49 +00:00
Brian Gaeke
840e7e40fe
Express one of MachineOperand's many constructors in terms of another, by means of default arguments.
...
llvm-svn: 11343
2004-02-12 04:15:00 +00:00
Brian Gaeke
0608698c34
Remove these MachineOpCodeFlags and their accessor - they are never set.
...
llvm-svn: 11341
2004-02-12 04:00:55 +00:00
Alkis Evlogimenos
b755d35fd2
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
Brian Gaeke
2e521768eb
Remove getOpCode(). Help doxygenify some comments.
...
llvm-svn: 11338
2004-02-12 01:34:03 +00:00
Chris Lattner
a04a1456da
Urg, the X86 backend DOES use virtual register operands. :(
...
llvm-svn: 11288
2004-02-10 21:43:11 +00:00
Chris Lattner
286169ff60
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. :)
llvm-svn: 11287
2004-02-10 21:21:17 +00:00
Chris Lattner
04f36062ea
Eliminate MachineOperand::isPhysicalRegister. The X86 backend should use
...
MRegisterInfo::isPhysicalRegister(MO.getReg()) and the Sparc backend should
use isMachineRegister()
llvm-svn: 11279
2004-02-10 20:42:11 +00:00
Chris Lattner
854737de3f
Simplify condition, this does not change the predicate at all though
...
llvm-svn: 11275
2004-02-10 20:30:40 +00:00
Brian Gaeke
00b2107e2a
SchedGraph doesn't need to be friends with SchedGraphNodeCommon anymore.
...
llvm-svn: 11240
2004-02-09 18:43:06 +00:00
Alkis Evlogimenos
676e5b8997
Modify the two address instruction pass to remove the duplicate
...
operand of the instruction and thus simplify the register allocation.
llvm-svn: 11124
2004-02-04 22:17:40 +00:00
Brian Gaeke
efde1c6bb8
Include <iosfwd> and <string> instead of <iostream>.
...
Take away the default iostream argument of createMachineFunctionPrinterPass(),
at Chris's request.
llvm-svn: 11121
2004-02-04 21:41:10 +00:00
Alkis Evlogimenos
5e78d4bd75
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.
llvm-svn: 11093
2004-02-03 01:13:07 +00:00
Alkis Evlogimenos
e128cb3295
Revert changes. Will implement this using a different set of primitives
...
llvm-svn: 11091
2004-02-02 23:08:58 +00:00
Alkis Evlogimenos
e20cdc6437
Add MachineOperand::setDef() and MachineOperand::setUse() so that the
...
TwoAddressInstructionPass can correctly update use/def information.
llvm-svn: 11086
2004-02-02 21:55:18 +00:00
Alkis Evlogimenos
d1ec5f36ee
Merge safe parts from last night's buggy commit. These do not break
...
any test cases :-)
llvm-svn: 11032
2004-01-31 19:59:32 +00:00
Alkis Evlogimenos
b9df133d67
Revert last night's changes as they broke some tests. Will remerge parts of the patch.
...
llvm-svn: 11029
2004-01-31 14:37:41 +00:00
Alkis Evlogimenos
c0db519832
Several performance enhancements and cleanups from Chris.
...
Simplification of LiveIntervals::Interval::overlaps() and addition of
examples to overlaps() and liveAt() to make them clearer.
llvm-svn: 11028
2004-01-31 04:56:07 +00:00
Chris Lattner
8671a315d5
Add a new lazily constructed mapping from Idx's the MBB they represent
...
llvm-svn: 11017
2004-01-30 22:08:09 +00:00
Brian Gaeke
9cf840250b
Give clients of MachineFunctionPrinter the ability to specify a banner and
...
choose an ostream.
llvm-svn: 11016
2004-01-30 21:53:46 +00:00
Alkis Evlogimenos
2a8df1739b
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.
llvm-svn: 10973
2004-01-23 13:37:51 +00:00
Alkis Evlogimenos
b4745bda05
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.
llvm-svn: 10965
2004-01-22 23:08:45 +00:00
Tanya Lattner
33079fad04
Moved iterators to common file.
...
llvm-svn: 10925
2004-01-20 17:49:42 +00:00
Alkis Evlogimenos
38f0f867b3
Fold open interval ends handling into
...
LiveIntervals::Interval::expiredAt() and simplify regalloc code.
llvm-svn: 10894
2004-01-16 20:17:05 +00:00
Alkis Evlogimenos
61db3621bd
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.
llvm-svn: 10892
2004-01-16 16:06:59 +00:00
Alkis Evlogimenos
c73c31a496
Remove allocatable registers vector. It is already provided by
...
LiveVariables.
llvm-svn: 10830
2004-01-13 22:10:43 +00:00
Alkis Evlogimenos
ef7c077e63
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.
llvm-svn: 10755
2004-01-11 09:18:45 +00:00
Chris Lattner
c37577eb9f
Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
...
implementation from the TargetMachine directly.
llvm-svn: 10636
2003-12-28 21:23:38 +00:00
Alkis Evlogimenos
fc01aac4d8
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.
llvm-svn: 10634
2003-12-28 17:58:18 +00:00
Chris Lattner
215d4146fe
add argument
...
llvm-svn: 10625
2003-12-28 09:42:49 +00:00
Chris Lattner
00a54b7c00
Move header into top-level llvm dir
...
llvm-svn: 10622
2003-12-28 08:30:07 +00:00
Chris Lattner
8bc92e92ee
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.
llvm-svn: 10620
2003-12-28 08:19:13 +00:00
Alkis Evlogimenos
4401d0a7a3
Change weight into a float so that we can take into account the
...
nesting level when computing it. Right now the allocator uses:
w = sum_over_defs_uses( 10 ^ nesting level );
llvm-svn: 10569
2003-12-21 20:19:10 +00:00
Alkis Evlogimenos
4f98b79ef0
Add support for inactive intervals. This effectively reuses registers
...
for live ranges that fall into assigned registers' holes.
llvm-svn: 10566
2003-12-21 05:43:40 +00:00
Chris Lattner
58d2beb555
Rearrange code, indent for the namespace, add the createMachineFunctionPrinterPass
...
to passes.h, and add the machien destruction pass to Passes.h
llvm-svn: 10557
2003-12-20 10:18:58 +00:00
Chris Lattner
f987d900a4
Remove sparc specific passes from public headers
...
llvm-svn: 10552
2003-12-20 09:15:21 +00:00
Chris Lattner
1963b162db
Remove a horrible API
...
llvm-svn: 10551
2003-12-20 09:15:01 +00:00
Alkis Evlogimenos
9181e0ab5b
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
90aeecae42
Add TwoAddressInstructionPass to handle instructions that have two or
...
more operands and the two first operands are constrained to be the
same. The pass takes an instruction of the form:
a = b op c
and transforms it into:
a = b
a = a op c
and also preserves live variables.
llvm-svn: 10512
2003-12-18 13:06:04 +00:00
Alkis Evlogimenos
befef566f6
Rename LiveIntervals::expired() to LiveIntervals::expiredAt().
...
llvm-svn: 10511
2003-12-18 08:56:11 +00:00
Alkis Evlogimenos
8e2fcc7d79
Handle multiple virtual register definitions gracefully.
...
Move some of the longer LiveIntervals::Interval method out of the
header and add debug information to them. Fix bug and simplify range
merging code.
llvm-svn: 10509
2003-12-18 08:48:48 +00:00
Alkis Evlogimenos
ac4fe24ed8
I wonder how this didn't cause any tests to fail...
...
llvm-svn: 10462
2003-12-14 13:30:19 +00:00
Alkis Evlogimenos
29127b8825
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
f84f86137b
Ignore non-allocatable physical registers in live interval analysis.
...
llvm-svn: 10449
2003-12-13 11:11:02 +00:00
Alkis Evlogimenos
229c2b9181
Move operator<<(std::ostream&, const LiveInterval&) out of the header file.
...
llvm-svn: 10290
2003-12-05 10:38:28 +00:00
Chris Lattner
e595976ed9
Add some "useful" methods
...
llvm-svn: 10277
2003-12-01 05:30:29 +00:00
Alkis Evlogimenos
6627a32ff9
Merging the linear scan register allocator in trunk. It currently passes most tests under test/Programs/SingleSource/Benchmarks/Shootout so development will continue on trunk. The allocator is not enabled by default. You will need to pass -regallo=linearscan to lli or llc to use it.
...
llvm-svn: 10103
2003-11-20 03:32:25 +00:00
Brian Gaeke
d25f86d683
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
59ee30fa40
Actually share constants local to a function!
...
llvm-svn: 9417
2003-10-23 16:29:12 +00:00
Chris Lattner
a227bfeff3
Add a new map
...
llvm-svn: 9311
2003-10-20 20:55:13 +00:00
John Criswell
16c6cda9d5
Added LLVM copyright header (for lack of a better term).
...
llvm-svn: 9304
2003-10-20 20:19:47 +00:00
Brian Gaeke
2a7cedb657
This file has funny include guards and funny extra whitespace.
...
Make this file less funny.
llvm-svn: 9186
2003-10-16 23:43:35 +00:00
Chris Lattner
9db0d011b4
We'll need this soon as well
...
llvm-svn: 9145
2003-10-15 22:09:46 +00:00
Alkis Evlogimenos
33a498f90c
Forward declare class Type since it is used in this class and Type.h is not included
...
llvm-svn: 8958
2003-10-08 04:45:45 +00:00
Alkis Evlogimenos
a37b58ce09
Moved enum and command-line option in separate file. Also added function that returns the user selected register allocator to the caller.
...
llvm-svn: 8819
2003-10-02 16:57:49 +00:00
Alkis Evlogimenos
42a09316bb
Change llc command line for register allocators
...
llvm-svn: 8815
2003-10-02 06:13:19 +00:00
Chris Lattner
c3767eab12
Forward declare a class
...
llvm-svn: 8797
2003-09-30 20:15:40 +00:00
Chris Lattner
d63bd276f0
This got merged into Passes.h
...
llvm-svn: 8796
2003-09-30 20:15:32 +00:00
Chris Lattner
08d6f140ab
Include the sparc register in this file
...
llvm-svn: 8794
2003-09-30 20:14:43 +00:00