Commit Graph

1815 Commits

Author SHA1 Message Date
Chris Lattner
53a79aaae9 Break the body of the loop out into a new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-03 04:47:08 +00:00
Chris Lattner
ab510a76d6 Fix a problem where the legalizer would run out of stack space on extremely
large basic blocks because it was purely recursive.  This switches it to an
iterative/recursive hybrid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23596 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 17:49:46 +00:00
Chris Lattner
dcd5abc70c silence a bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 16:30:51 +00:00
Chris Lattner
a3638c0f1f Add assertions to the trivial scheduler to check that the value types match
up between defs and uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23590 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 07:10:55 +00:00
Chris Lattner
14765be0bc Codegen CopyFromReg using the regclass that matches the valuetype of the
destination vreg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23586 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 06:34:16 +00:00
Chris Lattner
505277a7f5 Add some very paranoid checking for operand/result reg class matchup
For instructions that define multiple results, use the right regclass
to define the result, not always the rc of result #0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23580 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 07:45:09 +00:00
Jeff Cohen
2aeaf4e839 Fix VC++ warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 03:57:14 +00:00
Chris Lattner
37345fe3cd add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23575 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:17:07 +00:00
Jim Laskey
22f6212e9f typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23574 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:08:23 +00:00
Jim Laskey
41755e2c7e 1. Simplify the gathering of node groups.
2. Printing node groups when displaying nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23573 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:03:07 +00:00
Jim Laskey
b6d4c2cf2d 1. Made things node-centric (from operand).
2. Added node groups to handle flagged nodes.

3. Started weaning simple scheduling off existing emitter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23566 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 19:15:27 +00:00
Chris Lattner
8fb040e584 now that we have a reg class to spill with, get this info from the regclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23559 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 17:19:22 +00:00
Chris Lattner
80a4f169b4 Now that we have getCalleeSaveRegClasses() info, use it to pass the register
class into the spill/reload methods.  Targets can now rely on that argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23556 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 16:59:07 +00:00
Chris Lattner
bf9716b9c4 Change this code ot pass register classes into the stack slot spiller/reloader
code.  PrologEpilogInserter hasn't been updated yet though, so targets cannot
use this info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 01:29:00 +00:00
Chris Lattner
473a99073c Fix two bugs in my patch earlier today that broke int->fp conversion on X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 06:44:39 +00:00
Jeff Cohen
fef80f43e0 Silence VC++ redeclaration warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23516 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 01:59:49 +00:00
Chris Lattner
01b3d73c20 Add FP versions of the binary operators, keeping the int and fp worlds seperate.
Though I have done extensive testing, it is possible that this will break
things in configs I can't test.  Please let me know if this causes a problem
and I'll fix it ASAP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23504 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 22:28:18 +00:00
Chris Lattner
6c38b33613 If the target prefers it, use _setjmp/_longjmp should be used instead of setjmp/longjmp for llvm.setjmp/llvm.longjmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23481 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:15:53 +00:00
Chris Lattner
8e6be8b921 initialize new flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:13:56 +00:00
Jim Laskey
5324fec644 Remove some redundancies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23469 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 17:32:45 +00:00
Jim Laskey
e6b90fba4a Addition of a simple two pass scheduler. This version is currently hacked up
for testing and will require target machine info to do a proper scheduling.
The simple scheduler can be turned on using -sched=simple (defaults
to -sched=none)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23455 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 21:57:04 +00:00
Chris Lattner
5ae7911b24 Turn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)
This happens all the time on PPC for bool values, e.g. eliminating a xori
in inverted-bool-compares.ll.

This should be added to the dag combiner as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 00:55:52 +00:00
Chris Lattner
3c3fe462f7 Expose the LiveInterval interfaces as public headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23400 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-21 04:19:09 +00:00
Nate Begeman
44728a7bb6 Stub out the rest of the DAG Combiner. Just need to fill in the
select_cc bits and then wrap it in a convenience function for  use with
regular select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 22:34:01 +00:00
Chris Lattner
cea8688ee4 Teach the local spiller to turn stack slot loads into register-register copies
when possible, avoiding the load (and avoiding the copy if the value is already
in the right register).

This patch came about when I noticed code like the following being generated:

  store R17 -> [SS1]
  ...blah...
  R4 = load [SS1]

This was causing an LSU reject on the G5.  This problem was due to the register
allocator folding spill code into a reg-reg copy (producing the load), which
prevented the spiller from being able to rewrite the load into a copy, despite
the fact that the value was already available in a register.  In the case
above, we now rip out the R4 load and replace it with a R4 = R17 copy.

This speeds up several programs on X86 (which spills a lot :) ), e.g.
smg2k from 22.39->20.60s, povray from 12.93->12.66s, 168.wupwise from
68.54->53.83s (!), 197.parser from 7.33->6.62s (!), etc.  This may have a larger
impact in some cases on the G5 (by avoiding LSU rejects), though it probably
won't trigger as often (less spilling in general).

