Commit Graph

10803 Commits

Author SHA1 Message Date
Chris Lattner
76eb08bcda Simplify this code by using LiveVariables::KillsRegister
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 22:49:55 +00:00
Chris Lattner
b980578b41 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22986 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 22:27:31 +00:00
Chris Lattner
57da25231a Fix PR618 and Regression/CodeGen/CBackend/2005-08-23-Fmod.ll by not emitting
x%y for 'rem' on fp values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22984 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 20:22:50 +00:00
Chris Lattner
424dcbdb3b add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22982 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 06:27:59 +00:00
Nate Begeman
8ca5693c51 Ack, typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22981 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:45:10 +00:00
Nate Begeman
a50d53e5ef Add an option to make SetCC illegal as a beta option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22979 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:42:36 +00:00
Nate Begeman
7042f15bde 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22978 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:41:12 +00:00
Nate Begeman
b942a3dd5f Teach Legalize how to turn setcc into select_cc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22977 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 04:29:48 +00:00
Nate Begeman
354df0ae6d Remove some instructions we no longer generate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22976 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 01:16:46 +00:00
Chris Lattner
1f24df6324 Remove some regs that are not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22975 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 22:32:13 +00:00
Chris Lattner
9dc4d3cbac 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22974 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 22:00:02 +00:00
Chris Lattner
0a00bece0d Fix a crash I introduced into the IA64 backend with my copyfromreg change.
It used to crash on any function that took float arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22973 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 21:33:11 +00:00
Chris Lattner
a411cbca5c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22972 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 20:59:30 +00:00
Chris Lattner
a6c1750362 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22971 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 20:20:42 +00:00
Chris Lattner
47c0889419 Add a pass name for -time-passes output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22970 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 18:28:09 +00:00
Chris Lattner
8f03405ee5 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22969 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 17:28:31 +00:00
Chris Lattner
f8355d9846 Speed up this loop a bit, based on some observations that Nate made, and
add some comments.  This loop really needs to be reevaluated!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22966 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 16:55:22 +00:00
Chris Lattner
f7f2255505 Implement stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22963 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 01:27:59 +00:00
Chris Lattner
23553cfb4a 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22962 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 01:04:32 +00:00
Chris Lattner
ddf3e7dfd7 Fix compilation of:
float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, %Q
        ret float %R
}

By returning the right result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22961 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 00:59:14 +00:00
Chris Lattner
b30ee6a41a Make sure expressions only have one use before emitting them into a place that is conditionally executed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22960 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 00:47:28 +00:00
Chris Lattner
9944b76cfe Implement most of load support. There is still a bug though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22959 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 22:31:09 +00:00
Chris Lattner
c975e1dedc add anew method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22957 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 22:30:30 +00:00
Chris Lattner
81e72b13d7 Add support for frame index nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22956 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:56:04 +00:00
Chris Lattner
99baddaf57 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22955 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:48:59 +00:00
Chris Lattner
1db1adbdee Don't print out the MBB label for the entry mbb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22953 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:09:33 +00:00
Chris Lattner
f913d3f91c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22952 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:03:28 +00:00
Chris Lattner
2fbb4579d6 Implement selection for branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22951 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:50:37 +00:00
Chris Lattner
6b09a29604 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22949 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:49:33 +00:00
Chris Lattner
f85ab15acf Add support for basic blocks, fix a bug in result # computation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22948 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:49:29 +00:00
Chris Lattner
550b1e59c4 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
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22947 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:03:09 +00:00
Chris Lattner
4dd4a2d278 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22946 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 17:41:11 +00:00
Duraid Madina
7340dd5d2e reenable collapse of loadimm+AND -> dep.z (thanks guys)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22944 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 15:43:53 +00:00
Chris Lattner
fe0c2c8721 fix bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22943 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-20 18:07:27 +00:00
Jim Laskey
ffb973df92 Repair an out by one error for IA64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22942 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-20 11:05:23 +00:00
Chris Lattner
4416f1a0a5 add support for global address, including PIC support.
This REALLY should be lowered by the legalizer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22941 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:38:53 +00:00
Chris Lattner
9b78db7f16 Add support for global address nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22940 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:38:24 +00:00
Chris Lattner
aaaa0b67dd Add support for TargetGlobalAddress nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22938 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:31:04 +00:00
Chris Lattner
7ef330478f Implement CopyFromReg, TokenFactor, and fix a bug in CopyToReg. This allows
us to compile stuff like this:

double %test(double %A, double %B, double %C, double %E) {
        %F = mul double %A, %A
        %G = add double %F, %B
        %H = sub double -0.0, %G
        %I = mul double %H, %C
        %J = add double %I, %E
        ret double %J
}

to:

_test:
        fnmadd f0, f1, f1, f2
        fmadd f1, f0, f3, f4
        blr

woot!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22937 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:43:53 +00:00
Chris Lattner
fa164b61d1 Fix a bug in previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22936 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:34:13 +00:00
Chris Lattner
7e65997c43 Fix a typeo, no wonder all tokenfactor edges were the same!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22935 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:33:02 +00:00
Chris Lattner
7228aa7868 Print physreg register nodes with target names (e.g. F1) instead of numbers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22934 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:21:16 +00:00
Chris Lattner
0189197608 Before implementing copyfromreg, we'll implement copytoreg correctly.
This gets us this for the previous testcase:

_test:
        lis r2, 0
        ori r3, r2, 65535
        blr

Note that we actually write to r3 (the return reg) correctly now :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22933 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 20:50:53 +00:00
Chris Lattner
4ccd406317 Now that we have operand info for machine instructions, use it to create
temporary registers for things that define a register.  This allows dag->dag
isel to compile this:

int %test() { ret int 65535 }

into:

_test:
        lis r2, 0
        ori r2, r2, 65535
        blr

Next up, getting CopyFromReg to work, allowing arguments and cross-bb values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22932 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 20:45:43 +00:00
Chris Lattner
ecbce617ca Split RegisterClass 'Methods' into MethodProtos and MethodBodies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22929 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 19:13:20 +00:00
Chris Lattner
f0c5f67dbc put reg classes into namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22927 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:53:43 +00:00
Chris Lattner
fabc8ffacb Put reg classes into namespaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22926 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:52:55 +00:00
Chris Lattner
03ba7b9f25 Put register classes into namespaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22925 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:51:57 +00:00
Chris Lattner
cbec3b00bd Put register classes in namespaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22924 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:50:46 +00:00
Chris Lattner
e7af178ccf Fix code that assumes the register info will be dumped into a target
namespace instead of the reg class namespace.  Update getRegClassForType()
to use modified names due to tblgen change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22923 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:50:11 +00:00