oota-llvm.git
18 years ago1. Use SubtargetFeatures in llc/lli.
Jim Laskey [Thu, 1 Sep 2005 21:38:21 +0000 (21:38 +0000)]
1. Use SubtargetFeatures in llc/lli.

2. Propagate feature "string" to all targets.

3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23192 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThis new class provides support for platform specific "features". The intent
Jim Laskey [Thu, 1 Sep 2005 21:36:18 +0000 (21:36 +0000)]
This new class provides support for platform specific "features".  The intent
is to manage processor specific attributes from the command line.  See examples
of use in llc/lli and PowerPCTargetSubtarget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23191 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement dynamic allocas correctly. In particular, because we were copying
Chris Lattner [Thu, 1 Sep 2005 21:31:30 +0000 (21:31 +0000)]
Implement dynamic allocas correctly.  In particular, because we were copying
directly out of R1 (without using a CopyFromReg, which uses a chain), multiple
allocas were getting CSE'd together, producing bogus code.  For this:

int %foo(bool %X, int %A, int %B) {
        br bool %X, label %T, label %F
F:
        %G = alloca int
        %H = alloca int
        store int %A, int* %G
        store int %B, int* %H
        %R = load int* %G
        ret int %R
T:
        ret int 0
}

We were generating:

_foo:
        stwu r1, -16(r1)
        stw r31, 4(r1)
        or r31, r1, r1
        stw r1, 12(r31)
        cmpwi cr0, r3, 0
        bne cr0, .LBB_foo_2     ; T
.LBB_foo_1:     ; F
        li r2, 16
        subf r2, r2, r1   ;; One alloca
        or r1, r2, r2
        or r3, r1, r1
        or r1, r2, r2
        or r2, r1, r1
        stw r4, 0(r3)
        stw r5, 0(r2)
        lwz r3, 0(r3)
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr
.LBB_foo_2:     ; T
        li r3, 0
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr

Now we generate:

_foo:
        stwu r1, -16(r1)
        stw r31, 4(r1)
        or r31, r1, r1
        stw r1, 12(r31)
        cmpwi cr0, r3, 0
        bne cr0, .LBB_foo_2     ; T
.LBB_foo_1:     ; F
        or r2, r1, r1
        li r3, 16
        subf r2, r3, r2  ;; Alloca 1
        or r1, r2, r2
        or r2, r1, r1
        or r6, r1, r1
        subf r3, r3, r6  ;; Alloca 2
        or r1, r3, r3
        or r3, r1, r1
        stw r4, 0(r2)
        stw r5, 0(r3)
        lwz r3, 0(r2)
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr
.LBB_foo_2:     ; T
        li r3, 0
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr

