Commit Graph

19718 Commits

Author SHA1 Message Date
Chris Lattner 9fa2f949ae Change live variables from using multimaps to using maps of vectors and
rearrange some of the accessors to be more efficient.

This makes it much more efficient to iterate over all of the things with the
same value.  This speeds up liveintervals analysis from 8.63s to 3.79s with
a release build of llc on kc++ with -march=ia64.  This also speeds up live
var from 1.66s -> 0.87s as well, reducing total llc time from 20.1s->15.2s.

This also speeds up other targets slightly, e.g. llc time on X86 from 16.84
-> 16.45s, and PPC from 17.64->17.03s.

llvm-svn: 22990
2005-08-23 23:40:41 +00:00
Chris Lattner 774158239b Simplify this code by using higher-level LiveVariables methods
llvm-svn: 22989
2005-08-23 22:51:41 +00:00
Chris Lattner 7c1c6e06f3 Simplify this code by using LiveVariables::KillsRegister
llvm-svn: 22988
2005-08-23 22:49:55 +00:00
Chris Lattner 59057175ee Add RegisterDefIsDead to correspond to KillsRegister, mark both const
llvm-svn: 22987
2005-08-23 22:43:24 +00:00
Chris Lattner 22e91cc3b5 Keep track of which registers are related to which other registers.
Use this information to avoid doing expensive interval intersections for
registers that could not possible be interesting.  This speeds up linscan
on ia64 compiling kc++ in release mode from taking 7.82s to 4.8s(!), total
itanium llc time on this program is 27.3s now.  This marginally speeds up
PPC and X86, but they appear to be limited by other parts of linscan, not
this code.

On this program, on itanium, live intervals now takes 41% of llc time.

llvm-svn: 22986
2005-08-23 22:27:31 +00:00
Chris Lattner 808a9bdb13 add a method
llvm-svn: 22985
2005-08-23 21:45:31 +00:00
Chris Lattner 9c0a243ce5 Fix PR618 and Regression/CodeGen/CBackend/2005-08-23-Fmod.ll by not emitting
x%y for 'rem' on fp values.

llvm-svn: 22984
2005-08-23 20:22:50 +00:00
Chris Lattner 65de2689b4 New testcase for PR618
llvm-svn: 22983
2005-08-23 20:22:07 +00:00
Chris Lattner 5e3953d761 add a note
llvm-svn: 22982
2005-08-23 06:27:59 +00:00
Nate Begeman f3ce09b36e Ack, typo
llvm-svn: 22981
2005-08-23 05:45:10 +00:00
Nate Begeman 7216ad415b Add an option to make SetCC illegal as a beta option
llvm-svn: 22979
2005-08-23 05:42:36 +00:00
Nate Begeman bf8c3939d7 Teach the SelectionDAG how to transform select_cc eq, X, 0, 1, 0 into
either seteq X, 0 or srl (ctlz X), size(X-1), depending on what's legal
for the target.

llvm-svn: 22978
2005-08-23 05:41:12 +00:00
Nate Begeman 987121a61a Teach Legalize how to turn setcc into select_cc
llvm-svn: 22977
2005-08-23 04:29:48 +00:00
Nate Begeman 06436b2b7d Remove some instructions we no longer generate
llvm-svn: 22976
2005-08-23 01:16:46 +00:00
Chris Lattner 46323cf0e2 Remove some regs that are not used.
llvm-svn: 22975
2005-08-22 22:32:13 +00:00
Chris Lattner 956820d989 Nate noticed that 30% of the malloc/frees in llc come from calls to LowercaseString
in the asmprinter.  This changes the .td files to use lower case register names,
avoiding the need to do this call.  This speeds up the asmprinter from 1.52s
to 1.06s on kc++ in a release build.

llvm-svn: 22974
2005-08-22 22:00:02 +00:00
Chris Lattner d2f2aff484 Fix a crash I introduced into the IA64 backend with my copyfromreg change.
It used to crash on any function that took float arguments.

llvm-svn: 22973
2005-08-22 21:33:11 +00:00
Chris Lattner 834a2316a3 Try to avoid scanning the fixed list. On architectures with a non-stupid
number of regs (e.g. most riscs), many functions won't need to use callee
clobbered registers.  Do a speculative check to see if we can get a free
register without processing the fixed list (which has all of these).  This
saves a lot of time on machines with lots of callee clobbered regs (e.g.
ppc and itanium, also x86).

This reduces ppc llc compile time from 184s -> 172s on kc++.  This is probably
worth FAR FAR more on itanium though.

llvm-svn: 22972
2005-08-22 20:59:30 +00:00
Chris Lattner 95a157ae1a Move some code in the register assignment case that only needs to happen if
we spill out of the fast path.  The scan of active_ and the calls to
updateSpillWeights don't need to happen unless a spill occurs.  This reduces
debug llc time of kc++ with ppc from 187.3s to 183.2s.

llvm-svn: 22971
2005-08-22 20:20:42 +00:00
Chris Lattner 9d46518e5c Add a pass name for -time-passes output
llvm-svn: 22970
2005-08-22 18:28:09 +00:00
Chris Lattner 7f9e078d11 Fix a problem where constant expr shifts would not have their shift amount
promoted to the right type.  This fixes: IA64/2005-08-22-LegalizerCrash.ll

