Nate Begeman
2d56e72f09
Fix last night's PPC32 regressions by
...
1. Not selecting the false value of a select_cc in the false arm, which
isn't legal for nested selects.
2. Actually returning the node we created and Legalized in the FP_TO_UINT
Expander.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22789 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 18:38:32 +00:00
Nate Begeman
889f2c1acf
Fix last night's X86 regressions by putting code for SSE in the if(SSE)
...
block. nur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22788 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 18:37:02 +00:00
Andrew Lenharth
9ca65c7110
only build .a on alpha
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22787 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 15:14:34 +00:00
Nate Begeman
875f360e22
Fix FP_TO_UINT with Scalar SSE2 now that the legalizer can handle it. We
...
now generate the relatively good code sequences:
unsigned short foo(float a) { return a; }
_foo:
movss 4(%esp), %xmm0
cvttss2si %xmm0, %eax
movzwl %ax, %eax
ret
and
unsigned bar(float a) { return a; }
_bar:
movss .CPI_bar_0, %xmm0
movss 4(%esp), %xmm1
movapd %xmm1, %xmm2
subss %xmm0, %xmm2
cvttss2si %xmm2, %eax
xorl $-2147483648, %eax
cvttss2si %xmm1, %ecx
ucomiss %xmm0, %xmm1
cmovb %ecx, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22786 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 04:36:51 +00:00
Nate Begeman
d2558e3e4a
Teach the legalizer how to legalize FP_TO_UINT.
...
Teach the legalizer to promote FP_TO_UINT to FP_TO_SINT if the wider
FP_TO_UINT is also illegal. This allows us on PPC to codegen
unsigned short foo(float a) { return a; }
as:
_foo:
.LBB_foo_0: ; entry
fctiwz f0, f1
stfd f0, -8(r1)
lwz r2, -4(r1)
rlwinm r3, r2, 0, 16, 31
blr
instead of:
_foo:
.LBB_foo_0: ; entry
fctiwz f0, f1
stfd f0, -8(r1)
lwz r2, -4(r1)
lis r3, ha16(.CPI_foo_0)
lfs f0, lo16(.CPI_foo_0)(r3)
fcmpu cr0, f1, f0
blt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
fsubs f0, f1, f0
fctiwz f0, f0
stfd f0, -16(r1)
lwz r2, -12(r1)
xoris r2, r2, 32768
.LBB_foo_2: ; entry
rlwinm r3, r2, 0, 16, 31
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22785 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 01:20:53 +00:00
Nate Begeman
5a01481585
Make FP_TO_UINT Illegal. This allows us to generate significantly better
...
codegen for FP_TO_UINT by using the legalizer's SELECT variant.
Implement a codegen improvement for SELECT_CC, selecting the false node in
the MBB that feeds the phi node. This allows us to codegen:
void foo(int *a, int b, int c) { int d = (a < b) ? 5 : 9; *a = d; }
as:
_foo:
li r2, 5
cmpw cr0, r4, r3
bgt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
li r2, 9
.LBB_foo_2: ; entry
stw r2, 0(r3)
blr
insted of:
_foo:
li r2, 5
li r5, 9
cmpw cr0, r4, r3
bgt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
or r2, r5, r5
.LBB_foo_2: ; entry
stw r2, 0(r3)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22784 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-14 01:17:16 +00:00
Andrew Lenharth
40b37cc28d
Testing a variable before it is defined doesn't work so well. It is a fairly small thing, so just let everyone build the .a file
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22783 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 14:58:23 +00:00
Chris Lattner
27e5142309
Ooops, don't forget to clear this. The real inner loop is now:
...
.LBB_foo_3: ; no_exit.1
lfd f2, 0(r9)
lfd f3, 8(r9)
fmul f4, f1, f2
fmadd f4, f0, f3, f4
stfd f4, 8(r9)
fmul f3, f1, f3
fmsub f2, f0, f2, f3
stfd f2, 0(r9)
addi r9, r9, 16
addi r8, r8, 1
cmpw cr0, r8, r4
ble .LBB_foo_3 ; no_exit.1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22782 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 07:42:01 +00:00
Chris Lattner
934520a747
Recursively scan scev expressions for common subexpressions. This allows us
...
to handle nested loops much better, for example, by being able to tell that
these two expressions:
{( 8 + ( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp 12)}<loopentry.1>
{(( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp12)}<loopentry.1>
Have the following common part that can be shared:
{(( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp12)}<loopentry.1>
This allows us to codegen an important inner loop in 168.wupwise as:
.LBB_foo_4: ; no_exit.1
lfd f2, 16(r9)
fmul f3, f0, f2
fmul f2, f1, f2
fadd f4, f3, f2
stfd f4, 8(r9)
fsub f2, f3, f2
stfd f2, 16(r9)
addi r8, r8, 1
addi r9, r9, 16
cmpw cr0, r8, r4
ble .LBB_foo_4 ; no_exit.1
instead of:
.LBB_foo_3: ; no_exit.1
lfdx f2, r6, r9
add r10, r6, r9
lfd f3, 8(r10)
fmul f4, f1, f2
fmadd f4, f0, f3, f4
stfd f4, 8(r10)
fmul f3, f1, f3
fmsub f2, f0, f2, f3
stfdx f2, r6, r9
addi r9, r9, 16
addi r8, r8, 1
cmpw cr0, r8, r4
ble .LBB_foo_3 ; no_exit.1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22781 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 07:27:18 +00:00
Nate Begeman
ff66368a5f
Remove an unncessary argument to SimplifySelectCC and add an additional
...
assert when creating a select_cc node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22780 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 06:14:17 +00:00
Nate Begeman
32c392a3a5
Fix the fabs regression on x86 by abstracting the select_cc optimization
...
out into SimplifySelectCC. This allows both ISD::SELECT and ISD::SELECT_CC
to use the same set of simplifying folds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22779 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 06:00:21 +00:00
Nate Begeman
8f331325a2
Remove support for 64b PPC, it's been broken for a long time. It'll be
...
back once a DAG->DAG ISel exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22778 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 05:59:16 +00:00
Andrew Lenharth
7ac17529d2
Fix oversized GOT problem with gcc-4 on alpha
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22777 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 05:09:50 +00:00
Chris Lattner
0ae380a8ac
Teach SplitCriticalEdge to update LoopInfo if it is alive. This fixes
...
a problem in LoopStrengthReduction, where it would split critical edges
then confused itself with outdated loop information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22776 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 01:38:43 +00:00
Chris Lattner
8385393dc8
remove dead code. The exit block list is computed on demand, thus does not
...
need to be updated. This code is a relic from when it did.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22775 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 01:30:36 +00:00
Chris Lattner
3e27b1f5c4
implement a couple of simple shift foldings.
...
e.g. (X & 7) >> 3 -> 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22774 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 23:54:58 +00:00
Jim Laskey
cf083e312c
Fix for 2005-08-12-rlwimi-crash.ll. Make allowance for masks being shifted to
...
zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22773 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 23:52:46 +00:00
Jim Laskey
847c3a976b
1. This changes handles the cases of (~x)&y and x&(~y) yielding ANDC, and
...
(~x)|y and x|(~y) yielding ORC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22771 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 23:38:02 +00:00
Chris Lattner
c60fb08f7e
When splitting critical edges, make sure not to leave the new block in the
...
middle of the loop. This turns a critical loop in gzip into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
bne .LBB_test_8 ; loopentry.loopexit_crit_edge
.LBB_test_2: ; shortcirc_next.0
add r28, r3, r27
lhz r28, 5(r28)
add r26, r4, r27
lhz r26, 5(r26)
cmpw cr0, r28, r26
bne .LBB_test_7 ; shortcirc_next.0.loopexit_crit_edge
.LBB_test_3: ; shortcirc_next.1
add r28, r3, r27
lhz r28, 7(r28)
add r26, r4, r27
lhz r26, 7(r26)
cmpw cr0, r28, r26
bne .LBB_test_6 ; shortcirc_next.1.loopexit_crit_edge
.LBB_test_4: ; shortcirc_next.2
add r28, r3, r27
lhz r26, 9(r28)
add r28, r4, r27
lhz r25, 9(r28)
addi r28, r27, 8
cmpw cr7, r26, r25
mfcr r26, 1
rlwinm r26, r26, 31, 31, 31
add r25, r8, r27
cmpw cr7, r25, r7
mfcr r25, 1
rlwinm r25, r25, 29, 31, 31
and. r26, r26, r25
bne .LBB_test_1 ; loopentry
instead of this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_test_9 ; loopexit
.LBB_test_3: ; shortcirc_next.0
add r28, r3, r27
lhz r28, 5(r28)
add r26, r4, r27
lhz r26, 5(r26)
cmpw cr0, r28, r26
beq .LBB_test_5 ; shortcirc_next.1
.LBB_test_4: ; shortcirc_next.0.loopexit_crit_edge
add r2, r11, r27
add r8, r12, r27
b .LBB_test_9 ; loopexit
.LBB_test_5: ; shortcirc_next.1
add r28, r3, r27
lhz r28, 7(r28)
add r26, r4, r27
lhz r26, 7(r26)
cmpw cr0, r28, r26
beq .LBB_test_7 ; shortcirc_next.2
.LBB_test_6: ; shortcirc_next.1.loopexit_crit_edge
add r2, r9, r27
add r8, r10, r27
b .LBB_test_9 ; loopexit
.LBB_test_7: ; shortcirc_next.2
add r28, r3, r27
lhz r26, 9(r28)
add r28, r4, r27
lhz r25, 9(r28)
addi r28, r27, 8
cmpw cr7, r26, r25
mfcr r26, 1
rlwinm r26, r26, 31, 31, 31
add r25, r8, r27
cmpw cr7, r25, r7
mfcr r25, 1
rlwinm r25, r25, 29, 31, 31
and. r26, r26, r25
bne .LBB_test_1 ; loopentry
Next up, improve the code for the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22769 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 22:22:17 +00:00
Chris Lattner
6a13aed525
Add a helper method
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22768 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 22:14:06 +00:00
Chris Lattner
e0391beda8
Fix a FIXME: if we are inserting code for a PHI argument, split the critical
...
edge so that the code is not always executed for both operands. This
prevents LSR from inserting code into loops whose exit blocks contain
PHI uses of IV expressions (which are outside of loops). On gzip, for
example, we turn this ugly code:
.LBB_test_1: ; loopentry
add r27, r3, r28
lhz r27, 3(r27)
add r26, r4, r28
lhz r26, 3(r26)
add r25, r30, r28 ;; Only live if exiting the loop
add r24, r29, r28 ;; Only live if exiting the loop
cmpw cr0, r27, r26
bne .LBB_test_5 ; loopexit
into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_test_9 ; loopexit
.LBB_test_2: ; shortcirc_next.0
...
blt .LBB_test_1
into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_t_3: ; shortcirc_next.0
.LBB_test_3: ; shortcirc_next.0
...
blt .LBB_test_1
Next step: get the block out of the loop so that the loop is all
fall-throughs again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22766 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 22:06:11 +00:00
Chris Lattner
b01bfd49c3
Change break critical edges to not remove, then insert, PHI node entries.
...
Instead, just update the BB in-place. This is both faster, and it prevents
split-critical-edges from shuffling the PHI argument list unneccesarily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22765 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 21:58:07 +00:00
Andrew Lenharth
1f3e808ebf
match gcc's use of tabs, makes diffs easier
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22764 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 16:14:08 +00:00
Andrew Lenharth
21e786bdb4
.section cleanup, patch from Nicholas Riley
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22763 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 16:13:43 +00:00
Jim Laskey
191cf943e6
1. Added the function isOpcWithIntImmediate to simplify testing of operand with
...
specified opcode and an integer constant right operand.
2. Modified ISD::SHL, ISD::SRL, ISD::SRA to use rlwinm when applied after a mask.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22761 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-11 21:59:23 +00:00
Chris Lattner
2b48bc6f95
Tidied up the use of dyn_cast<ConstantSDNode> by using isIntImmediate more.
...
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22760 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-11 17:56:50 +00:00
Chris Lattner
54abfc5ee4
Use a more efficient method of creating integer and float virtual registers
...
(avoids an extra level of indirection in MakeReg).
defined MakeIntReg using RegMap->createVirtualRegister(PPC32::GPRCRegisterClass)
defined MakeFPReg using RegMap->createVirtualRegister(PPC32::FPRCRegisterClass)
s/MakeReg(MVT::i32)/MakeIntReg/
s/MakeReg(MVT::f64)/MakeFPReg/
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22759 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-11 17:15:31 +00:00
Nate Begeman
e1fae4a3ae
Add a select_cc optimization for recognizing abs(int). This speeds up an
...
integer MPEG encoding loop by a factor of two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22758 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-11 02:18:13 +00:00
Nate Begeman
e5d63829fd
Some SELECT_CC cleanups:
...
1. move assertions for node creation to getNode()
2. legalize the values returned in ExpandOp immediately
3. Move select_cc optimizations from SELECT's getNode() to SELECT_CC's,
allowing them to be cleaned up significantly.
This paves the way to pick up additional optimizations on SELECT_CC, such
as sum-of-absolute-differences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22757 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-11 01:12:20 +00:00
Nate Begeman
c24d484b78
Make SELECT illegal on PPC32, switch to using SELECT_CC, which more closely
...
reflects what the hardware is capable of. This significantly simplifies
the CC handling logic throughout the ISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22756 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 20:52:09 +00:00
Nate Begeman
9373a81e53
Add new node, SELECT_CC. This node is for targets that don't natively
...
implement SELECT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22755 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 20:51:12 +00:00
Chris Lattner
b4138c475e
Changes for PPC32ISelPattern.cpp
...
1. Clean up how SelectIntImmediateExpr handles use counts.
2. "Subtract from" was not clearing hi 16 bits.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22754 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 18:11:33 +00:00
Chris Lattner
7c6e452d44
Fix an oversight that may be causing PR617.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22753 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 17:37:53 +00:00
Chris Lattner
98599ba6c6
remove some trickiness that broke yacr2 and some other programs last night
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22751 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 17:15:20 +00:00
Chris Lattner
df706e3f0c
Changed the XOR case to use the isOprNot predicate.
...
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22750 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 16:35:46 +00:00
Chris Lattner
0d7d99fd44
1. Refactored handling of integer immediate values for add, or, xor and sub.
...
New routine: ISel::SelectIntImmediateExpr
2. Now checking use counts of large constants. If use count is > 2 then drop
thru so that the constant gets loaded into a register.
Source:
int %test1(int %a) {
entry:
%tmp.1 = add int %a, 123456789 ; <int> [#uses=1]
%tmp.2 = or int %tmp.1, 123456789 ; <int> [#uses=1]
%tmp.3 = xor int %tmp.2, 123456789 ; <int> [#uses=1]
%tmp.4 = sub int %tmp.3, -123456789 ; <int> [#uses=1]
ret int %tmp.4
}
Did Emit:
.machine ppc970
.text
.align 2
.globl _test1
_test1:
.LBB_test1_0: ; entry
addi r2, r3, -13035
addis r2, r2, 1884
ori r2, r2, 52501
oris r2, r2, 1883
xori r2, r2, 52501
xoris r2, r2, 1883
addi r2, r2, 52501
addis r3, r2, 1883
blr
Now Emits:
.machine ppc970
.text
.align 2
.globl _test1
_test1:
.LBB_test1_0: ; entry
lis r2, 1883
ori r2, r2, 52501
add r3, r3, r2
or r3, r3, r2
xor r3, r3, r2
add r3, r3, r2
blr
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22749 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 16:34:52 +00:00
Duraid Madina
d2ff5ef654
sorry!! this is temporary; for some reason the nasty constmul code seems to
...
be an infinite loop when using g++-4.0.1*, this kills the ia64 nightly
tester. A proper fix shall be forthcoming!!! thanks for not killing me. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22748 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 12:38:57 +00:00
Chris Lattner
979a21e766
Fix a bug compiling: select (i32 < i32), f32, f32
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22747 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 03:40:09 +00:00
Chris Lattner
94f4032448
Make loop-simplify produce better loops by turning PHI nodes like X = phi [X, Y]
...
into just Y. This often occurs when it seperates loops that have collapsed loop
headers. This implements LoopSimplify/phi-node-simplify.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22746 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 02:07:32 +00:00
Chris Lattner
cda9ca5a4f
Allow indvar simplify to canonicalize ANY affine IV, not just affine IVs with
...
constant stride. This implements Transforms/IndVarsSimplify/variable-stride-ivs.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22744 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 01:12:06 +00:00
Chris Lattner
05bd374b1f
Fix an obvious oops
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22742 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 00:59:40 +00:00
Chris Lattner
50fad70279
Teach LSR to strength reduce IVs that have a loop-invariant but non-constant stride.
...
For code like this:
void foo(float *a, float *b, int n, int stride_a, int stride_b) {
int i;
for (i=0; i<n; i++)
a[i*stride_a] = b[i*stride_b];
}
we now emit:
.LBB_foo2_2: ; no_exit
lfs f0, 0(r4)
stfs f0, 0(r3)
addi r7, r7, 1
add r4, r2, r4
add r3, r6, r3
cmpw cr0, r7, r5
blt .LBB_foo2_2 ; no_exit
instead of:
.LBB_foo_2: ; no_exit
mullw r8, r2, r7 ;; multiply!
slwi r8, r8, 2
lfsx f0, r4, r8
mullw r8, r2, r6 ;; multiply!
slwi r8, r8, 2
stfsx f0, r3, r8
addi r2, r2, 1
cmpw cr0, r2, r5
blt .LBB_foo_2 ; no_exit
loops with variable strides occur pretty often. For example, in SPECFP2K
there are 317 variable strides in 177.mesa, 3 in 179.art, 14 in 188.ammp,
56 in 168.wupwise, 36 in 172.mgrid.
Now we can allow indvars to turn functions written like this:
void foo2(float *a, float *b, int n, int stride_a, int stride_b) {
int i, ai = 0, bi = 0;
for (i=0; i<n; i++)
{
a[ai] = b[bi];
ai += stride_a;
bi += stride_b;
}
}
into code like the above for better analysis. With this patch, they generate
identical code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22740 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 00:45:21 +00:00
Chris Lattner
c41e34520a
Fix Regression/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll
...
by being more careful about updating PHI nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22739 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 00:35:32 +00:00
Chris Lattner
87265abffc
Fix some 80 column violations.
...
Once we compute the evolution for a GEP, tell SE about it. This allows users
of the GEP to know it, if the users are not direct. This allows us to compile
this testcase:
void fbSolidFillmmx(int w, unsigned char *d) {
while (w >= 64) {
*(unsigned long long *) (d + 0) = 0;
*(unsigned long long *) (d + 8) = 0;
*(unsigned long long *) (d + 16) = 0;
*(unsigned long long *) (d + 24) = 0;
*(unsigned long long *) (d + 32) = 0;
*(unsigned long long *) (d + 40) = 0;
*(unsigned long long *) (d + 48) = 0;
*(unsigned long long *) (d + 56) = 0;
w -= 64;
d += 64;
}
}
into:
.LBB_fbSolidFillmmx_2: ; no_exit
li r2, 0
stw r2, 0(r4)
stw r2, 4(r4)
stw r2, 8(r4)
stw r2, 12(r4)
stw r2, 16(r4)
stw r2, 20(r4)
stw r2, 24(r4)
stw r2, 28(r4)
stw r2, 32(r4)
stw r2, 36(r4)
stw r2, 40(r4)
stw r2, 44(r4)
stw r2, 48(r4)
stw r2, 52(r4)
stw r2, 56(r4)
stw r2, 60(r4)
addi r4, r4, 64
addi r3, r3, -64
cmpwi cr0, r3, 63
bgt .LBB_fbSolidFillmmx_2 ; no_exit
instead of:
.LBB_fbSolidFillmmx_2: ; no_exit
li r11, 0
stw r11, 0(r4)
stw r11, 4(r4)
stwx r11, r10, r4
add r12, r10, r4
stw r11, 4(r12)
stwx r11, r9, r4
add r12, r9, r4
stw r11, 4(r12)
stwx r11, r8, r4
add r12, r8, r4
stw r11, 4(r12)
stwx r11, r7, r4
add r12, r7, r4
stw r11, 4(r12)
stwx r11, r6, r4
add r12, r6, r4
stw r11, 4(r12)
stwx r11, r5, r4
add r12, r5, r4
stw r11, 4(r12)
stwx r11, r2, r4
add r12, r2, r4
stw r11, 4(r12)
addi r4, r4, 64
addi r3, r3, -64
cmpwi cr0, r3, 63
bgt .LBB_fbSolidFillmmx_2 ; no_exit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22737 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 23:39:36 +00:00
Chris Lattner
a0740fbcc7
implement two helper methods
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22736 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 23:36:33 +00:00
Chris Lattner
bd8625b062
Fix spelling, fix some broken canonicalizations by my last patch
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22734 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 23:09:05 +00:00
Chris Lattner
c7e18a10d4
add a optimization note
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22732 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 22:30:57 +00:00
Chris Lattner
079a27a0de
add cc nodes to the AllNodes list so they show up in Graphviz output
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22731 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 20:40:02 +00:00
Chris Lattner
88ac32ca26
Update the targets to the new SETCC/CondCodeSDNode interfaces.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22729 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 20:21:10 +00:00
Chris Lattner
7cf7e3f33f
Eliminate the SetCCSDNode in favor of a CondCodeSDNode class. This pulls the
...
CC out of the SetCC operation, making SETCC a standard ternary operation and
CC's a standard DAG leaf. This will make it possible for other node to use
CC's as operands in the future...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22728 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 20:20:18 +00:00
Chris Lattner
59b21c25d4
Minor cleanup patch, no functionality changes. Written by Jim Laskey.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22727 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 18:29:55 +00:00
Chris Lattner
2f46055cc2
Fix CodeGen/Generic/div-neg-power-2.ll, a regression from last night.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22726 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 18:08:41 +00:00
Chris Lattner
b965ee5914
SCEVAddExpr::get() of an empty list is invalid.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22724 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 01:13:47 +00:00
Chris Lattner
1bbae0cbf2
Implement: LoopStrengthReduce/share_ivs.ll
...
Two changes:
* Only insert one PHI node for each stride. Other values are live in
values. This cannot introduce higher register pressure than the
previous approach, and can take advantage of reg+reg addressing modes.
* Factor common base values out of uses before moving values from the
base to the immediate fields. This improves codegen by starting the
stride-specific PHI node out at a common place for each IV use.
As an example, we used to generate this for a loop in swim:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfd f0, 0(r8)
stfd f0, 0(r3)
lfd f0, 0(r6)
stfd f0, 0(r7)
lfd f0, 0(r2)
stfd f0, 0(r5)
addi r9, r9, 1
addi r2, r2, 8
addi r5, r5, 8
addi r6, r6, 8
addi r7, r7, 8
addi r8, r8, 8
addi r3, r3, 8
cmpw cr0, r9, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
now we emit:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfdx f0, r8, r2
stfdx f0, r9, r2
lfdx f0, r5, r2
stfdx f0, r7, r2
lfdx f0, r3, r2
stfdx f0, r6, r2
addi r10, r10, 1
addi r2, r2, 8
cmpw cr0, r10, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
As another more dramatic example, we used to emit this:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfd f0, 8(r21)
lfd f4, 8(r3)
lfd f5, 8(r27)
lfd f6, 8(r22)
lfd f7, 8(r5)
lfd f8, 8(r6)
lfd f9, 8(r30)
lfd f10, 8(r11)
lfd f11, 8(r12)
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfd f0, 8(r4)
lfd f0, 8(r25)
lfd f5, 8(r26)
lfd f6, 8(r23)
lfd f9, 8(r28)
lfd f10, 8(r10)
lfd f12, 8(r9)
lfd f13, 8(r29)
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfd f0, 8(r24)
lfd f0, 8(r8)
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfd f0, 8(r2)
addi r20, r20, 1
addi r2, r2, 8
addi r8, r8, 8
addi r10, r10, 8
addi r12, r12, 8
addi r6, r6, 8
addi r29, r29, 8
addi r28, r28, 8
addi r26, r26, 8
addi r25, r25, 8
addi r24, r24, 8
addi r5, r5, 8
addi r23, r23, 8
addi r22, r22, 8
addi r3, r3, 8
addi r9, r9, 8
addi r11, r11, 8
addi r30, r30, 8
addi r27, r27, 8
addi r21, r21, 8
addi r4, r4, 8
cmpw cr0, r20, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
we now emit:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfdx f0, r21, r20
lfdx f4, r3, r20
lfdx f5, r27, r20
lfdx f6, r22, r20
lfdx f7, r5, r20
lfdx f8, r6, r20
lfdx f9, r30, r20
lfdx f10, r11, r20
lfdx f11, r12, r20
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfdx f0, r4, r20
lfdx f0, r25, r20
lfdx f5, r26, r20
lfdx f6, r23, r20
lfdx f9, r28, r20
lfdx f10, r10, r20
lfdx f12, r9, r20
lfdx f13, r29, r20
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfdx f0, r24, r20
lfdx f0, r8, r20
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfdx f0, r2, r20
addi r19, r19, 1
addi r20, r20, 8
cmpw cr0, r19, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22722 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 00:18:09 +00:00
Chris Lattner
a553b0cc01
Suck the base value out of the UsersToProcess vector into the BasedUser
...
class to simplify the code. Fuse two loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22721 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 22:56:21 +00:00
Chris Lattner
44b807e3c0
Split MoveLoopVariantsToImediateField out from MoveImmediateValues. The
...
first is a correctness thing, and the later is an optzn thing. This also
is needed to support a future change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22720 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 22:32:34 +00:00
Nate Begeman
d3ded2d8a7
Factor out some common code, and be smarter about when to emit load hi/lo
...
code sequences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22719 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 22:22:56 +00:00
Chris Lattner
21e1a79a31
Allow tools with "consume after" options (like lli) to take more positional
...
opts than they take directly. Thanks to John C for pointing this problem
out to me!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22717 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:57:27 +00:00
Chris Lattner
0045776d33
Remove getImmediateForOpcode, which is now dead.
...
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22716 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:34:13 +00:00
Chris Lattner
fd78454477
Add new immediate handling support for mul/div.
...
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22715 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:33:23 +00:00
Chris Lattner
5b90917400
Add support for OR/XOR/SUB immediates that are handled with the new immediate
...
way. This allows ORI/ORIS pairs, for example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:30:29 +00:00
Chris Lattner
2f57c4da21
Modify the ISD::AND opcode case to use new immediate constant predicates.
...
Includes wider support for rotate and mask cases.
Patch by Jim Laskey.
I've requested that Jim add new regression tests the newly handled cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22712 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:24:57 +00:00
Chris Lattner
39c6896d22
Modify the ISD::ADD opcode case to use new immediate constant predicates.
...
Includes support for 32-bit constants using addi/addis.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22711 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:21:03 +00:00
Chris Lattner
8fd1980ce6
Modify existing support functions to use new immediate constant predicates.
...
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22710 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:12:35 +00:00
Chris Lattner
cf1cf1886e
Add support predicates for future immediate constant changes.
...
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22709 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:10:27 +00:00
Chris Lattner
02efa6c140
Move IsRunOfOnes to a more logical place and rename to a proper predicate form
...
(lowercase isXXX).
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22708 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:08:09 +00:00
Nate Begeman
394cd13ba3
Fix JIT encoding of ppc mfocrf instruction; the operands were reversed
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22707 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 20:04:52 +00:00
Chris Lattner
4bc5f8071a
Use the new 'moveBefore' method to simplify some code. Really, which is
...
easier to understand? :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22706 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 19:11:57 +00:00
Chris Lattner
de0132453e
Reject command lines that have too many positional arguments passed (e.g.,
...
'opt x y'). This fixes PR493.
Patch contributed by Owen Anderson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22705 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 17:25:38 +00:00
Chris Lattner
3821e478a5
Not all constants are legal immediates in load/store instructions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22704 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 06:25:50 +00:00
Chris Lattner
5272f3c669
Implement LoopStrengthReduce/share_code_in_preheader.ll by having one
...
rewriter for all code inserted into the preheader, which is never flushed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22702 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 05:47:49 +00:00
Chris Lattner
010de25f42
Implement a simple optimization for the termination condition of the loop.
...
The termination condition actually wants to use the post-incremented value
of the loop, not a new indvar with an unusual base.
On PPC, for example, this allows us to compile
LoopStrengthReduce/exit_compare_live_range.ll to:
_foo:
li r2, 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
cmpw cr0, r2, r4
bne .LBB_foo_1 ; no_exit
blr
instead of:
_foo:
li r2, 1 ;; IV starts at 1, not 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r5, r2, 1
cmpw cr0, r2, r4
or r2, r5, r5 ;; Reg-reg copy, extra live range
bne .LBB_foo_1 ; no_exit
blr
This implements LoopStrengthReduce/exit_compare_live_range.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22699 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 05:28:22 +00:00
Chris Lattner
0fe34d8912
add new helper function
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22698 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 05:21:50 +00:00
Chris Lattner
660538c8a5
Handle 64-bit constant exprs on 64-bit targets.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22696 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 04:26:32 +00:00
Chris Lattner
bbf728edeb
All stats are "Number of ..."
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22694 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-07 20:02:04 +00:00
Chris Lattner
2b83af2d0f
Add some simple folds that occur in bitfield cases. Fix a minor bug in
...
isHighOnes, where it would consider 0 to have high ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22693 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-07 07:03:10 +00:00
Chris Lattner
4c0e4cdc40
Fix typoCVS: ----------------------------------------------------------------------
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22692 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-07 07:00:52 +00:00
Chris Lattner
bf3fa976ee
add a small simplification that can be exposed after promotion/expansion
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22691 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-07 05:00:44 +00:00
Chris Lattner
ce869ee05b
* Use the new PHINode::hasConstantValue method to simplify some code
...
* Teach this code to move allocas out of the loop when tail call eliminating
a call marked 'tail'. This implements TailCallElim/move_alloca_for_tail_call.ll
* Do not perform this transformation if a call is marked 'tail' and if there
are allocas that we cannot move out of the loop in #2 . Doing so would increase
the stack usage of the function. This implements fixes
PR615 and TailCallElim/dont-tce-tail-marked-call.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22690 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-07 04:27:41 +00:00
Chris Lattner
3c304a3ba1
Consolidate the GPOpt stuff to all use the Subtarget, instead of still
...
depending on the command line option. Now the command line option just
sets the subtarget as appropriate. G5 opts will now default to on on
G5-enabled nightly testers among other machines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22688 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 22:05:03 +00:00
Chris Lattner
8c4a8735ec
adjust to change in getSubtarget() api
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22687 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 21:54:27 +00:00
Chris Lattner
ba25365140
Enable gp optimizations by default when available, even when a target triple
...
is available, since the target triple doesn't specify whether to use gpopts
or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22685 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 21:25:13 +00:00
Chris Lattner
6281ae4bf0
add a note
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22681 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 19:18:32 +00:00
Chris Lattner
82299e7097
Change FindEarliestCallSeqEnd (used by libcall insertion) to use a set to
...
avoid revisiting nodes more than once. This eliminates a source of
potentially exponential behavior. For a small function in 191.fma3d
(hexah_stress_divergence_), this speeds up isel from taking > 20mins to
taking 0.07s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22680 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 18:10:27 +00:00
Chris Lattner
c534395cb2
Fix a use-of-dangling-pointer bug, from the introduction of SrcValue's.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22679 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 16:55:31 +00:00
Chris Lattner
2f4eca30d1
Fix a latent bug in the libcall inserter that was exposed by Nate's patch
...
yesterday. This fixes whetstone and a bunch of programs in the External tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22678 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 16:23:57 +00:00
Chris Lattner
4e624ecd07
don't crash when running the PPC backend on non-ppc hosts without specifying
...
a subtarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22677 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 16:17:22 +00:00
Chris Lattner
d7231ac523
PHINode::hasConstantValue should never return the PHI itself, even if the
...
PHI is its only operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22676 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 15:37:31 +00:00
Chris Lattner
80f4d88a97
Fix an iterator invalidation problem when we decide a phi has a constant value
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22675 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 15:34:10 +00:00
Chris Lattner
9a59fbb896
Make sure to clean CastedPointers after casts are potentially deleted.
...
This fixes LSR crashes on 301.apsi, 191.fma3d, and 189.lucas
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22673 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 01:30:11 +00:00
Chris Lattner
68ee736694
now that hasConstantValue defaults to only returning values that dominate
...
the PHI node, this ugly code can vanish.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22672 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 01:04:30 +00:00
Chris Lattner
8313a25d27
Invoke instructions do not dominate all successors
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22671 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 01:03:27 +00:00
Chris Lattner
1325b42a7d
Now that hasConstantValue is more careful w.r.t. returning values that only
...
dominate the PHI node, this code can go away. This also makes passes more
aggressive, e.g. implementing Transforms/CondProp/phisimplify2.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22670 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 01:02:04 +00:00
Chris Lattner
b3b48e11da
Use the bool argument to hasConstantValue to decide whether the client is
...
prepared to deal with return values that do not dominate the PHI. If we
cannot prove that the result dominates the PHI node, do not return it if
the client can't cope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22669 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 01:00:58 +00:00
Chris Lattner
5e1b231921
This code can handle non-dominating instructions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 00:57:45 +00:00
Chris Lattner
9acbd611ec
Mark hasConstantValue as a const method
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22666 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 00:49:06 +00:00
Nate Begeman
c523f4c096
Add an extra parameter that Chris requested
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22665 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 23:50:43 +00:00
Nate Begeman
a83ba0f5c9
Fix a fixme in CondPropagate.cpp by moving a PhiNode optimization into
...
BasicBlock's removePredecessor routine. This requires shuffling around
the definition and implementation of hasContantValue from Utils.h,cpp into
Instructions.h,cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22664 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 23:24:19 +00:00
Chris Lattner
26d91f1646
Modify how immediates are removed from base expressions to deal with the fact
...
that the symbolic evaluator is not always able to use subtraction to remove
expressions. This makes the code faster, and fixes the last crash on 178.galgel.
Finally, add a statistic to see how many phi nodes are inserted.
On 178.galgel, we get the follow stats:
2562 loop-reduce - Number of PHIs inserted
3927 loop-reduce - Number of GEPs strength reduced
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22662 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 22:34:05 +00:00
Nate Begeman
2ac4fc0320
Fix a fixme in LegalizeDAG
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22661 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 21:43:28 +00:00
Nate Begeman
99558806f8
Hack to naturally align doubles in the constant pool. Remove this once we
...
know what The Right Thing To Do is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22660 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 21:04:09 +00:00
Nate Begeman
3d72d14887
Use the new subtarget support to automatically choose the correct ABI
...
and asm printer for PowerPC if one is not specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22659 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 20:49:48 +00:00
Chris Lattner
2114b273ef
* Refactor some code into a new BasedUser::RewriteInstructionToUseNewBase
...
method.
* Fix a crash on 178.galgel, where we would insert expressions before PHI
nodes instead of into the PHI node predecessor blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22657 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 20:03:32 +00:00
Chris Lattner
7a2ca56ef3
Fix a case that caused this to crash on 178.galgel
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22653 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 19:26:19 +00:00
Chris Lattner
7db543f887
Teach LSR about loop-variant expressions, such as loops like this:
...
for (i = 0; i < N; ++i)
A[i][foo()] = 0;
here we still want to strength reduce the A[i] part, even though foo() is
l-v.
This also simplifies some of the 'CanReduce' logic.
This implements Transforms/LoopStrengthReduce/ops_after_indvar.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22652 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 19:08:16 +00:00
Nate Begeman
f08341457f
Remove some more dead code.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22650 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 18:13:56 +00:00
Chris Lattner
3416e5f645
Refactor this code substantially with the following improvements:
...
1. We only analyze instructions once, guaranteed
2. AnalyzeGetElementPtrUsers has been ripped apart and replaced with
something much simpler.
The next step is to handle expressions that are not all indvar+loop-invariant
values (e.g. handling indvar+loopvariant).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 17:40:30 +00:00
Andrew Lenharth
3f55a4fcab
No, IDEFs shouldn't be JITed
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22648 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 15:32:36 +00:00
Misha Brukman
cd33eef1b2
* Unbreak release build
...
* Add comments to #endif pragmas for readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22647 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 14:22:41 +00:00
Misha Brukman
e2d7fdf62c
* Unbreak optimized build (noticed by Eric van Riet Paap)
...
* Comment #endif clauses for readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22646 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 14:16:48 +00:00
Nate Begeman
8c00f8cdc7
Add Subtarget support to PowerPC. Next up, using it.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22644 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 07:12:09 +00:00
Chris Lattner
49f72e68cf
refactor some code
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22643 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 01:19:13 +00:00
Chris Lattner
a4479ad25f
invert to if's to make the logic simpler
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22641 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 00:40:47 +00:00
Chris Lattner
f9186596f0
When processing outer loops and we find uses of an IV in inner loops, make
...
sure to handle the use, just don't recurse into it.
This permits us to generate this code for a simple nested loop case:
.LBB_foo_0: ; entry
stwu r1, -48(r1)
stw r29, 44(r1)
stw r30, 40(r1)
mflr r11
stw r11, 56(r1)
lis r2, ha16(L_A$non_lazy_ptr)
lwz r30, lo16(L_A$non_lazy_ptr)(r2)
li r29, 1
.LBB_foo_1: ; no_exit.0
bl L_bar$stub
li r2, 1
or r3, r30, r30
.LBB_foo_2: ; no_exit.1
lfd f0, 8(r3)
stfd f0, 0(r3)
addi r4, r2, 1
addi r3, r3, 8
cmpwi cr0, r2, 100
or r2, r4, r4
bne .LBB_foo_2 ; no_exit.1
.LBB_foo_3: ; loopexit.1
addi r30, r30, 800
addi r2, r29, 1
cmpwi cr0, r29, 100
or r29, r2, r2
bne .LBB_foo_1 ; no_exit.0
.LBB_foo_4: ; return
lwz r11, 56(r1)
mtlr r11
lwz r30, 40(r1)
lwz r29, 44(r1)
lwz r1, 0(r1)
blr
instead of this:
_foo:
.LBB_foo_0: ; entry
stwu r1, -48(r1)
stw r28, 44(r1) ;; uses an extra register.
stw r29, 40(r1)
stw r30, 36(r1)
mflr r11
stw r11, 56(r1)
li r30, 1
li r29, 0
or r28, r29, r29
.LBB_foo_1: ; no_exit.0
bl L_bar$stub
mulli r2, r28, 800 ;; unstrength-reduced multiply
lis r3, ha16(L_A$non_lazy_ptr) ;; loop invariant address computation
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
mulli r4, r29, 800 ;; unstrength-reduced multiply
addi r3, r3, 8
add r3, r4, r3
li r4, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 0(r3)
stfd f0, 0(r2)
addi r5, r4, 1
addi r2, r2, 8 ;; multiple stride 8 IV's
addi r3, r3, 8
cmpwi cr0, r4, 100
or r4, r5, r5
bne .LBB_foo_2 ; no_exit.1
.LBB_foo_3: ; loopexit.1
addi r28, r28, 1 ;;; Many IV's with stride 1
addi r29, r29, 1
addi r2, r30, 1
cmpwi cr0, r30, 100
or r30, r2, r2
bne .LBB_foo_1 ; no_exit.0
.LBB_foo_4: ; return
lwz r11, 56(r1)
mtlr r11
lwz r30, 36(r1)
lwz r29, 40(r1)
lwz r28, 44(r1)
lwz r1, 0(r1)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22640 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 00:14:11 +00:00
Chris Lattner
7a65839f41
Teach loop-reduce to see into nested loops, to pull out immediate values
...
pushed down by SCEV.
In a nested loop case, this allows us to emit this:
lis r3, ha16(L_A$non_lazy_ptr)
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
li r3, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 8(r2) ;; Uses offset of 8 instead of 0
stfd f0, 0(r2)
addi r4, r3, 1
addi r2, r2, 8
cmpwi cr0, r3, 100
or r3, r4, r4
bne .LBB_foo_2 ; no_exit.1
instead of this:
lis r3, ha16(L_A$non_lazy_ptr)
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
addi r3, r3, 8
li r4, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 0(r3)
stfd f0, 0(r2)
addi r5, r4, 1
addi r2, r2, 8
addi r3, r3, 8
cmpwi cr0, r4, 100
or r4, r5, r5
bne .LBB_foo_2 ; no_exit.1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22639 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 23:44:42 +00:00
Chris Lattner
be3e5212e2
improve debug output
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22638 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 23:30:08 +00:00
Nate Begeman
1c73c7be9d
Scalar SSE: load +0.0 -> xorps/xorpd
...
Scalar SSE: a < b ? c : 0.0 -> cmpss, andps
Scalar SSE: float -> i16 needs to be promoted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22637 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 23:26:28 +00:00
Chris Lattner
2351abaeab
Move from Stage 0 to Stage 1.
...
Only emit one PHI node for IV uses with identical bases and strides (after
moving foldable immediates to the load/store instruction).
This implements LoopStrengthReduce/dont_insert_redundant_ops.ll, allowing
us to generate this PPC code for test1:
or r30, r3, r3
.LBB_test1_1: ; Loop
li r2, 0
stw r2, 0(r30)
stw r2, 4(r30)
bl L_pred$stub
addi r30, r30, 8
cmplwi cr0, r3, 0
bne .LBB_test1_1 ; Loop
instead of this code:
or r30, r3, r3
or r29, r3, r3
.LBB_test1_1: ; Loop
li r2, 0
stw r2, 0(r29)
stw r2, 4(r30)
bl L_pred$stub
addi r30, r30, 8 ;; Two iv's with step of 8
addi r29, r29, 8
cmplwi cr0, r3, 0
bne .LBB_test1_1 ; Loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22635 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 22:51:21 +00:00
Andrew Lenharth
dc7c0b8c22
Alpha ABI specifies stack is always 16 byte alligned, and gcc does it, so I will too
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22634 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 22:33:21 +00:00
Chris Lattner
ec3fb63af2
Rename IVUse to IVUsersOfOneStride, use a struct instead of a pair to
...
unify some parallel vectors and get field names more descriptive than
"first" and "second". This isn't lisp afterall :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22633 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 22:21:05 +00:00
Chris Lattner
52d83e66ee
Fix a nasty dangling pointer issue. The ScalarEvolution pass would keep a
...
map from instruction* to SCEVHandles. When we delete instructions, we have
to tell it about it. We would run into nasty cases where new instructions
were reallocated at old instruction addresses and get the old map values.
Bad bad bad :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22632 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 21:36:09 +00:00
Chris Lattner
4c64dd7977
Fix PR611, codegen'ing SREM of FP operands to fmod or fmodf instead of
...
the sequence used for integer ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 20:31:37 +00:00
Chris Lattner
f1adce42b2
The correct fix for PR612, which also fixes
...
Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22628 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 18:51:44 +00:00
Chris Lattner
6e459bf0a7
When inserting code, make sure not to insert it before PHI nodes. This
...
fixes PR612 and Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22626 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 18:34:29 +00:00
Chris Lattner
6306d07aa8
Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem that
...
occurred while bugpointing another testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22621 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 17:59:45 +00:00
Chris Lattner
b06f677c53
add support for Graphviz when viewing CFGs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22620 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 17:55:05 +00:00
Misha Brukman
0a3f677f09
Fix grammar: apostrophe-s ('s) is possessive, not plural; also iff vs. if.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22619 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 17:29:52 +00:00
Chris Lattner
a34cbcc50a
minor capitalization thing, patch by Jim Laskey
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22617 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 16:52:22 +00:00
Chris Lattner
1aad921c18
Finally, add the required constraint checks to fix Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
...
the right way
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22615 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:59:12 +00:00
Chris Lattner
dc88dbeafa
Simplify some code, add the correct pred checks
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22613 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:38:27 +00:00
Chris Lattner
3b3efc7797
Refactor code out of PropagatePredecessorsForPHIs, turning it into a pure function with no side-effects
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22612 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:29:26 +00:00
Chris Lattner
d423b8b6ca
use splice instead of remove/insert to avoid some symtab operations
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22611 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:23:42 +00:00
Chris Lattner
2bdcb56146
move two functions up in the file, use SafeToMergeTerminators to eliminate
...
some duplicated code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22610 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:19:45 +00:00
Chris Lattner
7e66348cba
Rip some code out of the main SimplifyCFG function into a subfunction and
...
call it from the only place it is live. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22609 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:11:16 +00:00
Chris Lattner
17de414965
Disable this patch:
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050801/027345.html
This breaks real programs and only fixes an obscure regression testcase. A
real fix is in development.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 23:31:38 +00:00
Chris Lattner
f5e982daa8
Change a place to use an arbitrary value instead of null, when possible
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22605 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 23:29:23 +00:00
Chris Lattner
9e17df80ca
one more hunk that got dropped
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22596 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:35:29 +00:00
Chris Lattner
c0d590b6f2
This hunk accidentally got dropped. Patch by Jim Laskey
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:30:55 +00:00
Chris Lattner
0561b3ff9f
Update to use the new MathExtras.h support for log2 computation.
...
Patch contributed by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22594 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:26:06 +00:00
Chris Lattner
bcd7db59d0
Update to use the new MathExtras.h support for log2 computation.
...
Patch contributed by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22592 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:16:58 +00:00
Chris Lattner
3f270130b5
add a pass name to make debugging dumps nicer
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22588 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:07:49 +00:00
Misha Brukman
15d89cba85
Fix grammar: it's == "it is".
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22587 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 16:04:59 +00:00
Chris Lattner
8105c76da4
Like the comment says, do not insert cast instructions before phi nodes
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22586 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 03:31:14 +00:00
Jeff Cohen
64fe58490d
It's dangerous coding on Mondays.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22585 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 03:26:32 +00:00
Chris Lattner
1593ac259d
This code was very close, but not quite right. It did not take into
...
consideration the case where a reference in an unreachable block could
occur. This fixes Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll,
something I ran into while bugpoint'ing another pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22584 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 03:24:05 +00:00
Jeff Cohen
ee841a1a87
Implement SetInterruptFunction for Windows.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22582 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 03:04:47 +00:00
Chris Lattner
7e608bbb5d
add a comment, make a check more lenient
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22581 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:52:02 +00:00
Chris Lattner
e9100c69cb
Simplify for loop, clear a per-loop map after processing each loop
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22580 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:44:31 +00:00
Chris Lattner
fa8c292ebd
Implement sys::SetInterruptFunction on Unix, stub it on win32 so that the
...
build will not fail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22578 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:14:22 +00:00
Chris Lattner
07cd0ff298
Add a comment
...
Make LSR ignore GEP's that have loop variant base values, as we currently
cannot codegen them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22576 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 01:32:29 +00:00
Chris Lattner
1060e09fb2
Fix an iterator invalidation problem
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22575 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 00:41:11 +00:00
Chris Lattner
8dcd5483bc
200.sixtrack prints FP numbers with a very strange notation that uses D
...
instead of E for exponentials (e.g. 1.234D-43). Add support for this
notation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22574 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 00:11:53 +00:00
Andrew Lenharth
5bca0da936
update function codes to reflect /su flags that have been added since this was written
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22571 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 20:06:01 +00:00
Chris Lattner
e21c305ed8
Fix casts from long to sbyte on ppc
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22570 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 18:16:37 +00:00
Andrew Lenharth
01c8f6e452
use llabs not abs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22569 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 17:47:28 +00:00
Andrew Lenharth
2b3b89c28e
one cannot allocate a global, until one is done initializing the global pointers
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22568 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 17:35:40 +00:00
Chris Lattner
9cc5f42feb
ConstantInt::get only works for arguments < 128.
...
SimplifyLibCalls probably has to be audited to make sure it does not make
this mistake elsewhere. Also, if this code knows that the type will be
unsigned, obviously one arm of this is dead.
Reid, can you take a look into this further?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22566 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 16:52:50 +00:00
Jeff Cohen
d29b6aa608
Keep tabs and trailing spaces out.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22565 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 18:33:25 +00:00
Jeff Cohen
cfb1d4235f
Fix VC++ build problems.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22564 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 18:22:27 +00:00
Chris Lattner
f20d183c22
fix float->long conversions on x86
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22563 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 01:40:57 +00:00
Chris Lattner
a88da08c6e
fix a typeo
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22561 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:43:00 +00:00
Nate Begeman
f84d5ab5df
Ack, typo
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22560 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:21:31 +00:00
Chris Lattner
a35e1dfd12
Change the fp to integer code to not perform 2-byte stores followed by
...
1 byte loads and other operations. This is bad for store-forwarding on
common CPUs. We now do this:
fnstcw WORD PTR [%ESP]
mov %AX, WORD PTR [%ESP]
instead of:
fnstcw WORD PTR [%ESP]
mov %AL, BYTE PTR [%ESP + 1]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22559 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:17:52 +00:00
Nate Begeman
1699748567
Commit a new LoopStrengthReduce pass that can use scalar evolutions and
...
target data to decide which loop induction variables to strength reduce
and how to do so. This work is mostly by Chris Lattner, with tweaks by
me to get it working on some of MultiSource.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22558 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:15:07 +00:00
Nate Begeman
36f891bdf6
Break SCEVExpander out of IndVarSimplify into its own .h/.cpp file so that
...
other passes may use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22557 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:12:19 +00:00
Chris Lattner
01546c5d50
Use a custom expander for all FP to int conversions, as the X86 only has
...
FP-to-int-in-memory: this exposes the load from the stored slot to the
selection dag, allowing it to be folded into other operaions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22556 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:05:54 +00:00
Chris Lattner
f1fa74ee0d
Allow targets to have custom expanders for FP_TO_*INT conversions where
...
both the src and dest values are legal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22555 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 00:04:12 +00:00
Andrew Lenharth
a00269bc3e
support near allocations for the JIT
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22554 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 23:40:16 +00:00
Andrew Lenharth
422f3d58a8
turn off GOT on archs that didn't use it (not that it appeard to harm them much with it on)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22553 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 23:32:02 +00:00
Chris Lattner
5d06b8caae
Implement a FIXME: move a bunch of cruft for handling FP_TO_*INT operations
...
that the X86 does not support to the legalizer. This allows it to be better
optimized, etc, and will help with SSE support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22551 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 01:00:29 +00:00
Chris Lattner
f7443dace5
Don't forget to diddle with the control word when performing an FISTP64.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22550 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 00:54:34 +00:00
Chris Lattner
745d538119
Use a custom expander to compile this:
...
long %test4(double %X) {
%tmp.1 = cast double %X to long ; <long> [#uses=1]
ret long %tmp.1
}
to this:
_test4:
sub %ESP, 12
fld QWORD PTR [%ESP + 16]
fistp QWORD PTR [%ESP]
mov %EDX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%ESP]
add %ESP, 12
ret
instead of this:
_test4:
sub %ESP, 28
fld QWORD PTR [%ESP + 32]
fstp QWORD PTR [%ESP]
call ___fixdfdi
add %ESP, 28
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22549 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 00:40:01 +00:00
Chris Lattner
80a3e94653
Allow targets to define custom expanders for FP_TO_*INT
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22548 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 00:33:32 +00:00
Chris Lattner
1618bebcf6
allow a target to request that unknown FP_TO_*INT conversion be promoted to
...
a larger integer destination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22547 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 00:11:56 +00:00
Chris Lattner
fa9c801a6b
instead of having all conversions be handled by one case value, and then have
...
subcases inside, break things out earlier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22546 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 23:31:12 +00:00
Andrew Lenharth
98169be50b
support bsr, and more .td simplification
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22543 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 18:14:47 +00:00
Andrew Lenharth
fe660397e1
new is not a valid default anywhere, so make this pure virtual
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22542 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 18:13:59 +00:00
Reid Spencer
3be872ed59
Fix a problem in getDirectoryContents where sub-directory names were
...
appended to a path string that didn't end in a slash, yielding invalid
path names.
Path contribute by Nicholas Riley.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22539 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 16:25:57 +00:00
Andrew Lenharth
a4433e1b31
get lazy JITing working. Some of shootout runs now
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22538 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 12:45:20 +00:00
Andrew Lenharth
6a9746127a
Like constants, globals on some platforms are GOT relative. This means they have to be allocated
...
near the GOT, which new doesn't do. So break out the allocate into a new function.
Also move GOT index handling into JITResolver. This lets it update the mapping when a Lazy
function is JITed. It doesn't managed the table, just the mapping. Note that this is
still non-ideal, as any function that takes a function address should also take a GOT
index, but that is a lot of changes. The relocation resolve process updates any GOT entry
it sees is out of date.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 12:44:13 +00:00
Chris Lattner
988b1dd608
Eliminate an extra copy from R1 that Nate noticed on function calls that
...
have to write arguments to the stack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 05:23:43 +00:00
Chris Lattner
4015ea8711
Specify the correct number of operands
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22535 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 04:42:11 +00:00
Nate Begeman
2a05c8e260
Fold constant adds into loads and stores to frame indices.
...
For the following code:
double %ext(int %A.0__, long %A.1__) {
%A_addr = alloca %typedef.DComplex ; <%typedef.DComplex*> [#uses=2]
%tmp.1 = cast %typedef.DComplex* %A_addr to int* ; <int*> [#uses=1]
store int %A.0__, int* %tmp.1
%tmp.2 = getelementptr %typedef.DComplex* %A_addr, int 0, uint 1 ; <double*> [#uses=2]
%tmp.3 = cast double* %tmp.2 to long* ; <long*> [#uses=1]
store long %A.1__, long* %tmp.3
%tmp.5 = load double* %tmp.2 ; <double> [#uses=1]
ret double %tmp.5
}
We now generate:
_ext:
.LBB_ext_0: ;
stw r3, -12(r1)
stw r4, -8(r1)
stw r5, -4(r1)
lfd f1, -8(r1)
blr
Instead of:
_ext:
.LBB_ext_0: ;
stw r3, -12(r1)
addi r2, r1, -12
stw r4, 4(r2)
stw r5, 8(r2)
lfd f1, 4(r2)
blr
This also fires hundreds of times on MultiSource.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22533 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 03:02:05 +00:00
Nate Begeman
3dee17581c
Fix some comments
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22530 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 23:11:27 +00:00
Chris Lattner
cef21c3544
Fix debug info to not print out recently freed memory.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22529 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 23:11:25 +00:00
Chris Lattner
8e7a70976d
Print symbolic register names in debug dumps
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22528 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 23:03:38 +00:00
Jeff Cohen
00b16889ab
Eliminate all remaining tabs and trailing spaces.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Nate Begeman
54eed36da5
Implement the optimization for the Red Zone on Darwin. This removes the
...
unnecessary SP manipulation in leaf routines that don't need it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:06:29 +00:00
Chris Lattner
45ff4faeed
fix some warnings when compiled with 32-bit hosts
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22521 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 05:58:01 +00:00
Jeff Cohen
9eb59ec548
Eliminate tabs and trailing spaces.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22520 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 05:53:44 +00:00
Chris Lattner
b65975a6ed
add a note about the red zone
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22518 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 19:07:51 +00:00
Chris Lattner
2e00d7d0ae
Wrap some long lines, fix emission of weak global variables
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22517 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 19:03:27 +00:00
Nate Begeman
4ad870ddcc
Update the PPC readme
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22516 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 18:59:06 +00:00
Chris Lattner
600d73b548
ConvertibleToGEP always returns 0, remove some old crufty code which
...
is actually dead because of this!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22515 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 16:38:28 +00:00
Chris Lattner
d6bbac500b
fix a warning on 32-bit systems
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22513 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-25 23:42:58 +00:00
Nate Begeman
7b4f0a81ff
Fix an optimization put in for accessing static globals. This obviates
...
the need to build PIC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22512 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-25 21:15:28 +00:00
Andrew Lenharth
f075cac445
fix compile error
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22508 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-23 07:46:48 +00:00
Chris Lattner
aa68f7fa09
PowerPC no-pic code is not quite ready for prime-time
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22507 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 22:58:34 +00:00
Andrew Lenharth
6b137d818a
Handle more imm forms, and load small negative i32 constants without hitting memory (should do the same for arbitrary zero extended small negative constants)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22505 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 22:24:01 +00:00
Andrew Lenharth
38396f8a93
finally found the gcc defined constants
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22502 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 21:00:30 +00:00
Andrew Lenharth
0934ae02af
Alpha JIT (beta)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22500 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:52:16 +00:00
Andrew Lenharth
f3f951af3f
simpilfy instruction encoding (and make the lines way shorter, aka Misha happification)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22499 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:50:29 +00:00
Andrew Lenharth
908bc862d5
update interface
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22498 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:49:37 +00:00
Andrew Lenharth
16ec33c6ef
the JIT memory manager will construct a GOT if you want it too. Also, it places the constants in the allocated memory, rather than a malloc area
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22497 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:48:12 +00:00
Nate Begeman
2497e6391f
Support building non-PIC
...
Remove the LoadHiAddr pseudo-instruction.
Optimization of stores to and loads from statics.
Force JIT to use new non-PIC codepaths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 20:44:43 +00:00
Chris Lattner
2130c08930
revert to using 4-byte alignment for doubles, as specified by the ABI
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22493 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 19:17:18 +00:00
Nate Begeman
18ed029a7b
Support assembling fsqrt on darwin. This will be implemented better when
...
PowerPC gets subtarget support up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22489 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 01:25:49 +00:00
Nate Begeman
adeb43ddf4
Generate mfocrf when targeting g5. Generate fsqrt/fsqrts when targetin g5.
...
8-byte align doubles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22486 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 22:42:00 +00:00
Chris Lattner
f9944f109c
Do not let MaskedValueIsZero consider undef to be zero, for reasons
...
explained in the comment.
This fixes UnitTests/2003-09-18-BitFieldTest on darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22483 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 18:49:28 +00:00
Chris Lattner
e884dc2c58
count the number of relocations performed.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 16:29:20 +00:00
Nate Begeman
a3fd400fa8
Integrate SelectFPExpr into SelectExpr. This gets PPC32 closer to being
...
automatically generated from a target description.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22470 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-19 16:51:05 +00:00
Nate Begeman
700a3c97e9
Remove unnecessary FP_EXTEND. This causes worse codegen for SSE.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22469 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-19 16:50:03 +00:00
Reid Spencer
a0f5bf306c
For: memory operations -> stores
...
This is the first incremental patch to implement this feature. It adds no
functionality to LLVM but setup up the information needed from targets in
order to implement the optimization correctly. Each target needs to specify
the maximum number of store operations for conversion of the llvm.memset,
llvm.memcpy, and llvm.memmove intrinsics into a sequence of store operations.
The limit needs to be chosen at the threshold of performance for such an
optimization (generally smallish). The target also needs to specify whether
the target can support unaligned stores for multi-byte store operations.
This helps ensure the optimization doesn't generate code that will trap on
an alignment errors.
More patches to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22468 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-19 04:52:44 +00:00
Chris Lattner
7911f03626
When transforming &A[i] < &A[j] -> i < j, make sure to perform the comparison
...
as a signed compare. This patch may fix PR597, but is correct in any case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22465 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-18 23:07:33 +00:00
Chris Lattner
f4d32726e6
The assertion was wrong: the code only worked for i64. While we're at it,
...
expand the code to work for all integer datatypes. This should unbreak
alpha.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22464 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-18 04:31:14 +00:00
Chris Lattner
0589523525
Only get the .bss and .data sections when needed instead of unconditionally.
...
This allows is to not emit empty sections when .data or .bss is not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22457 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 17:41:06 +00:00
Chris Lattner
0003395320
Refactor getSection() method to make it easier to use.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22455 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 17:36:04 +00:00
Chris Lattner
5f48ff7d1f
Major refactor of the ELFWriter code. Instead of building up one big
...
vector that represents the .o file at once, build up a vector for each
section of the .o file. This is needed because the .o file writer needs
to be able to switch between sections as it emits them (e.g. switch
between the .text section and the .rel section when emitting code).
This patch has no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 08:01:13 +00:00
Nate Begeman
5a8441ea3f
Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that
...
the target natively supports. This eliminates some special-case code from
the x86 backend and generates better code as well.
For an i8 to f64 conversion, before & after:
_x87 before:
subl $2, %esp
movb 6(%esp), %al
movsbw %al, %ax
movw %ax, (%esp)
filds (%esp)
addl $2, %esp
ret
_x87 after:
subl $2, %esp
movsbw 6(%esp), %ax
movw %ax, (%esp)
filds (%esp)
addl $2, %esp
ret
_sse before:
subl $12, %esp
movb 16(%esp), %al
movsbl %al, %eax
cvtsi2sd %eax, %xmm0
addl $12, %esp
ret
_sse after:
subl $12, %esp
movsbl 16(%esp), %eax
cvtsi2sd %eax, %xmm0
addl $12, %esp
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 02:02:34 +00:00
Nate Begeman
11cefd926a
Teach the register allocator that movaps is also a move instruction
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22451 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 02:00:20 +00:00
Nate Begeman
9035b99abf
A couple more darwinisms
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22450 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 01:59:47 +00:00
Chris Lattner
a28381cac2
Remove all knowledge of UINT_TO_FP from the X86 backend, relying on the
...
legalizer to eliminate them. With this comes the expected code quality
improvements, such as, for this:
double foo(unsigned short X) { return X; }
we now generate this:
_foo:
subl $4, %esp
movzwl 8(%esp), %eax
movl %eax, (%esp)
fildl (%esp)
addl $4, %esp
ret
instead of this:
_foo:
subl $4, %esp
movw 8(%esp), %ax
movzwl %ax, %eax ;; Load not folded into this.
movl %eax, (%esp)
fildl (%esp)
addl $4, %esp
ret
-Chris
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22449 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 00:28:20 +00:00
Chris Lattner
cad063f1a8
Break the code for expanding UINT_TO_FP operations out into its own
...
SelectionDAGLegalize::ExpandLegalUINT_TO_FP method.
Add a new method, PromoteLegalUINT_TO_FP, which allows targets to request
that UINT_TO_FP operations be promoted to a larger input type. This is
useful for targets that have some UINT_TO_FP or SINT_TO_FP operations but
not all of them (like X86).
The same should be done with SINT_TO_FP, but this patch does not do that
yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22447 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 00:19:57 +00:00
Chris Lattner
6e741f8842
You can't use config options without config.h
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22446 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-15 22:48:31 +00:00
Nate Begeman
16b04f3d5e
Get closer to fully working scalar FP in SSE regs. This gets singlesource
...
working, and Olden/power.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22441 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-15 00:38:55 +00:00
Nate Begeman
6c7cb29038
Add support for printing the sse scalar comparison instruction mnemonics.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22440 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 22:52:25 +00:00
John Criswell
ce4e1e419e
Fixed PR#596:
...
Add parenthesis around the value being negated; that way, if the value
begins with a minus sign (e.g. negative integer), we won't generate a
C predecrement operator by mistake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22437 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 19:41:16 +00:00
Chris Lattner
c5f44add43
Make this use the new autoconf support for finding the executables for
...
gv and Graphviz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22434 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 05:33:13 +00:00
Chris Lattner
e388b5ea2c
As discussed on IRC, this stuff is just for debugging.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22432 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 05:17:43 +00:00
Chris Lattner
f1a2f15ed3
If the Graphviz program is available, use it to visualize dot graphs.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22429 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 01:10:55 +00:00
Reid Spencer
2499841461
Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation
...
of pthreads is missing that call (despite it violating the spec).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22423 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 03:02:06 +00:00
Jeff Cohen
2497251e6d
Note to self: don't introduce memory leaks.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 02:58:04 +00:00
Jeff Cohen
6d2352249a
Win32 support for Mutex class.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22420 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 02:15:18 +00:00
Chris Lattner
c087a43510
Fix Alpha/2005-07-12-TwoMallocCalls.ll and PR593.
...
It is not safe to call LegalizeOp on something that has already been legalized.
Instead, just force another iteration of legalization.
This could affect all platforms but X86, as this codepath is dynamically
dead on X86 (ISD::MEMSET and friends are legal).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22419 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 02:00:04 +00:00
Chris Lattner
6814f1522d
Fix test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22417 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 01:42:45 +00:00
Nate Begeman
d3a490a08e
Check in the last of the darwin-specific code necessary to get shootout
...
working before modifying the asm printer to use the subtarget info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:58 +00:00
Nate Begeman
63b3f9acae
Remove some code that moved to the generic asm printer a long time ago.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:15 +00:00
Reid Spencer
ee448630bd
For PR540:
...
This patch completes the changes for making lli thread-safe. Here's the list
of changes:
* The Support/ThreadSupport* files were removed and replaced with the
MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard.
The implementation of MutexGuard.h is now based on sys::Mutex which hides
its implementation and makes it unnecessary to have the -NoSupport.h and
-PThreads.h versions of ThreadSupport.
* All places in ExecutionEngine that previously referred to "Mutex" now
refer to sys::Mutex
* All places in ExecutionEngine that previously referred to "MutexLocker"
now refer to MutexGuard (this is frivolous but I believe the technically
correct name for such a class is "Guard" not a "Locker").
These changes passed all of llvm-test. All we need now are some test cases
that actually use multiple threads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22404 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:51:55 +00:00
Reid Spencer
b2164e5cb5
For PR540:
...
Add a Mutex class for thread synchronization in a platform-independent way.
The current implementation only supports pthreads. Win32 use of Critical
Sections will be added later. The design permits other threading models to
be used if (and only if) pthreads is not available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:37:43 +00:00
Chris Lattner
46c53054d0
Add support for 64-bit elf files
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22400 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 06:57:52 +00:00
Andrew Lenharth
fec0e4024f
Fix povray and minor cleanups
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 04:20:52 +00:00
Jeff Cohen
74fa8d67e1
I don't know how this ever compiled with gcc, but VC++ correctly rejects it.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22394 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:59:38 +00:00
Jeff Cohen
44213c9538
VC++ demands that the function returns a value
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:53:33 +00:00
Nate Begeman
0e219eb9b8
Clean up the TargetSubtarget class a bit, removing an unnecessary argument
...
to the constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22392 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:41:19 +00:00
Chris Lattner
b151acadc8
Minor changes to improve comments and fix the build on _WIN32 systems.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:36:10 +00:00
Chris Lattner
3249bfc828
Add a note
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22390 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:35:36 +00:00
Nate Begeman
fb5792f416
Implement Subtarget support
...
Implement the X86 Subtarget.
This consolidates the checks for target triple, and setting options based
on target triple into one place. This allows us to convert the asm printer
and isel over from being littered with "forDarwin", "forCygwin", etc. into
just having the appropriate flags for each subtarget feature controlling
the code for that feature.
This patch also implements indirect external and weak references in the
X86 pattern isel, for darwin. Next up is to convert over the asm printers
to use this new interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:41:54 +00:00
Nate Begeman
73213f6c07
Commit some pending darwin changes before subtarget support.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:37:28 +00:00
Chris Lattner
df3623e962
fix a warning
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 22:46:18 +00:00
Andrew Lenharth
d3513e026b
Remove glibc specific functions, and mark a couple as C99
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 20:35:20 +00:00
Andrew Lenharth
d9793e6c0a
because on alpha:
...
# define errno (*__errno_location ())
*shakes head
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 17:41:12 +00:00
Chris Lattner
0e18050797
Clean up code, no functionality changes.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22382 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:34:30 +00:00
Chris Lattner
c569d79a2a
Output .size directives to tell the assembler the size of each function.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22381 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:29:14 +00:00
Chris Lattner
b12c9fa565
Fix crazy indentation
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22380 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:25:47 +00:00
Chris Lattner
5fe7b6e2be
Emit a symbol table entry for each function we output to the ELF file. This
...
allows objdump to know which function we are emitting to:
00000000 <foo>: <----
0: b8 01 00 00 00 mov $0x1,%eax
5: 03 44 24 04 add 0x4(%esp,1),%eax
9: c3 ret
... and allows .o files to be useful for linking :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22378 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:17:35 +00:00
Chris Lattner
81b6ed7ed1
Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
...
after itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22376 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:17:48 +00:00
Chris Lattner
aa507db59e
add code to emit the .text section to the section header.
...
Add a *VERY INITIAL* machine code emitter class. This is enough to take
this C function:
int foo(int X) { return X +1; }
and make objdump produce the following:
$ objdump -d t-llvm.o
t-llvm.o: file format elf32-i386
Disassembly of section .text:
00000000 <.text>:
0: b8 01 00 00 00 mov $0x1,%eax
5: 03 44 24 04 add 0x4(%esp,1),%eax
9: c3 ret
Anything using branches or refering to the constant pool or requiring
relocations will not work yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22375 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:17:18 +00:00
Chris Lattner
efb4bf0de6
Remove prototype for non-existant function
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22372 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 04:20:55 +00:00
Chris Lattner
5acd120078
Use a name mangler object to uniquify names and remove nonstandard
...
characters from them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22371 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 03:11:47 +00:00
Chris Lattner
6e6308898a
fix long lines
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22369 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 02:49:16 +00:00
Chris Lattner
bce81ae51e
Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
...
This is the last MVTSDNode.
This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.
Also, remove some uses of dyn_cast that should really be cast (which is
cheaper in a release build).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:56:13 +00:00
Chris Lattner
5f056bf4b8
Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
...
This is the last MVTSDNode.
This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22367 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:55:33 +00:00
Chris Lattner
9fadb4c1c0
Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22366 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:29:18 +00:00
Chris Lattner
15e4b01920
Introduce a new VTSDNode class with the ultimate goal of eliminating the
...
MVTSDNode class. This class is used to provide an operand to operators
that require an extra type. We start by converting FP_ROUND_INREG and
SIGN_EXTEND_INREG over to using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22364 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:07:11 +00:00
Jeff Cohen
966fa415d2
Fix bugs also fixed in Unix version, plus other general cleanup.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22363 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-09 18:42:49 +00:00
Jeff Cohen
73f36671b2
1. Fix bug in getBaseName where it mishandles suffixes
...
2. Fix bug in eraseSuffix where it allows /path/.suffix to become /path/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22362 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-09 18:42:02 +00:00
Reid Spencer
8b2d1aa37b
Ensure that functions like isDirectory don't fail if the file doesn't
...
exist but just return false instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22361 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 17:46:10 +00:00
Reid Spencer
6371ccbd8d
Two changes:
...
1. Use isValid() to check validity of the resulting path name in the
eraseSuffix even though we can't think of a case where eraseSuffix could
possibly cause an invalid path name.
2. Rewrite isValid() to not use the deprecated realpath function any more.
It now just uses isascii to make sure all the characters are legit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22359 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 06:53:26 +00:00
Chris Lattner
4c47e3a1c5
Add support for emitting a .data section and .bss section.
...
Add support for emitting external and .bss symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22358 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 05:47:00 +00:00
Jeff Cohen
85c716f83d
Stamp out tabs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22357 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 05:02:13 +00:00
Jeff Cohen
8f0e8f2047
Make Win32 implementation conform to new paradigm
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22356 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 04:50:08 +00:00
Jeff Cohen
563a17fb35
Fix eraseSuffix()
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22355 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 04:49:16 +00:00
Reid Spencer
a229c5cce7
Final Changes For PR495:
...
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:
makeReadable -> makeReadableOnDisk
makeWriteable -> makeWriteableOnDisk
makeExecutable -> makeExecutableOnDisk
setStatusInfo -> setStatusInfoOnDisk
createDirectory -> createDirectoryOnDisk
createFile -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy -> eraseFromDisk
rename -> renamePathOnDisk
These changes pass the Linux Deja Gnu tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 03:08:58 +00:00
Jeff Cohen
edb9d6bc72
Fix VC++ breakage
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22353 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 02:48:42 +00:00
Nate Begeman
72b286b0a0
Add support for assembling .s files on mac os x for intel
...
Add support for running bugpoint on mac os x for intel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22351 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 00:23:26 +00:00
Reid Spencer
1cf2d04351
Changes to mimic those in Unix/Path.inc in support of PR495. This hasn't
...
been compiled or tested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22350 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:35:23 +00:00
Reid Spencer
dd04df0ec3
For PR495:
...
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:
appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set
Changes pass Dejagnu and llvm-test/SingleSource tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Chris Lattner
b3d59701c8
Fix a problem that instcombine would hit when dealing with unreachable code.
...
Because the instcombine has to scan the entire function when it starts up
to begin with, we might as well do it in DFO so we can nuke unreachable code.
This fixes: Transforms/InstCombine/2005-07-07-DeadPHILoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22348 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 20:40:38 +00:00
Andrew Lenharth
a48f3ce18a
clean up prolouge and epilouge
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22346 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 19:52:58 +00:00
Reid Spencer
c7f083297c
For PR495:
...
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute
More (incremental) changes coming to close 495.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 18:21:42 +00:00
Chris Lattner
8d4b9eddc0
Restore some code that was accidentally removed by Nate's patch yesterday.
...
This fixes the regressions from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22344 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 17:12:53 +00:00
Chris Lattner
80ed8faaea
Add support for emitting the symbol table (and its string table) of the
...
module to the ELF file. Test it by adding support for emitting common
symbols. This allows us to compile this:
%X = weak global int 0
%Y = weak global int 0
%Z = weak global int 0
to an elf file that 'readelf's this:
Symbol table '.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000004 4 OBJECT GLOBAL DEFAULT COM X
2: 00000004 4 OBJECT GLOBAL DEFAULT COM Y
3: 00000004 4 OBJECT GLOBAL DEFAULT COM Z
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 07:02:20 +00:00
Nate Begeman
b8aa3ac678
Fix a typo in my checkin today that caused regressions. Oops!
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22341 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 06:32:01 +00:00
Nate Begeman
f63be7d395
First round of support for doing scalar FP using the SSE2 ISA extension and
...
XMM registers. There are many known deficiencies and fixmes, which will be
addressed ASAP. The major benefit of this work is that it will allow the
LLVM register allocator to allocate FP registers across basic blocks.
The x86 backend will still default to x87 style FP. To enable this work,
you must pass -enable-sse-scalar-fp and either -sse2 or -sse3 to llc.
An example before and after would be for:
double foo(double *P) { double Sum = 0; int i; for (i = 0; i < 1000; ++i)
Sum += P[i]; return Sum; }
The inner loop looks like the following:
x87:
.LBB_foo_1: # no_exit
fldl (%esp)
faddl (%eax,%ecx,8)
fstpl (%esp)
incl %ecx
cmpl $1000, %ecx
#FP_REG_KILL
jne .LBB_foo_1 # no_exit
SSE2:
addsd (%eax,%ecx,8), %xmm0
incl %ecx
cmpl $1000, %ecx
#FP_REG_KILL
jne .LBB_foo_1 # no_exit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22340 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-06 18:59:04 +00:00
Chris Lattner
e0fe225e89
Make several cleanups to Andrews varargs change:
...
1. Pass Value*'s into lowering methods so that the proper pointers can be
added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.
4. Now that we have Value*'s available in the lowering methods, pass them
into any load/stores from the valist that are emitted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22339 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:58:54 +00:00
Chris Lattner
e64e72b794
Make several cleanups to Andrews varargs change:
...
1. Pass Value*'s into lowering methods so that the proper pointers can be
added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22338 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:57:53 +00:00
Andrew Lenharth
f2eb1396b8
2 fixes:
...
1: Legalize operand in UINT_TO_FP expanision
2: SRA x, const i8 was not promoting the constant to shift amount type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22337 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:52:39 +00:00
Chris Lattner
08568cfe25
Fit to 80 columns
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22336 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 17:50:16 +00:00
Chris Lattner
f84a2ace5e
Fix PowerPC varargs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22335 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 17:48:31 +00:00
Andrew Lenharth
619fb52764
check the correct VT
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22332 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-04 20:07:21 +00:00
Andrew Lenharth
2f5bca5c15
fix loading address of fp symbols
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-03 20:06:13 +00:00
Chris Lattner
6a709a418b
Percolate the call up to the right superclass
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22330 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-03 17:34:39 +00:00
Andrew Lenharth
c6bead211b
I really didn't think this was necessary. But, Legalize wasn't running again
...
and legalizing the extload. Strange. Should fix most alpha regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22329 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-02 20:58:53 +00:00
Nate Begeman
4eb74ba602
The statistic needs to be in the correct namespace.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22327 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 23:56:38 +00:00
Chris Lattner
c1671e2d7d
Varargs is apparently currently broken on PPC. This hacks it so that it
...
is at least overloading the right virtual methods. The implementations
are currently wrong though. This fixes Ptrdist/bc, but not other programs
(e.g. siod).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22326 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 23:11:56 +00:00
Chris Lattner
b36cbd0286
Refactor X86AsmPrinter.cpp into multiple files. Patch contributed
...
by Aaron Gray, cleaned up by me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22324 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 22:44:09 +00:00
Andrew Lenharth
5d5b17bf91
simplify call code, remove pseudo ops for div and rem, track more loads and stores
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22323 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 19:14:02 +00:00
Andrew Lenharth
cf8bf388ea
simplify call code, remove pseudo ops for div and rem, track more loads and stores
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22322 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 19:12:13 +00:00
Chris Lattner
5de8b9d796
remove some debugging code
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22321 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 06:40:58 +00:00
Andrew Lenharth
31559081a4
oops
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22320 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 19:32:57 +00:00
Andrew Lenharth
9d416f713e
FP EXTLOAD is not support on all archs, expand to LOAD and FP_EXTEND
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22319 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 19:22:37 +00:00
Chris Lattner
6cfd1ebcd3
Fix PR590 and Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll.
...
The optimization for locally used allocas was not safe for allocas that
were read before they were written. This change disables that optimization
in that case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22318 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 07:29:44 +00:00
Nate Begeman
9d19eb459c
Make the x86 asm printer darwin-aware. This mostly entails doing the same
...
thing as cygwin most of the time, and printing our alignments in log2
rather than number of bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22316 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 00:53:20 +00:00
Andrew Lenharth
06ef88472f
restore old srcValueNode behavior and try to to work around it
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 18:54:02 +00:00
John Criswell
46b8db2ec6
Doh! Forgot to LLVMify the style.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22312 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 15:57:50 +00:00
Andrew Lenharth
782ad62f33
tracking the instructions causing loads and stores provides more information than just the pointer being loaded or stored
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22311 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 15:57:19 +00:00
John Criswell
1d231ec0b0
Basic fix for PR#591; don't convert an fprintf() to an fwrite() if there
...
is a mismatch in their character type pointers (i.e. fprintf() prints an
array of ubytes while fwrite() takes an array of sbytes).
We can probably do better than this (such as casting the ubyte to an
sbyte).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22310 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 15:03:18 +00:00
Andrew Lenharth
0cab375231
thinko
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22309 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 13:35:05 +00:00
Andrew Lenharth
f4da945302
unify SelectExpr and SelectFP
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22308 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 12:49:51 +00:00
Andrew Lenharth
ba5dc44b00
fix most regressions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22307 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 12:23:34 +00:00
Andrew Lenharth
fce587e58b
support more relocations for stores also
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 00:39:17 +00:00
Andrew Lenharth
c7989cef9d
Get rid of all symbolic loads. I now do gernate all relocations sequences
...
rather than relying on the assembler. Only a few more pseudo instructions
left. Also merge load code paths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22305 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 00:31:08 +00:00
Andrew Lenharth
e014f89f3d
some call work
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22303 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 23:59:51 +00:00
Andrew Lenharth
f4b3278aeb
Adapt the code for handling uint -> fp conversion for the 32 bit case to
...
handling it in the 64 bit case. The two code paths should probably be merged.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22302 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 23:28:32 +00:00
Andrew Lenharth
6968bff783
So, it turns out I forgot that one valid way of restoring GP after a call
...
is to use RA, which assumes the called function uses RA for the register
holding the return address when it issues a ret.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22301 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 23:24:11 +00:00
Nate Begeman
f1702ac589
Initial set of .td file changes necessary to get scalar fp in xmm registers
...
working. The instruction selector changes will hopefully be coming later
this week once they are debugged. This is necessary to support the darwin
x86 FP model, and is recommended by intel as the replacement for x87. As
a bonus, the register allocator knows how to deal with these registers
across basic blocks, unliky the FP stackifier. This leads to significantly
better codegen in several cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:20:31 +00:00
Andrew Lenharth
c95d984f7c
get rid of another pseudo op
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22299 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:11:40 +00:00
Andrew Lenharth
02c318e1d2
generate address of constant pool entries
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22298 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:02:56 +00:00
Andrew Lenharth
d4653b1852
Misha happification patch
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22297 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 17:39:17 +00:00
Andrew Lenharth
fe895e3d87
Reduce use of pseudo ops
...
Namely, output the rellocation flags explicitly when loading constants.
Added benifit: save a load when loading from the constant pool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22296 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 17:15:36 +00:00
Andrew Lenharth
b72bcbb42b
missed a load
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22295 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 16:40:26 +00:00
Andrew Lenharth
98f0eee406
make constant pool labels local
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22294 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 16:29:54 +00:00
Andrew Lenharth
3b91807da7
who said we had to use the return address in the return address register. Might save a move in many cases
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22293 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 15:36:48 +00:00
Chris Lattner
07a9144efe
Add support to the X86 backend for emitting ELF files. To use this, we
...
currently use: llc t.bc --filetype=obj
This will produce a t.o file which is dumpable with readelf. Currently
the file produced is empty, but the scaffolding to do more is now in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22292 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 06:30:12 +00:00
Chris Lattner
35f0a4f24e
iniital checkin of ELFWriter implementation
...
For now, the elf writer is only capable of emitting an empty elf file, with
a section table and a section table string table. This will be enhanced
in the future :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22291 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 06:29:00 +00:00
Andrew Lenharth
694c29831a
depend more on legalize putting constants on the RHS
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22289 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-26 23:01:11 +00:00
Andrew Lenharth
ec151361ba
With setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand), Legalize
...
should be able to handle this case. The code is there, so let's see
if it works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22288 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-26 22:23:06 +00:00
Chris Lattner
0431c96cec
Refactor the addPassesToEmitAssembly interface into a addPassesToEmitFile
...
interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22282 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-25 02:48:37 +00:00
Chris Lattner
548021f411
Fix grammar
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22279 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-24 18:00:40 +00:00
Chris Lattner
543a02704e
add a debug type
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22277 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-24 16:00:46 +00:00
Andrew Lenharth
3f5aa1cd8c
remove a pseudo instruction, make ret always right, and fix vararg chains
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22276 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-23 23:42:05 +00:00
Andrew Lenharth
a9e39e28b7
finally, Working varargs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22275 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-23 16:48:51 +00:00
Andrew Lenharth
cdf233d55d
more complete Lowering for vacopy and vaarg
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22274 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-22 23:04:28 +00:00
Andrew Lenharth
213e557cef
If we support structs as va_list, we must pass pointers to them to va_copy
...
See last commit for LangRef, this implements it on all targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22273 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-22 21:04:42 +00:00
Andrew Lenharth
b69f342b0e
Make it easier to find alpha stuff in doxygen, and fixup labeling
...
of memory instructions in the assembly, to allow later linking
of traces with LLVM Value*s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22271 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-22 17:19:45 +00:00
John Criswell
57c24508d3
Fixed indentation.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22270 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-20 19:59:22 +00:00
Andrew Lenharth
31c98bfb85
because some functions just use va_start and pass things to vfprintf
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22269 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-20 15:41:37 +00:00
Andrew Lenharth
c826aea982
the correct fix was to fix AliasAnalysis.getModRefInfo
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22268 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-20 15:25:22 +00:00
Andrew Lenharth
e3e1739b7d
prevent GCSE from forwarding stores to loads around vaarg. This is uggly, and I am trying to fix the AliasInfo, as it should catch the problem instead.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22266 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-20 15:02:05 +00:00
Andrew Lenharth
38b5807bd9
prevent va_arg from being hoisted from a loop
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22265 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-20 13:36:33 +00:00
Andrew Lenharth
94cd87f658
prevent DCE of vaarg intrinsics. This should take care of most regressions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22263 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-19 14:41:20 +00:00
Andrew Lenharth
017fba9d0f
va_end fix
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22262 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-19 14:04:55 +00:00
Andrew Lenharth
08b06dc956
so this doesn't crash when run. It is hard to tell if things are right enough to work correctly with all the TmpInstructions running around
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22261 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-19 05:45:00 +00:00
Andrew Lenharth
e78f50deea
add a check for the mixing of vaarg and vanext with va_arg
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22260 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-19 03:53:56 +00:00
Andrew Lenharth
5fb7f20469
OK, at least get rid of old stuff, and mark what needs to be fixed for V9
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22255 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 18:46:40 +00:00
Andrew Lenharth
558bc88a00
core changes for varargs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22254 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 18:34:52 +00:00
Reid Spencer
134d2e4af8
Fix a problem with the strcmp optimization checking the wrong string and
...
not casting to the correct type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22250 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 17:46:28 +00:00
Reid Spencer
4b828e6384
Clean up some uninitialized variables and missing return statements that
...
GCC 4.0.0 compiler (sometimes incorrectly) warns about under release build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22249 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 17:37:34 +00:00
Andrew Lenharth
72b16d820c
A start at a Sparc V8 Pattern ISel. Anyone want to implement the calling
...
convention? ;)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22247 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-17 16:52:12 +00:00
Chris Lattner
b157f858a2
silence incredibly braindead GCC 4 warning
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22246 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-17 13:44:07 +00:00