Targets that implement folding of loads/stores into copies should implement
the isLoadFromStackSlot hook to get this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 06:56:21 +00:00
Nate Begeman
452d7bebaa More DAG combining. Still need the branch instructions, and select_cc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23371 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-16 00:54:12 +00:00
Chris Lattner
fa57702388 If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-13 19:30:54 +00:00
Chris Lattner
13d58e71b7 Allow targets to say they don't support truncstore i1 (which includes a mask
when storing to an 8-bit memory location), as most don't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23303 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-10 00:20:18 +00:00
Chris Lattner
a500fc681d Add a missing #include, patch courtesy of Baptiste Lepilleur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23302 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 23:53:39 +00:00
Chris Lattner
3ec5d74fc5 Fix a problem duraid encountered on itanium where this folding:
select (x < y), 1, 0 -> (x < y) incorrectly: the setcc returns i1 but the
select returned i32.  Add the zero extend as needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23301 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 23:00:07 +00:00
Chris Lattner
08addbd477 Fix a crash viewing dags that have target nodes in them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 22:35:03 +00:00
Chris Lattner
50ea01ed5b Use continue in the use-processing loop to make it clear what the early exits
are, simplify logic, and cause things to not be nested as deeply.  This also
uses MRI->areAliases instead of an explicit loop.

No functionality change, just code cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23296 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 20:29:51 +00:00
Nate Begeman
39ee1ac7e5 Last round of 2-node folds from SD.cpp. Will move on to 3 node ops such
as setcc and select next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23295 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:49:52 +00:00
Chris Lattner
ceb0a52231 remove debugging code *slaps head*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23294 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:19:20 +00:00
Chris Lattner
b11443dc84 When spilling a live range that is used multiple times by one instruction,
only add a reload live range once for the instruction.  This is one step
towards fixing a regalloc pessimization that Nate notice, but is later undone
by the spiller (so no code is changed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23293 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:17:47 +00:00
Nate Begeman
223df2269d Move yet more folds over to the dag combiner from sd.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23278 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-08 20:18:10 +00:00
Nate Begeman
9980119270 Another round of dag combiner changes. This fixes some missing XOR folds
as well as fixing how we replace old values with new values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23260 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 23:25:52 +00:00
Chris Lattner
dc6e2e0a5f Fix a bug that Tzu-Chien Chiu noticed: live interval analysis does NOT
preserve livevar


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23259 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 17:34:39 +00:00
Nate Begeman
f89d78d7c7 Implement a common missing fold, (add (add x, c1), c2) -> (add x, c1+c2).
This restores all of stanford to being identical with and without the dag
combiner with the add folding turned off in sd.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23258 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 16:09:19 +00:00
Chris Lattner
1e111c7bbb Fix a bug nate ran into with replacealluseswith. In the recursive cse case,
we were losing a node, causing an assertion to fail.  Now we eagerly delete
discovered CSE's, and provide an optional vector to keep track of these
discovered equivalences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23255 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 05:37:01 +00:00
Nate Begeman
2300f55046 Add an option to the DAG Combiner to enable it for beta runs, and turn on
that option for PowerPC's beta.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 00:15:36 +00:00
Nate Begeman
83e75ecd27 Next round of DAGCombiner changes. This version now passes all the tests
I have run so far when run before Legalize.  It still needs to pick up the
SetCC folds, and nodes that use SetCC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23243 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-06 04:43:02 +00:00
Chris Lattner
6a8a21ced4 Fix a checking failure in gs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23235 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-03 01:04:40 +00:00
Nate Begeman
646d7e2727 Next round of DAG Combiner changes. Just need to support multiple return
values, and then we should be able to hook it up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23231 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 21:18:40 +00:00
Chris Lattner
6fdcb250d5 Clean up some code from the last checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23229 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 20:32:45 +00:00
Chris Lattner
99c25b86aa Fix a bug in legalize where it would emit two calls to libcalls that return
i64 values on targets that need that expanded to 32-bit registers.  This fixes
PowerPC/2005-09-02-LegalizeDuplicatesCalls.ll and speeds up 189.lucas from
taking 122.72s to 81.96s on my desktop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23228 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 20:26:58 +00:00
Chris Lattner
70b9b1098a Make sure to auto-cse nullary ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23224 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 19:36:17 +00:00
Chris Lattner
6621e3b963 Fix some buggy logic where we would try to remove nodes with two operands
from the binary ops map, even if they had multiple results.  This latent bug
caused a few failures with the dag isel last night.

To prevent stuff like this from happening in the future, add some really
strict checking to make sure that the CSE maps always match up with reality!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23221 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 19:15:44 +00:00
Chris Lattner
fd88f64934 Don't create zero sized stack objects even for array allocas with a zero
number of elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23219 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 18:41:28 +00:00
Chris Lattner
a639a43602 Fix the release build, noticed by Eric van Riet Paap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23215 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 07:09:28 +00:00