Commit Graph

1814 Commits

Author SHA1 Message Date
Chris Lattner
5ab6f5fe66 Teach live intervals to not crash on dead livein regs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23206 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:20:32 +00:00
Chris Lattner
fab08875b7 For values that are live across basic blocks and need promotion, use ANY_EXTEND
instead of ZERO_EXTEND to eliminate extraneous extensions.  This eliminates
dead zero extensions on formal arguments and other cases on PPC, implementing
the newly tightened up test/Regression/CodeGen/PowerPC/small-arguments.ll test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23205 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:19:37 +00:00
Chris Lattner
13c78e2e5f legalize ANY_EXTEND appropriately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23204 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:18:10 +00:00
Chris Lattner
4ed11b4b79 Add support for ANY_EXTEND and add a few minor folds for it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23203 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:17:32 +00:00
Nate Begeman
39f60a2302 Fix some code in the current node combining code, spotted when it was moved
over to DAGCombiner.cpp

1. Don't assume that SetCC returns i1 when folding (xor (setcc) constant)
2. Don't duplicate code in folding AND with AssertZext that is handled by
   MaskedValueIsZero


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23196 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 23:25:49 +00:00
Nate Begeman
4ebd805c6a Implement first round of feedback from chris (there's still a couple things
left to do).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23195 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 23:24:04 +00:00
Chris Lattner
da8abb0239 It is NDEBUG not _NDEBUG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23186 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 18:44:10 +00:00
Nate Begeman
4942a9687d 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
2005-09-01 00:33:32 +00:00
Nate Begeman
1d4d414111 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
2005-09-01 00:19:25 +00:00
Chris Lattner
a1f68ca94e 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
2005-08-31 22:34:59 +00:00
Chris Lattner
50ec897904 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
2005-08-31 19:01:53 +00:00
Jeff Cohen
7383ce4127 Fix VC++ precedence warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23169 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 02:47:06 +00:00
Nate Begeman
fe75a2836a Sigh, not my day. Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23166 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 00:43:49 +00:00
Nate Begeman
9f52f2838d 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
2005-08-31 00:43:08 +00:00
Nate Begeman
b85dfab889 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
2005-08-31 00:27:53 +00:00
Chris Lattner
0fdd768094 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
2005-08-30 22:38:38 +00:00
Chris Lattner
e836ad6736 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
2005-08-30 21:03:36 +00:00
Chris Lattner
cc0675a4be 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
2005-08-30 17:21:17 +00:00
Chris Lattner
ec176e30d6 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
2005-08-30 16:56:19 +00:00
Nate Begeman
5ffcd9b56c 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
2005-08-30 02:54:28 +00:00
Nate Begeman
56eb86806d 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
2005-08-30 02:44:00 +00:00
Chris Lattner
f155635b53 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
2005-08-30 01:58:51 +00:00
Chris Lattner
55334fc45c Handle CopyToReg nodes with flag operands correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23144 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 01:57:23 +00:00
Chris Lattner
82e14db9a9 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
2005-08-29 23:21:29 +00:00
Chris Lattner
c26aefa15a Add a new API for Nate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23131 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 21:59:31 +00:00
Andrew Lenharth
5e3efbc2ca 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
2005-08-29 20:46:51 +00:00
Chris Lattner
507f752f6e Fix an infinite loop on x86
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23129 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 17:30:00 +00:00
Chris Lattner
dfd58709cc 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
2005-08-29 00:10:46 +00:00
Chris Lattner
ff01698ec0 Fix a bug in ReplaceAllUsesWith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23122 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-28 23:59:36 +00:00
Reid Spencer
0f9beca707 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
2005-08-27 19:09:02 +00:00
Chris Lattner
88b9c15912 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
2005-08-27 16:16:51 +00:00
Chris Lattner
620c93cca1 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
2005-08-27 00:58:02 +00:00
Chris Lattner
eb150d7d1f 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
2005-08-26 22:50:40 +00:00
Chris Lattner
9d3a483a38 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
2005-08-26 22:49:59 +00:00
Chris Lattner
ed461e0faf 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
2005-08-26 22:18:32 +00:00
Chris Lattner
579cfabdad 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
2005-08-26 21:39:15 +00:00
Chris Lattner
025c39bf36 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
2005-08-26 20:54:47 +00:00
Chris Lattner
8b52f21f10 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
2005-08-26 18:36:28 +00:00
Chris Lattner
5839bf2b3b Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23081 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:15:30 +00:00
Chris Lattner
2bb06cdf27 Fix a huge annoyance: SelectNodeTo took types before the opcode unlike
every other SD API.  Fix it to take the opcode before the types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23079 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 16:36:26 +00:00
Chris Lattner
d7050a9c50 the 5th operand is the 4th number
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23074 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:43:46 +00:00
Chris Lattner
23004e5f21 Add support for targets that want to custom expand select_cc in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23071 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:23:59 +00:00
Chris Lattner
07dffd6af6 Allow LowerOperation to return a null SDOperand in case it wants to lower
some things given to it, but not all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23070 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:14:16 +00:00
Chris Lattner
f07d023dd9 Fix a nasty bug from a previous patch of mine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23069 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:13:12 +00:00
Nate Begeman
1999b4b974 New fold for SELECT_CC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23058 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 20:04:38 +00:00
Chris Lattner
43247a157b Don't auto-cse nodes that return flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23055 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 19:12:10 +00:00
Chris Lattner
9d338cf3a3 simplify the code a bit using isOperationLegal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23053 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:54:58 +00:00
Chris Lattner
376d54f9b6 Add support for flag operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23050 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:48:54 +00:00
Chris Lattner
4025a9c2cc ADd support for TargetConstantPool nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23041 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 05:03:06 +00:00
Chris Lattner
afb2dd43de add a new TargetFrameIndex node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23035 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:43:01 +00:00
Chris Lattner
7651fa4a7e add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23027 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 23:00:29 +00:00
Chris Lattner
7b2880c4cd Add ReplaceAllUsesWith that can take a vector of replacement values.
Add some foldings to hopefully help the illegal setcc issue, and move some code around.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23025 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:44:39 +00:00
Chris Lattner
14b392af1d Add support for external symbols, and support for variable arity instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23022 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:02:41 +00:00
Chris Lattner
e39db07713 Fix pasto that prevented VT ndoes from showing up in -view-isel-dags correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23021 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 18:30:00 +00:00
Chris Lattner
1d6373c1af teach selection dag mask tracking about the fact that select_cc operates like
select.  Also teach it that the bit count instructions can only set the low bits
of the result, depending on the size of the input.