This fixes Povray and SPASS with the dag isel, the last two failing cases.
Tommorow we will hopefully turn it on by default! :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23190 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug where we were useing HA to get the high part, which seems like it
Chris Lattner [Thu, 1 Sep 2005 19:38:28 +0000 (19:38 +0000)]
Fix a bug where we were useing HA to get the high part, which seems like it
could cause a miscompile.  Fixing this didn't fix the two programs that fail
though.  :(

This also changes the implementation to follow the pattern selector more
closely, causing us to select 0 to li instead of lis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23189 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoDo not select the operands being passed into SelectCC. IT does this itself
Chris Lattner [Thu, 1 Sep 2005 19:20:44 +0000 (19:20 +0000)]
Do not select the operands being passed into SelectCC.  IT does this itself
and selecting early prevents folding immediates into the cmpw* instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23188 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoIt is NDEBUG not _NDEBUG
Chris Lattner [Thu, 1 Sep 2005 18:44:10 +0000 (18:44 +0000)]
It is NDEBUG not _NDEBUG

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23186 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd the rest of the currently implemented visit routines to the switch
Nate Begeman [Thu, 1 Sep 2005 00:33:32 +0000 (00:33 +0000)]
Add the rest of the currently implemented visit routines to the switch
statement in visit().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23185 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFirst pass at the DAG Combiner. It isn't used anywhere yet, but it should
Nate Begeman [Thu, 1 Sep 2005 00:19:25 +0000 (00:19 +0000)]
First pass at the DAG Combiner.  It isn't used anywhere yet, but it should
be mostly functional.  It currently has all folds from SelectionDAG.cpp
that do not involve a condition code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23184 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd regression test for efficient codegen of i32 x i32 -> hi32(i64) as
Nate Begeman [Thu, 1 Sep 2005 00:04:03 +0000 (00:04 +0000)]
Add regression test for efficient codegen of i32 x i32 -> hi32(i64) as
mulhs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23183 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoremove an inappropriate comment
Chris Lattner [Wed, 31 Aug 2005 22:49:51 +0000 (22:49 +0000)]
remove an inappropriate comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23182 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoIf a function has live ins/outs, print them
Chris Lattner [Wed, 31 Aug 2005 22:34:59 +0000 (22:34 +0000)]
If a function has live ins/outs, print them

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23181 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove FCTIWZ handling out of the instruction selectors and into legalization,
Chris Lattner [Wed, 31 Aug 2005 21:09:52 +0000 (21:09 +0000)]
Move FCTIWZ handling out of the instruction selectors and into legalization,
getting them out of the business of making stack slots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23180 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove dead code
Chris Lattner [Wed, 31 Aug 2005 20:25:15 +0000 (20:25 +0000)]
Remove dead code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23179 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove SHL,SHR i64 -> legalizer
Chris Lattner [Wed, 31 Aug 2005 20:23:54 +0000 (20:23 +0000)]
Move SHL,SHR i64 -> legalizer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23178 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove code that is now dead from the pattern isel.
Chris Lattner [Wed, 31 Aug 2005 19:11:36 +0000 (19:11 +0000)]
Remove code that is now dead from the pattern isel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23177 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agolower sra_parts on the dag, implementing it for the dag isel, and exposing
Chris Lattner [Wed, 31 Aug 2005 19:09:57 +0000 (19:09 +0000)]
lower sra_parts on the dag, implementing it for the dag isel, and exposing
the ops to dag optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23176 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAllow targets to custom expand shifts that are too large for their registers
Chris Lattner [Wed, 31 Aug 2005 19:01:53 +0000 (19:01 +0000)]
Allow targets to custom expand shifts that are too large for their registers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23173 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a testcase for nate's patch
Chris Lattner [Wed, 31 Aug 2005 18:19:50 +0000 (18:19 +0000)]
Add a testcase for nate's patch

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23172 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd assert zext/sext to the dag isel
Chris Lattner [Wed, 31 Aug 2005 18:08:46 +0000 (18:08 +0000)]
add assert zext/sext to the dag isel

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23171 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoHandle AssertSext/AssertZext nodes, fixing the regressions last night.
Chris Lattner [Wed, 31 Aug 2005 17:48:04 +0000 (17:48 +0000)]
Handle AssertSext/AssertZext nodes, fixing the regressions last night.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23170 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix VC++ precedence warnings
Jeff Cohen [Wed, 31 Aug 2005 02:47:06 +0000 (02:47 +0000)]
Fix VC++ precedence warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23169 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoEnable generation of AssertSext and AssertZext in the PPC backend.
Nate Begeman [Wed, 31 Aug 2005 01:58:39 +0000 (01:58 +0000)]
Enable generation of AssertSext and AssertZext in the PPC backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23168 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix 'ret long' to return the high and lo parts in the right registers. This
Chris Lattner [Wed, 31 Aug 2005 01:34:29 +0000 (01:34 +0000)]
Fix 'ret long' to return the high and lo parts in the right registers.  This
fixes crafty and probably others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23167 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSigh, not my day. Fix typo.
Nate Begeman [Wed, 31 Aug 2005 00:43:49 +0000 (00:43 +0000)]
Sigh, not my day.  Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23166 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a mistake in my previous patch pointed out by sabre; the AssertZext
Nate Begeman [Wed, 31 Aug 2005 00:43:08 +0000 (00:43 +0000)]
Fix a mistake in my previous patch pointed out by sabre; the AssertZext
case in MaskedValueIsZero was wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23165 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove some unnecessary casts, and add the AssertZext case to
Nate Begeman [Wed, 31 Aug 2005 00:27:53 +0000 (00:27 +0000)]
Remove some unnecessary casts, and add the AssertZext case to
MaskedValueIsZero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23164 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd support for count trailing zeroes, and population count. These are
Nate Begeman [Wed, 31 Aug 2005 00:25:01 +0000 (00:25 +0000)]
Add support for count trailing zeroes, and population count.  These are
needed for folding constants in the upcoming dag combiner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23163 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonow that physregs can exist in the same dag with multiple types, remove some
Chris Lattner [Tue, 30 Aug 2005 22:59:48 +0000 (22:59 +0000)]
now that physregs can exist in the same dag with multiple types, remove some
ugly hacks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23162 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAllow physregs to occur in the dag with multiple types. Though I don't likethis...
Chris Lattner [Tue, 30 Aug 2005 22:38:38 +0000 (22:38 +0000)]
Allow physregs to occur in the dag with multiple types.  Though I don't likethis, it is a requirement on PPC, which can have an f32 value in r3 at onepoint in a function and a f64 value in r3 at another point.  :(

This fixes compilation of mesa

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23161 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAllow physregs to occur in the dag with multiple types. Though I don't like
Chris Lattner [Tue, 30 Aug 2005 22:38:05 +0000 (22:38 +0000)]
Allow physregs to occur in the dag with multiple types.  Though I don't like
this, it is a requirement on PPC, which can have an f32 value in r3 at one
point in a function and a f64 value in r3 at another point.  :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23160 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix type mismatches when passing f32 values to calls
Chris Lattner [Tue, 30 Aug 2005 21:28:19 +0000 (21:28 +0000)]
Fix type mismatches when passing f32 values to calls

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23159 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoWhen checking the fixed intervals, don't forget to check for register aliases.
Chris Lattner [Tue, 30 Aug 2005 21:03:36 +0000 (21:03 +0000)]
When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621 and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23158 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase corresponding to PR621
Chris Lattner [Tue, 30 Aug 2005 21:02:51 +0000 (21:02 +0000)]
new testcase corresponding to PR621

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23157 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThe dag isel misses both of these, the pattern isel just misses the second
Chris Lattner [Tue, 30 Aug 2005 18:44:09 +0000 (18:44 +0000)]
The dag isel misses both of these, the pattern isel just misses the second
one.  TODO :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23156 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix some indentation (first hunks).
Chris Lattner [Tue, 30 Aug 2005 18:37:48 +0000 (18:37 +0000)]
Fix some indentation (first hunks).

Remove code (last hunk) that miscompiled immediate and's, such as
  and uint %tmp.30, 4294958079

into

 andi. r8, r8, 56319
 andis. r8, r8, 65535

instead of:

 li r9, -9217
 and r8, r8, r9

The first always generates zero.

This fixes espresso.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23155 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a problem Nate found where we swapped the operands of SHL/SHR_PARTS. This
Chris Lattner [Tue, 30 Aug 2005 17:42:59 +0000 (17:42 +0000)]
Fix a problem Nate found where we swapped the operands of SHL/SHR_PARTS.  This
fixes fourinarow

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23153 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agocodegen ADD_PARTS correctly: put the results in the right registers! This
Chris Lattner [Tue, 30 Aug 2005 17:40:13 +0000 (17:40 +0000)]
codegen ADD_PARTS correctly: put the results in the right registers!  This
fixes fhourstones

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23152 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix FreeBench/fourinarow with the dag isel, by not adding a bogus result
Chris Lattner [Tue, 30 Aug 2005 17:21:17 +0000 (17:21 +0000)]
Fix FreeBench/fourinarow with the dag isel, by not adding a bogus result
to SHIFT_PARTS nodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23151 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd operands in the right order, fixing McCat/18-imp with the dag isel
Chris Lattner [Tue, 30 Aug 2005 17:13:58 +0000 (17:13 +0000)]
add operands in the right order, fixing McCat/18-imp with the dag isel

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23150 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a miscompile of PtrDist/bc. Sign extending bools is not the right thing,
Chris Lattner [Tue, 30 Aug 2005 16:56:19 +0000 (16:56 +0000)]
Fix a miscompile of PtrDist/bc.  Sign extending bools is not the right thing,
at least tends to expose problems elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23149 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove a bogus piece of my AssertSext/AssertZext patch. oops.
Nate Begeman [Tue, 30 Aug 2005 02:54:28 +0000 (02:54 +0000)]
Remove a bogus piece of my AssertSext/AssertZext patch.  oops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23148 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd support for AssertSext and AssertZext, folding other extensions with
Nate Begeman [Tue, 30 Aug 2005 02:44:00 +0000 (02:44 +0000)]
Add support for AssertSext and AssertZext, folding other extensions with
them.  This allows for elminination of redundant extends in the entry
blocks of functions on PowerPC.

Add support for i32 x i32 -> i64 multiplies, by recognizing when the inputs
to ISD::MUL in ExpandOp are actually just extended i32 values and not real
i64 values.  this allows us to codegen

int mulhs(int a, int b) { return ((long long)a * b) >> 32; }
as:
_mulhs:
        mulhw r3, r4, r3
        blr

instead of:
_mulhs:
        mulhwu r2, r4, r3
        srawi r5, r3, 31
        mullw r5, r4, r5
        add r2, r2, r5
        srawi r4, r4, 31
        mullw r3, r4, r3
        add r3, r2, r3
        blr

with a similar improvement on x86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23147 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd AssertSext, AssertZext nodes for targets that pass arguments in
Nate Begeman [Tue, 30 Aug 2005 02:39:32 +0000 (02:39 +0000)]
Add AssertSext, AssertZext nodes for targets that pass arguments in
registers, and the incoming values have already been zero or sign extended
from the appopriate type to the register width.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23146 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoName this variable to be what it really is!
Chris Lattner [Tue, 30 Aug 2005 01:58:51 +0000 (01:58 +0000)]
Name this variable to be what it really is!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23145 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoHandle CopyToReg nodes with flag operands correctly
Chris Lattner [Tue, 30 Aug 2005 01:57:23 +0000 (01:57 +0000)]
Handle CopyToReg nodes with flag operands correctly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23144 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake sure the selector emits register register copies with flag operands
Chris Lattner [Tue, 30 Aug 2005 01:57:02 +0000 (01:57 +0000)]
Make sure the selector emits register register copies with flag operands
linking them to calls when appropriate, this prevents the scheduler from
pulling these copies away from the call.

This fixes Ptrdist/yacr2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23143 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd some method variants
Chris Lattner [Tue, 30 Aug 2005 01:56:13 +0000 (01:56 +0000)]
add some method variants

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23142 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThe first operand to AND does not always have more than two operands. This
Chris Lattner [Tue, 30 Aug 2005 00:59:16 +0000 (00:59 +0000)]
The first operand to AND does not always have more than two operands. This
fixes MediaBench/toast with the dag selector

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23141 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug in my patch for legalizing to fsel. It cannot handle seteq/setne,
Chris Lattner [Tue, 30 Aug 2005 00:45:18 +0000 (00:45 +0000)]
Fix a bug in my patch for legalizing to fsel.  It cannot handle seteq/setne,
which I failed to include when I moved the code over.  This fixes
MallocBench/gs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23140 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoemit FMR instructions to convert f64<->f32 instructions, so things like
Chris Lattner [Tue, 30 Aug 2005 00:30:43 +0000 (00:30 +0000)]
emit FMR instructions to convert f64<->f32 instructions, so things like
STOREs, know the right type to store.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23139 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix some really strange indentation that xcode likes to use.
Chris Lattner [Tue, 30 Aug 2005 00:19:00 +0000 (00:19 +0000)]
Fix some really strange indentation that xcode likes to use.

no xcode, this is not right:

   if (!foo) break;
     X;

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23138 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agofix a crash in cfrac
Chris Lattner [Mon, 29 Aug 2005 23:49:25 +0000 (23:49 +0000)]
fix a crash in cfrac

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23137 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement DYNAMIC_STACKALLOC, wrap some long lines
Chris Lattner [Mon, 29 Aug 2005 23:30:11 +0000 (23:30 +0000)]
Implement DYNAMIC_STACKALLOC, wrap some long lines

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23136 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a hack to avoid some horrible code in some cases by always emitting
Chris Lattner [Mon, 29 Aug 2005 23:21:29 +0000 (23:21 +0000)]
Add a hack to avoid some horrible code in some cases by always emitting
token chains first.  For this C function:

int test() {
  int i;
  for (i = 0; i < 100000; ++i)
    foo();
}

Instead of emitting this (condition before call)

.LBB_test_1:    ; no_exit
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr2, r30, r2
        bl L_foo$stub
        bne cr2, .LBB_test_1    ; no_exit

Emit this:

.LBB_test_1:    ; no_exit
        bl L_foo$stub
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr0, r30, r2
        bne cr0, .LBB_test_1    ; no_exit

Which makes it so we don't have to save/restore cr2 in the prolog/epilog of
the function.

This also makes the code much more similar to what the pattern isel produces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23135 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoimprove comment
Chris Lattner [Mon, 29 Aug 2005 22:48:32 +0000 (22:48 +0000)]
improve comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23134 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a dumb bug of mine where we were mishandling the PPC ABI (undef handling).
Chris Lattner [Mon, 29 Aug 2005 22:22:57 +0000 (22:22 +0000)]
Fix a dumb bug of mine where we were mishandling the PPC ABI (undef handling).
This fixes voronoi and bh in Olden, allowing all of olden to pass!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23133 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a new API for nate
Chris Lattner [Mon, 29 Aug 2005 22:00:00 +0000 (22:00 +0000)]
Add a new API for nate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23132 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a new API for Nate
Chris Lattner [Mon, 29 Aug 2005 21:59:31 +0000 (21:59 +0000)]
Add a new API for Nate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23131 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSome of us cared about the the promote path
Andrew Lenharth [Mon, 29 Aug 2005 20:46:51 +0000 (20:46 +0000)]
Some of us cared about the the promote path

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23130 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix an infinite loop on x86
Chris Lattner [Mon, 29 Aug 2005 17:30:00 +0000 (17:30 +0000)]
Fix an infinite loop on x86

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23129 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAllow bugpoint+PPC codegen to use fsqrt
Chris Lattner [Mon, 29 Aug 2005 13:14:24 +0000 (13:14 +0000)]
Allow bugpoint+PPC codegen to use fsqrt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23128 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug the last patch exposed in treeadd among others
Chris Lattner [Mon, 29 Aug 2005 01:07:02 +0000 (01:07 +0000)]
Fix a bug the last patch exposed in treeadd among others

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23127 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoA hack to fix a problem folding immedaites. This fixes Olden/power.
Chris Lattner [Mon, 29 Aug 2005 01:01:01 +0000 (01:01 +0000)]
A hack to fix a problem folding immedaites.  This fixes Olden/power.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23126 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix order of operands for copytoreg node when emitting calls. This fixes
Chris Lattner [Mon, 29 Aug 2005 00:26:57 +0000 (00:26 +0000)]
Fix order of operands for copytoreg node when emitting calls.  This fixes
Olden/msFix order of operands for copytoreg node when emitting calls.  This fixes
Olden/mstt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23125 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug in my previous patch that was using the wrong iterator. This fixes
Chris Lattner [Mon, 29 Aug 2005 00:10:46 +0000 (00:10 +0000)]
Fix a bug in my previous patch that was using the wrong iterator.  This fixes
Olden/bisort among others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23124 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd operands in the correct order
Chris Lattner [Mon, 29 Aug 2005 00:02:01 +0000 (00:02 +0000)]
add operands in the correct order

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23123 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug in ReplaceAllUsesWith
Chris Lattner [Sun, 28 Aug 2005 23:59:36 +0000 (23:59 +0000)]
Fix a bug in ReplaceAllUsesWith

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23122 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug in FP_EXTEND, implement FP_TO_SINT
Chris Lattner [Sun, 28 Aug 2005 23:59:09 +0000 (23:59 +0000)]
Fix a bug in FP_EXTEND, implement FP_TO_SINT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23121 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agofix an assertion failure in treeadd
Chris Lattner [Sun, 28 Aug 2005 23:39:22 +0000 (23:39 +0000)]
fix an assertion failure in treeadd

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23120 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdjust to member variable name change.
Reid Spencer [Sat, 27 Aug 2005 19:09:48 +0000 (19:09 +0000)]
Adjust to member variable name change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23119 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoChange the names of member variables per Chris' instructions, and document
Reid Spencer [Sat, 27 Aug 2005 19:09:02 +0000 (19:09 +0000)]
Change the names of member variables per Chris' instructions, and document
them more clearly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23118 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a typo.
Reid Spencer [Sat, 27 Aug 2005 19:06:05 +0000 (19:06 +0000)]
Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23117 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement PR614:
Reid Spencer [Sat, 27 Aug 2005 18:50:39 +0000 (18:50 +0000)]
Implement PR614:
These changes modify the makefiles so that the output of flex and bison are
placed in the SRC directory, not the OBJ directory. It is intended that they
be checked in as any other LLVM source so that platforms without convenient
access to flex/bison can be compiled. From now on, if you change a .y or
.l file you *must* also commit the generated .cpp and .h files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23115 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoDisable this code, which broke many tests last night
Chris Lattner [Sat, 27 Aug 2005 16:16:51 +0000 (16:16 +0000)]
Disable this code, which broke many tests last night

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23114 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agofix PHI node emission for basic blocks that have select_cc's in them on ppc32
Chris Lattner [Sat, 27 Aug 2005 00:58:02 +0000 (00:58 +0000)]
fix PHI node emission for basic blocks that have select_cc's in them on ppc32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23113 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThe condition register being branched on may not be cr0, as such, print it.
Chris Lattner [Fri, 26 Aug 2005 23:42:05 +0000 (23:42 +0000)]
The condition register being branched on may not be cr0, as such, print it.
This fixes: UnitTests/2005-07-17-INT-To-FP.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23112 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoPropagate cr# from COND_BRANCH to the actual branch instruction as appropriate
Chris Lattner [Fri, 26 Aug 2005 23:41:27 +0000 (23:41 +0000)]
Propagate cr# from COND_BRANCH to the actual branch instruction as appropriate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23111 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNate noticed that Andrew never did this. This fixes PR600
Chris Lattner [Fri, 26 Aug 2005 22:50:40 +0000 (22:50 +0000)]
Nate noticed that Andrew never did this.  This fixes PR600

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23110 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoDon't copy regs that are only used in the entry block into a vreg. This
Chris Lattner [Fri, 26 Aug 2005 22:49:59 +0000 (22:49 +0000)]
Don't copy regs that are only used in the entry block into a vreg.  This
changes the code generated for:

short %test(short %A) {
  %B = xor short %A, -32768
  ret short %B
}

to:

_test:
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 16, 31
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23109 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake this code safe for when loadRegFromStackSlot inserts multiple instructions.
Chris Lattner [Fri, 26 Aug 2005 22:18:32 +0000 (22:18 +0000)]
Make this code safe for when loadRegFromStackSlot inserts multiple instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23108 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoallow code using mtcrf to assemble
Chris Lattner [Fri, 26 Aug 2005 22:05:54 +0000 (22:05 +0000)]
allow code using mtcrf to assemble

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23107 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove operand type 'crbit', since it is no longer used
Nate Begeman [Fri, 26 Aug 2005 22:04:17 +0000 (22:04 +0000)]
Remove operand type 'crbit', since it is no longer used

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23106 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoteach getClass what a condition reg is
Chris Lattner [Fri, 26 Aug 2005 21:51:29 +0000 (21:51 +0000)]
teach getClass what a condition reg is

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23105 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMinor cleanups:
Chris Lattner [Fri, 26 Aug 2005 21:49:18 +0000 (21:49 +0000)]
Minor cleanups:
  * avoid calling getClass() multiple times (it is relatively expensive)
  * Allow -disable-fp-elim to turn of frame pointer elimination.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23104 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoChecking types here is not safe, because multiple types can map to the same
Chris Lattner [Fri, 26 Aug 2005 21:39:15 +0000 (21:39 +0000)]
Checking types here is not safe, because multiple types can map to the same
register class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23103 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoimplement SELECT_CC fully for the DAG->DAG isel!
Chris Lattner [Fri, 26 Aug 2005 21:23:58 +0000 (21:23 +0000)]
implement SELECT_CC fully for the DAG->DAG isel!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23101 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd some forward defs
Chris Lattner [Fri, 26 Aug 2005 21:06:40 +0000 (21:06 +0000)]
add some forward defs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23100 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agospell this right
Chris Lattner [Fri, 26 Aug 2005 20:55:40 +0000 (20:55 +0000)]
spell this right

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23099 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoCall the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
Chris Lattner [Fri, 26 Aug 2005 20:54:47 +0000 (20:54 +0000)]
Call the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
flag is set on an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23098 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agospell this right!
Chris Lattner [Fri, 26 Aug 2005 20:53:44 +0000 (20:53 +0000)]
spell this right!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23097 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a hook
Chris Lattner [Fri, 26 Aug 2005 20:53:09 +0000 (20:53 +0000)]
Add a hook

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23096 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agospell this variable right
Chris Lattner [Fri, 26 Aug 2005 20:42:52 +0000 (20:42 +0000)]
spell this variable right

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23095 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoExpose a new flag to TargetInstrInfo
Chris Lattner [Fri, 26 Aug 2005 20:40:46 +0000 (20:40 +0000)]
Expose a new flag to TargetInstrInfo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23094 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a new instruction flag
Chris Lattner [Fri, 26 Aug 2005 20:31:24 +0000 (20:31 +0000)]
Add a new instruction flag

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23093 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a flag
Chris Lattner [Fri, 26 Aug 2005 20:29:01 +0000 (20:29 +0000)]
Add a flag

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23092 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake fsel emission work with both the pattern and dag-dag selectors, by
Chris Lattner [Fri, 26 Aug 2005 20:25:03 +0000 (20:25 +0000)]
Make fsel emission work with both the pattern and dag-dag selectors, by
giving it a non-instruction opcode.  The dag->dag selector used to not
select the operands of the fsel, because it thought that whole tree was
already selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23091 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd a marker at the end of the instruction enum list
Chris Lattner [Fri, 26 Aug 2005 20:17:00 +0000 (20:17 +0000)]
add a marker at the end of the instruction enum list

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23090 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoimplement the fold for:
Chris Lattner [Fri, 26 Aug 2005 18:46:49 +0000 (18:46 +0000)]
implement the fold for:

bool %test(int %X, int %Y) {
        %C = setne int %X, 0
        ret bool %C
}

to:

_test:
        addic r2, r3, -1
        subfe r3, r2, r3
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23089 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoChanges to adjust to new ReplaceAllUsesWith syntax. Change FP_EXTEND to
Chris Lattner [Fri, 26 Aug 2005 18:37:23 +0000 (18:37 +0000)]
Changes to adjust to new ReplaceAllUsesWith syntax.  Change FP_EXTEND to
just return its input, instead of emitting an explicit copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23088 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRevampt ReplaceAllUsesWith to be more efficient and easier to use.
Chris Lattner [Fri, 26 Aug 2005 18:36:28 +0000 (18:36 +0000)]
Revampt ReplaceAllUsesWith to be more efficient and easier to use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23087 91177308-0d34-0410-b5e6-96231b3b80d8