llvm-svn: 22969
2005-08-22 17:28:31 +00:00
Chris Lattner db5f4fd643 Testcase for a crash in the legalizer on ia64. This is reduced from kc++.
llvm-svn: 22968
2005-08-22 17:16:49 +00:00
Chris Lattner 2ea31c09da Add a long-overdue itanium regression test dir: hint hint Duraid :)
llvm-svn: 22967
2005-08-22 17:15:41 +00:00
Chris Lattner 83b821b584 Speed up this loop a bit, based on some observations that Nate made, and
add some comments.  This loop really needs to be reevaluated!

llvm-svn: 22966
2005-08-22 16:55:22 +00:00
Chris Lattner d50b29a256 Revert my patch which changed the code to not work.
llvm-svn: 22965
2005-08-22 16:24:25 +00:00
Chris Lattner 60aba18664 Make the example a bit easier to understand, suggested by Jim.
llvm-svn: 22964
2005-08-22 16:11:46 +00:00
Chris Lattner ca0c0d7550 Implement stores.
llvm-svn: 22963
2005-08-22 01:27:59 +00:00
Chris Lattner 92626b9bc5 Add a fast-path for register values. Add support for constant pool entries,
allowing us to compile this:

float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, 10.1
        ret float %R
}

to this:

_test2:
        lfs r2, 0(r3)
        lis r3, ha16(.CPI_test2_0)
        lfs r3, lo16(.CPI_test2_0)(r3)
        fadds f1, r2, r3
        blr

llvm-svn: 22962
2005-08-22 01:04:32 +00:00
Chris Lattner 1d634b2f44 Fix compilation of:
float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, %Q
        ret float %R
}

By returning the right result.

llvm-svn: 22961
2005-08-22 00:59:14 +00:00
Chris Lattner b676e5a666 Make sure expressions only have one use before emitting them into a place that is conditionally executed
llvm-svn: 22960
2005-08-22 00:47:28 +00:00
Chris Lattner c5292ec9de Implement most of load support. There is still a bug though.
llvm-svn: 22959
2005-08-21 22:31:09 +00:00
Chris Lattner f4dcbc0b98 add a method
llvm-svn: 22958
2005-08-21 22:30:42 +00:00
Chris Lattner 466fecee19 add anew method
llvm-svn: 22957
2005-08-21 22:30:30 +00:00
Chris Lattner 4866356907 Add support for frame index nodes
llvm-svn: 22956
2005-08-21 19:56:04 +00:00
Chris Lattner 0548f50501 add a method
llvm-svn: 22955
2005-08-21 19:48:59 +00:00
Chris Lattner 433390fba2 ADd a method
llvm-svn: 22954
2005-08-21 19:48:53 +00:00
Chris Lattner 968aeb18b0 Don't print out the MBB label for the entry mbb
llvm-svn: 22953
2005-08-21 19:09:33 +00:00
Chris Lattner 519acbfb76 Simplify the logic for BRTWOWAY_CC handling. The isel code already
simplifies BRTWOWAY into BR if one of the results is a fall-through.
Unless I'm missing something, there is no reason to duplicate this
in the target-specific code.

llvm-svn: 22952
2005-08-21 19:03:28 +00:00
Chris Lattner 2a1823d178 Implement selection for branches.
llvm-svn: 22951
2005-08-21 18:50:37 +00:00
Chris Lattner 46059044c6 Add 5-operand version of SelectNodeTo
llvm-svn: 22950
2005-08-21 18:49:58 +00:00
Chris Lattner 707b39fb8c add a method
llvm-svn: 22949
2005-08-21 18:49:33 +00:00
Chris Lattner 154b2bc59b Add support for basic blocks, fix a bug in result # computation
llvm-svn: 22948
2005-08-21 18:49:29 +00:00
Chris Lattner 539c3fa863 When legalizing brcond ->brcc or select -> selectcc, make sure to truncate
the old condition to a one bit value.  The incoming value must have been
promoted, and the top bits are undefined.  This causes us to generate:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r3, 17
        cmpwi cr0, r2, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r3, 1
.LBB_test_2:    ;
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r2, 1
.LBB_test_2:    ;
        or r3, r2, r2
        blr

for:

int %test(bool %c) {
        %retval = select bool %c, int 17, int 1
        ret int %retval
}

llvm-svn: 22947
2005-08-21 18:03:09 +00:00
Chris Lattner 0500e362bf If the false value for a select_cc is really simple (has no inputs), evaluate
it in the block.  This codegens:

int %test(bool %c) {
        %retval = select bool %c, int 17, int 1
        ret int %retval
}

as:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r2, 1
.LBB_test_2:    ;
        or r3, r2, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        li r4, 1
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r2, r4, r4
.LBB_test_2:    ;
        or r3, r2, r2
        blr

... which is one fewer instruction.  The savings are more significant for
global address and constantfp nodes.

llvm-svn: 22946
2005-08-21 17:41:11 +00:00
Chris Lattner 7b6b326b2c Fix a bug in the RUN line
llvm-svn: 22945
2005-08-21 16:37:36 +00:00
Duraid Madina 3588ea9bf5 reenable collapse of loadimm+AND -> dep.z (thanks guys)
llvm-svn: 22944
2005-08-21 15:43:53 +00:00
Chris Lattner 4b08ba26d8 fix bogus warning
llvm-svn: 22943
2005-08-20 18:07:27 +00:00
Jim Laskey 9b0a275f04 Repair an out by one error for IA64.
llvm-svn: 22942
2005-08-20 11:05:23 +00:00
Chris Lattner 4564039498 add support for global address, including PIC support.
This REALLY should be lowered by the legalizer!

llvm-svn: 22941
2005-08-19 22:38:53 +00:00
Chris Lattner 319e65696d Add support for global address nodes
llvm-svn: 22940
2005-08-19 22:38:24 +00:00