This allows us to compile this:

int %eq0(int %a) {
        %tmp.1 = seteq int %a, 0                ; <bool> [#uses=1]
        %tmp.2 = cast bool %tmp.1 to int                ; <int> [#uses=1]
        ret int %tmp.2
}

To this:

_eq0:
        cntlzw r2, r3
        srwi r3, r2, 5
        blr

instead of this:

_eq0:
        cntlzw r2, r3
        rlwinm r3, r2, 27, 31, 31
        blr

when setcc is marked illegal on ppc (which restores parity to non-illegal
setcc).  Thanks to Nate for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23013 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 16:46:55 +00:00
Chris Lattner
c9c60f6429 Start using isOperationLegal and isTypeLegal to simplify the code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23012 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 16:35:28 +00:00
Chris Lattner
9ed62c16f2 Adjust to new interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23010 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 16:34:12 +00:00
Nate Begeman
cebd433d8d Teach SelectionDAG how to simplify a few more setcc-equivalent select_cc
nodes so that backends don't have to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22999 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 04:57:57 +00:00
Chris Lattner
82cfa5d616 Make -view-isel-dags show the dag before instruction selecting, in case
the target isel crashes due to unimplemented features like calls :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22997 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:34:29 +00:00
Nate Begeman
0750a40a4f Fix optimization of select_cc seteq X, 0, 1, 0 -> srl (ctlz X), log2 X size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22995 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:21:28 +00:00
Chris Lattner
657b4d1ac6 Implement LiveVariables.h change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22994 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:09:33 +00:00
Chris Lattner
44b94c2185 adjust to new live variables interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22992 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 23:42:17 +00:00
Chris Lattner
ab4b66d4c2 Simplify this code by using higher-level LiveVariables methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22989 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 22:51:41 +00:00
Chris Lattner
b980578b41 Keep track of which registers are related to which other registers.
Use this information to avoid doing expensive interval intersections for
registers that could not possible be interesting.  This speeds up linscan
on ia64 compiling kc++ in release mode from taking 7.82s to 4.8s(!), total
itanium llc time on this program is 27.3s now.  This marginally speeds up
PPC and X86, but they appear to be limited by other parts of linscan, not
this code.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22986 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 22:27:31 +00:00
Nate Begeman
7042f15bde Teach the SelectionDAG how to transform select_cc eq, X, 0, 1, 0 into
either seteq X, 0 or srl (ctlz X), size(X-1), depending on what's legal
for the target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22978 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:41:12 +00:00
Nate Begeman
b942a3dd5f Teach Legalize how to turn setcc into select_cc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22977 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 04:29:48 +00:00
Chris Lattner
a411cbca5c Try to avoid scanning the fixed list. On architectures with a non-stupid
number of regs (e.g. most riscs), many functions won't need to use callee
clobbered registers.  Do a speculative check to see if we can get a free
register without processing the fixed list (which has all of these).  This
saves a lot of time on machines with lots of callee clobbered regs (e.g.
ppc and itanium, also x86).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22972 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 20:59:30 +00:00
Chris Lattner
a6c1750362 Move some code in the register assignment case that only needs to happen if
we spill out of the fast path.  The scan of active_ and the calls to
updateSpillWeights don't need to happen unless a spill occurs.  This reduces
debug llc time of kc++ with ppc from 187.3s to 183.2s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22971 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 20:20:42 +00:00
Chris Lattner
8f03405ee5 Fix a problem where constant expr shifts would not have their shift amount
promoted to the right type.  This fixes: IA64/2005-08-22-LegalizerCrash.ll


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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22966 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 16:55:22 +00:00
Chris Lattner
23553cfb4a Add a fast-path for register values. Add support for constant pool entries,
allowing us to compile this:

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

to this:

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22962 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 01:04:32 +00:00
Chris Lattner
c975e1dedc add anew method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22957 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 22:30:30 +00:00
Chris Lattner
81e72b13d7 Add support for frame index nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22956 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:56:04 +00:00
Chris Lattner
99baddaf57 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22955 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:48:59 +00:00
Chris Lattner
6b09a29604 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22949 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:49:33 +00:00
Chris Lattner
f85ab15acf Add support for basic blocks, fix a bug in result # computation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22948 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:49:29 +00:00
Chris Lattner
550b1e59c4 When legalizing brcond ->brcc or select -> selectcc, make sure to truncate
the old condition to a one bit value.  The incoming value must have been
promoted, and the top bits are undefined.  This causes us to generate:

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

instead of:

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

for:

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


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

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

to:

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

woot!


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

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

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


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

int %test() { ret int 65535 }

into:

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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22932 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 20:45:43 +00:00
Jeff Cohen
23c73a1823 Fix VC++ constant truncation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22907 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 16:19:21 +00:00
Jeff Cohen
a92b7c36e9 Fix VC++ precedence warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22902 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 04:39:48 +00:00
Chris Lattner
ca6aa2f70c Fix computation of # operands, add a temporary hack for CopyToReg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22896 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 01:01:34 +00:00
Chris Lattner
068ca15d5e add a new -view-sched-dags option to view dags as they are sent to the scheduler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22878 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 20:11:49 +00:00
Chris Lattner
2d973e45b8 Implement the first chunk of a code emitter. This is sophisticated enough to
codegen:

_empty:
.LBB_empty_0:   ;
        blr

but can't do anything more (yet). :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22876 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 20:07:59 +00:00
Chris Lattner
d32b23690d new file, obviously just a stub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22868 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:45:24 +00:00
Chris Lattner
36b708f057 Enable critical edge splitting by default
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22863 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 17:35:14 +00:00
Nate Begeman
294a0a103d Add support for target DAG nodes that take 4 operands, such as PowerPC's
rlwinm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22856 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 07:30:15 +00:00
Chris Lattner
a23e8154dc Fix printing of VTSDNodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22853 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 03:31:02 +00:00
Jim Laskey
58b968be85 Move the code dependency for MathExtras.h from SelectionDAGNodes.h.
Added some class dividers in SelectionDAG.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22841 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 20:08:02 +00:00
Jim Laskey
cb6682fa44 Culling out use of unions for converting FP to bits and vice versa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22838 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 19:34:49 +00:00
Chris Lattner
8b8749f367 Fix a bug in RemoveDeadNodes where it would crash when its "optional"
argument is not specified.

Implement ReplaceAllUsesWith.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22834 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 19:00:20 +00:00
Jim Laskey
02659d2363 Switched to using BitsToDouble for int_to_float to avoid aliasing problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22831 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 17:42:52 +00:00
Jim Laskey
491dfa88e4 Change hex float constants for the sake of VC++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22828 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 09:44:59 +00:00
Chris Lattner
495a0b5191 Add a new beta option for critical edge splitting, to avoid a problem that
Nate noticed in yacr2 (and I know occurs in other places as well).

This is still rough, as the critical edge blocks are not intelligently placed
but is added to get some idea to see if this improves performance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22825 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 06:37:43 +00:00