Commit Graph

12030 Commits

Author SHA1 Message Date
Evan Cheng 00fcb0017e Handling zero extension of 1 bit value.
llvm-svn: 24722
2005-12-15 01:02:48 +00:00
Evan Cheng bc9344477e Use MOV8rm to load 1 bit value.
llvm-svn: 24721
2005-12-15 00:59:17 +00:00
Nate Begeman 808f7a8abb Remove a now unused statistic.
llvm-svn: 24720
2005-12-14 22:56:16 +00:00
Nate Begeman e37cb604c1 Use the new predicate support that Evan Cheng added to remove some code
from the DAGToDAG cpp file.  This adds pattern support for vector and
scalar fma, which passes test/Regression/CodeGen/PowerPC/fma.ll, and
does the right thing in the presence of -disable-excess-fp-precision.

Allows us to match:
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = mul <4 x float> %tmp1, %tmp1
  %tmp3 = add <4 x float> %tmp2, %tmp1
  store <4 x float> %tmp3, <4 x float> *%a
  ret void
}

As:

_foo:
        li r2, 0
        lvx v0, r2, r3
        vmaddfp v0, v0, v0, v0
        stvx v0, r2, r3
        blr

Or, with llc -disable-excess-fp-precision,

_foo:
        li r2, 0
        lvx v0, r2, r3
        vxor v1, v1, v1
        vmaddfp v1, v0, v0, v1
        vaddfp v0, v1, v0
        stvx v0, r2, r3
        blr

llvm-svn: 24719
2005-12-14 22:54:33 +00:00
Evan Cheng 023aef2f31 Fixed a typo: line 2323: MOVSX16rm8 -> MOVZX16rm8. This was the cause fo 12/14/2005 hbd failure.
llvm-svn: 24717
2005-12-14 22:28:18 +00:00
Evan Cheng 3db275d996 Added predicate !NoExcessFPPrecision to FMADD, FMADDS, FMSUB, and FMSUBS.
llvm-svn: 24716
2005-12-14 22:07:12 +00:00
Evan Cheng d296a43f96 Added support to specify predicates.
llvm-svn: 24715
2005-12-14 22:02:59 +00:00
Evan Cheng b8be9d1596 Fixed extload type profile. The 4th operand is a ValueType node with type
OtherVT, it cannot be compare to type of 1st operand which is an integer type.

llvm-svn: 24713
2005-12-14 19:40:54 +00:00
Chris Lattner d39c60fcc8 When folding loads into ops, immediately replace uses of the op with the
load.  This reduces number of worklist iterations and avoid missing optimizations
depending on folding of things into sext_inreg nodes (which aren't supported by
all targets).
Tested by Regression/CodeGen/X86/extend.ll:test2

llvm-svn: 24712
2005-12-14 19:25:30 +00:00
Chris Lattner 7dac1083da Fix the (zext (zextload)) case to trigger, similarly for sign extends.
Allow (zext (truncate)) to apply after legalize if the target supports
AND (which all do).

This compiles
short %foo() {
        %tmp.0 = load ubyte* %X         ; <ubyte> [#uses=1]
        %tmp.3 = cast ubyte %tmp.0 to short             ; <short> [#uses=1]
        ret short %tmp.3
}

to:
_foo:
        movzbl _X, %eax
        ret

instead of:

_foo:
        movzbl _X, %eax
        movzbl %al, %eax
        ret

thanks to Evan for pointing this out.

llvm-svn: 24709
2005-12-14 19:05:06 +00:00
Chris Lattner 8c9e14620f Fix Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll, a crash on undefined
behavior in 126.gcc on big-endian systems.

llvm-svn: 24708
2005-12-14 17:23:59 +00:00
Chris Lattner f753d1a574 Fix a miscompilation in crafty due to a recent patch
llvm-svn: 24706
2005-12-14 07:58:38 +00:00
Evan Cheng c273900dd8 Added sext and zext patterns.
llvm-svn: 24705
2005-12-14 02:22:27 +00:00
Evan Cheng 683d8515b1 Added sextld + zextld DAG nodes.
llvm-svn: 24703
2005-12-14 02:21:01 +00:00
Evan Cheng bce7c47306 Fold (zext (load x) to (zextload x).
llvm-svn: 24702
2005-12-14 02:19:23 +00:00
Nate Begeman 40f081d8e0 Add support for fmul node of type v4f32.
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = mul <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

Is selected to:

_foo:
        li r2, 0
        lvx v0, r2, r3
        vxor v1, v1, v1
        vmaddfp v0, v0, v0, v1
        stvx v0, r2, r3
        blr

llvm-svn: 24701
2005-12-14 00:34:09 +00:00
Nate Begeman 69caef2b78 Prepare support for AltiVec multiply, divide, and sqrt.
llvm-svn: 24700
2005-12-13 22:55:22 +00:00
Reid Spencer 6796b48e51 Adjust the constructor to the Linker class to take an argument that names
the module being constructed. This is used to correctly name the module.
Previously the name of the linker tool was used which produces confusing
output when the module identifier is used in an error message.

llvm-svn: 24699
2005-12-13 20:00:37 +00:00
Reid Spencer 175613adf6 Improve ResolveFunctions to:
a) use better local variable names (OldMT -> OldFT) where "M" is used to
   mean "Function" (perhaps it was previously "Method"?)
b) print out the module identifier in a warning message so that it is
   possible to track down in which module the error occurred.

llvm-svn: 24698
2005-12-13 19:56:51 +00:00
Chris Lattner 5d4e61dd87 Don't lump the filename and working dir together
llvm-svn: 24697
2005-12-13 17:40:33 +00:00
Evan Cheng 229f0ee6d7 Add load + store folding srl and sra patterns.
llvm-svn: 24696
2005-12-13 07:24:22 +00:00
Chris Lattner 87079884d1 Use the shared asmprinter code for printing special llvm globals
llvm-svn: 24695
2005-12-13 06:32:50 +00:00
Chris Lattner f0e9aef954 Add a couple more fields, move ctor init list to .cpp file, add support
for emitting the ctor/dtor list for common targets.

llvm-svn: 24694
2005-12-13 06:32:10 +00:00
Chris Lattner 4d80f6e52e Add ELF and darwin support for static ctors and dtors
llvm-svn: 24693
2005-12-13 04:53:51 +00:00
Chris Lattner 54a11df95d reindent a loop, unswitch a loop. No functionality changes
llvm-svn: 24692
2005-12-13 04:33:58 +00:00
Nate Begeman 956aef45c9 Lowering constant pool entries on ppc exposed a bug in the recently added
ConstantVec legalizing code, which would return constantpool nodes that
were not of the target's pointer type.

llvm-svn: 24691
2005-12-13 03:03:23 +00:00
Evan Cheng acec857b1a Beautify a few patterns.
llvm-svn: 24690
2005-12-13 02:40:18 +00:00
Evan Cheng 89c6db4baf Some shl patterns which do load + store folding.
llvm-svn: 24689
2005-12-13 02:34:51 +00:00
Evan Cheng 108beceb0f A few helper fragments for loads. e.g. (i8 (load addr:$src)) -> (loadi8 addr:$src). Only to improve readibility.
llvm-svn: 24688
2005-12-13 01:57:51 +00:00
Evan Cheng ddd5ae5a22 Add and, or, and xor patterns which fold load + stores.
llvm-svn: 24687
2005-12-13 01:41:36 +00:00
Evan Cheng e5a94a03e2 Add inc + dec patterns which fold load + stores.
llvm-svn: 24686
2005-12-13 01:02:47 +00:00
Evan Cheng bde9e6fca6 Add neg and not patterns which fold load + stores.
llvm-svn: 24685
2005-12-13 00:54:44 +00:00
Evan Cheng c414d563f0 Missed a couple redundant explicit type casts.
llvm-svn: 24684
2005-12-13 00:25:07 +00:00
Evan Cheng 62e6808aa5 Fix some bad choice of names: i16SExt8 ->i16immSExt8, etc.
llvm-svn: 24683
2005-12-13 00:14:11 +00:00
Evan Cheng 86b2cf22d2 * Split immSExt8 to i16SExt8 and i32SExt8 for i16 and i32 immediate operands.
This enables the removal of some explicit type casts.
* Rename immZExt8 to i16ZExt8 as well.

llvm-svn: 24682
2005-12-13 00:01:09 +00:00
Evan Cheng 3e52756928 Add some integer mul patterns.
llvm-svn: 24681
2005-12-12 23:47:46 +00:00
Chris Lattner 9e8b633ec1 Accept and ignore prefetches for now
llvm-svn: 24678
2005-12-12 22:51:16 +00:00
Chris Lattner b42ce7ca63 Fix CodeGen/Generic/2005-12-12-ExpandSextInreg.ll
llvm-svn: 24677
2005-12-12 22:27:43 +00:00
Evan Cheng af3fe8217a Add some sub patterns.
llvm-svn: 24675
2005-12-12 21:54:05 +00:00
Evan Cheng 67ed58e22b When SelectLEAAddr() fails, it shouldn't cause the side effect of having the
base or index operands being selected.

llvm-svn: 24674
2005-12-12 21:49:40 +00:00
Evan Cheng bfd259a2b7 For ISD::RET, if # of operands >= 2, try selection the real data dep. operand
first before the chain.
e.g.
int X;

int foo(int x)
{
  x += X + 37;
  return x;
}

If chain operand is selected first, we would generate:
	movl X, %eax
	movl 4(%esp), %ecx
	leal 37(%ecx,%eax), %eax

rather than
	movl $37, %eax
	addl 4(%esp), %eax
	addl X, %eax

which does not require %ecx. (Due to ADD32rm not matching.)

llvm-svn: 24673
2005-12-12 20:32:18 +00:00
Andrew Lenharth cd54254af3 fix FP selects
llvm-svn: 24672
2005-12-12 20:30:09 +00:00
Chris Lattner d6b17765e4 remove some never-completed and now-obsolete code.
llvm-svn: 24671
2005-12-12 20:12:20 +00:00
Evan Cheng e80248b378 Add a few more add / store patterns. e.g. ADD32mi8.
llvm-svn: 24670
2005-12-12 19:45:23 +00:00
Andrew Lenharth b8296181e0 restore a more restricted select
llvm-svn: 24668
2005-12-12 17:43:52 +00:00
Chris Lattner 3b0a62d8a5 Implement a little hack for parity with GCC on crafty. This speeds up
186.crafty by about 16% (from 15.109s to 13.045s) on my system.

This turns allocas with unions/casts into scalars.  For example crafty has
something like this:

    union doub {
      unsigned short i[4];
      long long d;
    };
int f(long long a) {
  return ((union doub){.d=a}).i[1];
}

Instead of generating loads and stores to an alloca, we now promote the
whole thing to a scalar long value.

This implements: Transforms/ScalarRepl/AggregatePromote.ll

llvm-svn: 24667
2005-12-12 07:19:13 +00:00
Chris Lattner a4c6cc5af4 Fix typo :(
llvm-svn: 24664
2005-12-11 18:43:13 +00:00
Chris Lattner f1a54c0d14 Minor tweak to get isel opt
llvm-svn: 24663
2005-12-11 09:05:13 +00:00
Chris Lattner 254e0a842f add selectcc
llvm-svn: 24662
2005-12-11 08:35:54 +00:00
Chris Lattner 090eed0483 Remove type casts that are no longer needed
llvm-svn: 24661
2005-12-11 07:45:47 +00:00
Chris Lattner e6f2c82073 Realize the constant pool & global addrs must always be ptr type
llvm-svn: 24660
2005-12-11 07:45:04 +00:00
Chris Lattner 3d9559fedc Fix the JIT failures from last night.
llvm-svn: 24659
2005-12-11 07:37:41 +00:00
Andrew Lenharth 20d0b81c04 FP select improvements (and likely breakage), oh and crazy people might want to *return* floating point values. Don't see why myself
llvm-svn: 24658
2005-12-11 03:54:31 +00:00
Nate Begeman 4e56db674c Add support for TargetConstantPool nodes to the dag isel emitter, and use
them in the PPC backend, to simplify some logic out of Select and
SelectAddr.

llvm-svn: 24657
2005-12-10 02:36:00 +00:00
Evan Cheng 3c5198336c Use SDTCisPtrTy type property for store address.
llvm-svn: 24656
2005-12-10 01:59:36 +00:00
Evan Cheng 0d6cfee704 * Added X86 store patterns.
* Added X86 dec patterns.

llvm-svn: 24654
2005-12-10 00:48:20 +00:00
Evan Cheng dadc1057ac Added new getNode and getTargetNode variants for X86 stores.
llvm-svn: 24653
2005-12-10 00:37:58 +00:00
Nate Begeman ade6f9a255 Add support patterns to many load and store instructions which will
hopefully use patterns in the near future.

llvm-svn: 24651
2005-12-09 23:54:18 +00:00
Chris Lattner 27656ac89c Add SDTCisPtrTy and use it for loads, to indicate that the operand of a load
must be a pointer.  This removes a type check out of the code generated by
tblgen for load matching.

llvm-svn: 24650
2005-12-09 22:58:42 +00:00
Evan Cheng 275a3ed80c Added patterns for ADD8rm, etc. These fold load operands. e.g. addb 4(%esp), %al
llvm-svn: 24648
2005-12-09 22:48:48 +00:00
Chris Lattner a6f835f5a0 Avoid emitting two tabs when switching to a named section
llvm-svn: 24646
2005-12-09 19:28:49 +00:00
Chris Lattner e0f5f8e43c Teach the PPC backend about the ctor and dtor list when not using __main and
linking the entire program into one bc file.

llvm-svn: 24645
2005-12-09 18:24:29 +00:00
Chris Lattner 268d457b69 Teach legalize how to promote sext_inreg to fix a problem Andrew pointed
out to me.

llvm-svn: 24644
2005-12-09 17:32:47 +00:00
Andrew Lenharth 87bf2234b5 it helps if your conditionals are not reversed
llvm-svn: 24641
2005-12-09 00:45:42 +00:00
Chris Lattner be73d6eece improve code insertion in two ways:
1. Only forward subst offsets into loads and stores, not into arbitrary
   things, where it will likely become a load.
2. If the source is a cast from pointer, forward subst the cast as well,
   allowing us to fold the cast away (improving cases when the cast is
   from an alloca or global).

This hasn't been fully tested, but does appear to further reduce register
pressure and improve code.  Lets let the testers grind on it a bit. :)

llvm-svn: 24640
2005-12-08 08:00:12 +00:00
Chris Lattner 29e6c3dbf9 Add another important case we miss
llvm-svn: 24639
2005-12-08 07:13:28 +00:00
Evan Cheng 790af6d18f Added support for ComplexPattern.
llvm-svn: 24638
2005-12-08 04:28:48 +00:00
Evan Cheng f039648614 Added explicit type field to ComplexPattern.
llvm-svn: 24637
2005-12-08 02:15:07 +00:00
Evan Cheng c9fab31098 * Added intelligence to X86 LEA addressing mode matching routine so it returns
false if the match is not profitable. e.g. leal 1(%eax), %eax.
* Added patterns for X86 integer loads and LEA32.

llvm-svn: 24635
2005-12-08 02:01:35 +00:00
Nate Begeman ae89d862f5 Fix a crash where ConstantVec nodes were being generated with the wrong
type when the target did not support them.  Also teach Legalize how to
expand ConstantVecs.

This allows us to generate

_test:
        lwz r2, 12(r3)
        lwz r4, 8(r3)
        lwz r5, 4(r3)
        lwz r6, 0(r3)
        addi r2, r2, 4
        addi r4, r4, 3
        addi r5, r5, 2
        addi r6, r6, 1
        stw r2, 12(r3)
        stw r4, 8(r3)
        stw r5, 4(r3)
        stw r6, 0(r3)
        blr

For:

void %test(%v4i *%P) {
        %T = load %v4i* %P
        %S = add %v4i %T, <int 1, int 2, int 3, int 4>
        store %v4i %S, %v4i * %P
        ret void
}

On PowerPC.

llvm-svn: 24633
2005-12-07 19:48:11 +00:00
Chris Lattner 57c882edf8 Only transform (sext (truncate x)) -> (sextinreg x) if before legalize or
if the target supports the resultant sextinreg

llvm-svn: 24632
2005-12-07 18:02:05 +00:00
Chris Lattner 3225733e65 X86 doesn't support sextinreg for 8-bit things either.
llvm-svn: 24631
2005-12-07 17:59:14 +00:00
Chris Lattner cbd3d01a43 Teach the dag combiner to turn a truncate/sign_extend pair into a sextinreg
when the types match up.  This allows the X86 backend to compile:

sbyte %toggle_value(sbyte* %tmp.1) {
        %tmp.2 = load sbyte* %tmp.1
        ret sbyte %tmp.2
}

to this:

_toggle_value:
        mov %EAX, DWORD PTR [%ESP + 4]
        movsx %EAX, BYTE PTR [%EAX]
        ret

instead of this:

_toggle_value:
        mov %EAX, DWORD PTR [%ESP + 4]
        movsx %EAX, BYTE PTR [%EAX]
        movsx %EAX, %AL
        ret

noticed in Shootout/objinst.

-Chris

llvm-svn: 24630
2005-12-07 07:11:03 +00:00
Andrew Lenharth 26473b6b58 fix divide and remainder
llvm-svn: 24628
2005-12-06 23:27:39 +00:00
Chris Lattner de085f0165 Silence another annoying GCC warning
llvm-svn: 24627
2005-12-06 20:56:18 +00:00
Andrew Lenharth 973cd1c845 more decent branches for FP. I might have to make some intermediate nodes to actually be able to use the DAG for FPcmp
llvm-svn: 24625
2005-12-06 20:43:30 +00:00
Andrew Lenharth 29b7ef0065 OK, this does wonders for broken stuff
llvm-svn: 24624
2005-12-06 20:40:34 +00:00
Sumant Kowshik a69fcbdeb8 Collapsing node if variable length struct with final field of length zero
llvm-svn: 24621
2005-12-06 18:04:30 +00:00
Chris Lattner d490d4f023 Fix test/Regression/Linker/2005-12-06-AppendingZeroLengthArrays.ll and
PR662.  Thanks to Markus for providing me with a ton of files to
reproduce the problem!

llvm-svn: 24619
2005-12-06 17:30:58 +00:00
Nate Begeman 41b1cdc771 Teach the SelectionDAG ISel how to turn ConstantPacked values into
constant nodes with vector types.  Also teach the asm printer how to print
ConstantPacked constant pool entries.  This allows us to generate altivec
code such as the following, which adds a vector constantto a packed float.

LCPI1_0:  <4 x float> < float 0.0e+0, float 0.0e+0, float 0.0e+0, float 1.0e+0 >
        .space  4
        .space  4
        .space  4
        .long   1065353216      ; float 1
        .text
        .align  4
        .globl  _foo
_foo:
        lis r2, ha16(LCPI1_0)
        la r2, lo16(LCPI1_0)(r2)
        li r4, 0
        lvx v0, r4, r2
        lvx v1, r4, r3
        vaddfp v0, v1, v0
        stvx v0, r4, r3
        blr

For the llvm code:

void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, < float 0.0, float 0.0, float 0.0, float 1.0 >
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

llvm-svn: 24616
2005-12-06 06:18:55 +00:00
Chris Lattner fea33f7e64 Use new PPC-specific nodes to represent shifts which require the 6-bit
amount handling that PPC provides.  These are generated by the lowering code
and prevents the dag combiner from assuming (rightfully) that the shifts
don't only look at 5 bits.  This fixes a miscompilation of crafty with
the new front-end.

llvm-svn: 24615
2005-12-06 02:10:38 +00:00
Andrew Lenharth e788bbf6ef added instructions with inverted immediates
llvm-svn: 24614
2005-12-06 00:33:53 +00:00
Andrew Lenharth 08c4a775e6 yea, it helps to have your path set right when testing
llvm-svn: 24613
2005-12-05 23:41:45 +00:00
Andrew Lenharth 3c7c4d7508 These never trigger, but whatever
llvm-svn: 24612
2005-12-05 23:19:44 +00:00
Evan Cheng c0c190239d Remove unnecessary let hasCtrlDep=1 now it can be inferred.
llvm-svn: 24611
2005-12-05 23:09:43 +00:00
Andrew Lenharth 5bfcd1e63a move this over to the dag
llvm-svn: 24609
2005-12-05 20:50:53 +00:00
Chris Lattner 077200737c getRawValue zero extens for unsigned values, use getsextvalue so that we
know that small negative values fit into the immediate field of addressing
modes.

llvm-svn: 24608
2005-12-05 18:23:57 +00:00
Andrew Lenharth 9410433966 fix constant pool loads
llvm-svn: 24607
2005-12-05 17:51:02 +00:00
Chris Lattner 3539778883 Fix the #1 code quality problem that I have seen on X86 (and it also affects
PPC and other targets).  In a particular, consider code like this:

struct Vector3 { double x, y, z; };
struct Matrix3 { Vector3 a, b, c; };
double dot(Vector3 &a, Vector3 &b) {
   return a.x * b.x  +  a.y * b.y  +  a.z * b.z;
}
Vector3 mul(Vector3 &a, Matrix3 &b) {
   Vector3 r;
   r.x = dot( a, b.a );
   r.y = dot( a, b.b );
   r.z = dot( a, b.c );
   return r;
}
void transform(Matrix3 &m, Vector3 *x, int n) {
   for (int i = 0; i < n; i++)
      x[i] = mul( x[i], m );
}

we compile transform to a loop with all of the GEP instructions for indexing
into 'm' pulled out of the loop (9 of them).  Because isel occurs a bb at a time
we are unable to fold the constant index into the loads in the loop, leading to
PPC code that looks like this:

LBB3_1: ; no_exit.preheader
        li r2, 0
        addi r6, r3, 64        ;; 9 values live across the loop body!
        addi r7, r3, 56
        addi r8, r3, 48
        addi r9, r3, 40
        addi r10, r3, 32
        addi r11, r3, 24
        addi r12, r3, 16
        addi r30, r3, 8
LBB3_2: ; no_exit
        lfd f0, 0(r30)
        lfd f1, 8(r4)
        fmul f0, f1, f0
        lfd f2, 0(r3)        ;; no constant indices folded into the loads!
        lfd f3, 0(r4)
        lfd f4, 0(r10)
        lfd f5, 0(r6)
        lfd f6, 0(r7)
        lfd f7, 0(r8)
        lfd f8, 0(r9)
        lfd f9, 0(r11)
        lfd f10, 0(r12)
        lfd f11, 16(r4)
        fmadd f0, f3, f2, f0
        fmul f2, f1, f4
        fmadd f0, f11, f10, f0
        fmadd f2, f3, f9, f2
        fmul f1, f1, f6
        stfd f0, 0(r4)
        fmadd f0, f11, f8, f2
        fmadd f1, f3, f7, f1
        stfd f0, 8(r4)
        fmadd f0, f11, f5, f1
        addi r29, r4, 24
        stfd f0, 16(r4)
        addi r2, r2, 1
        cmpw cr0, r2, r5
        or r4, r29, r29
        bne cr0, LBB3_2 ; no_exit

uh, yuck.  With this patch, we now sink the constant offsets into the loop, producing
this code:

LBB3_1: ; no_exit.preheader
        li r2, 0
LBB3_2: ; no_exit
        lfd f0, 8(r3)
        lfd f1, 8(r4)
        fmul f0, f1, f0
        lfd f2, 0(r3)
        lfd f3, 0(r4)
        lfd f4, 32(r3)       ;; much nicer.
        lfd f5, 64(r3)
        lfd f6, 56(r3)
        lfd f7, 48(r3)
        lfd f8, 40(r3)
        lfd f9, 24(r3)
        lfd f10, 16(r3)
        lfd f11, 16(r4)
        fmadd f0, f3, f2, f0
        fmul f2, f1, f4
        fmadd f0, f11, f10, f0
        fmadd f2, f3, f9, f2
        fmul f1, f1, f6
        stfd f0, 0(r4)
        fmadd f0, f11, f8, f2
        fmadd f1, f3, f7, f1
        stfd f0, 8(r4)
        fmadd f0, f11, f5, f1
        addi r6, r4, 24
        stfd f0, 16(r4)
        addi r2, r2, 1
        cmpw cr0, r2, r5
        or r4, r6, r6
        bne cr0, LBB3_2 ; no_exit

This is much nicer as it reduces register pressure in the loop a lot.  On X86,
this takes the function from having 9 spilled registers to 2.  This should help
some spec programs on X86 (gzip?)

This is currently only enabled with -enable-gep-isel-opt to allow perf testing
tonight.

llvm-svn: 24606
2005-12-05 07:10:48 +00:00
Chris Lattner 7d4d93c52c Add a flag to Module::getGlobalVariable to allow it to return vars with
internal linkage.

Patch provided by Evan Jones, thanks!

llvm-svn: 24604
2005-12-05 05:30:21 +00:00
Chris Lattner 165998207e Wrap a long line, never internalize llvm.used.
llvm-svn: 24602
2005-12-05 05:07:38 +00:00
Chris Lattner 3c0b8f577d Several things:
1. Remove redundant type casts now that PR673 is implemented.
2. Implement the OUT*ir instructions correctly.  The port number really
   *is* a 16-bit value, but the patterns should only match if the number
   is 0-255.  Update the patterns so they now match.
3. Fix patterns for shifts to reflect that the shift amount is always an
   i8, not an i16 as they were believed to be before.  This previous fib
   stopped working when we started knowing that CL has type i8.
4. Change use of i16i8imm in SH*ri patterns to all be imm.

llvm-svn: 24599
2005-12-05 02:40:25 +00:00
Chris Lattner 282c2af4d8 On some targets (e.g. X86), shift amounts are not the same as the value
being shifted.  Don't assume they are.

llvm-svn: 24598
2005-12-05 02:37:26 +00:00
Chris Lattner c54cddd25b Add some explicit type casts so that tblgen knows the type of the shiftamount, which is not necessarily the same as the type being shifted.
llvm-svn: 24595
2005-12-05 02:34:29 +00:00
Chris Lattner f3322af5c6 Add some explicit type casts so that tblgen knows the type of the shift
amount, which is not necessarily the same as the type being shifted.

llvm-svn: 24594
2005-12-05 02:34:05 +00:00
Chris Lattner efc86f5f7a The basic fneg cases are already autogen'd
llvm-svn: 24592
2005-12-04 19:04:38 +00:00
Chris Lattner f979794717 Autogen matching code for ADJCALLSTACK[UP|DOWN], thanks to Evan's tblgen
improvements.

llvm-svn: 24591
2005-12-04 19:01:59 +00:00
Chris Lattner fd857daa0d Finish moving uncond br over to .td file, remove from .cpp file.
llvm-svn: 24590
2005-12-04 18:48:01 +00:00
Chris Lattner d9d18aff6a Define BR in the .td file now that Evan made tblgen smarter.
llvm-svn: 24589
2005-12-04 18:42:54 +00:00
Evan Cheng 95cb763818 Added isel patterns for RET, JMP, and WRITEPORT.
llvm-svn: 24588
2005-12-04 08:19:43 +00:00
Evan Cheng e8531381e2 * Added instruction property hasCtrlDep for those which r/w control-flow
chains.
* Added DAG node property SDNPHasChain for nodes which r/w control-flow
  chains.
* Renamed SDTVT to SDTOther.
* Added several new SDTypeProfiles for BR, BRCOND, RET, and WRITEPORT.
* Added SDNode definitions for BR, BRCOND, RET, and WRITEPORT.

llvm-svn: 24586
2005-12-04 08:13:17 +00:00
Chris Lattner 7e79292fef Fix PR672 another way which should be more robust
llvm-svn: 24585
2005-12-04 06:03:50 +00:00
Chris Lattner 8782b782cd dbg.stoppoint returns a value, don't forget to init it
llvm-svn: 24583
2005-12-03 18:50:48 +00:00
Chris Lattner 2820b8c855 Fix SimplifyCFG/2005-12-03-IncorrectPHIFold.ll
llvm-svn: 24581
2005-12-03 18:25:58 +00:00
Chris Lattner ecfc7e56c5 Fix test/Regression/ExecutionEngine/2005-12-02-TailCallBug.ll and PR672.
This also fixes 177.mesa, the only program that fails with --enable-x86-fastcc
turned on.  Given a clean nightly tester run, we should be able to turn it
on by default!

llvm-svn: 24578
2005-12-03 07:15:55 +00:00
Andrew Lenharth f9b27d7011 bah, must generate all results
llvm-svn: 24574
2005-12-02 06:08:08 +00:00
Andrew Lenharth 73420b3795 cycle counter fix
llvm-svn: 24573
2005-12-02 04:56:24 +00:00
Chris Lattner 986cb40953 add a note
llvm-svn: 24572
2005-12-02 00:11:20 +00:00
Chris Lattner 0142afd6c1 Don't remove two operand, two result nodes from the binary ops map. These
should come from the arbitrary ops map.

This fixes Regression/CodeGen/PowerPC/2005-12-01-Crash.ll

llvm-svn: 24571
2005-12-01 23:14:50 +00:00
Chris Lattner 05b0b4575b Promote line and column number information for our friendly 64-bit targets.
llvm-svn: 24568
2005-12-01 18:21:35 +00:00
Chris Lattner 93feffb4ed IA64 doesn't support the LOCATION node, and for some reason the ISelPattern
stuff isn't using ISelLowering.cpp

llvm-svn: 24567
2005-12-01 18:19:53 +00:00
Chris Lattner df9287836e Make sure these get added into the codegenmap when appropriate
llvm-svn: 24566
2005-12-01 18:09:22 +00:00
Chris Lattner 9d0d715e83 This is a bugfix for SelectNodeTo. In certain situations, we could be
selecting a node and use a mix of getTargetNode() and SelectNodeTo.  Because
SelectNodeTo didn't check the CSE maps for a preexisting node and didn't insert
its result into the CSE maps, we would sometimes miss a CSE opportunity.

This is extremely rare, but worth fixing for completeness.

llvm-svn: 24565
2005-12-01 18:00:57 +00:00
Andrew Lenharth 7bb09912c8 major think-o
llvm-svn: 24564
2005-12-01 17:48:51 +00:00
Nate Begeman 006bb04f3a Support multiple ValueTypes per RegisterClass, needed for upcoming vector
work.  This change has no effect on generated code.

llvm-svn: 24563
2005-12-01 04:51:06 +00:00
Nate Begeman aa5f8f2a26 Cosmetic change, better reflects actual values
llvm-svn: 24562
2005-12-01 04:48:26 +00:00
Chris Lattner bd099102f0 Fix a regression caused by a patch earlier today
llvm-svn: 24561
2005-12-01 03:50:19 +00:00
Andrew Lenharth ce68ef8073 Flags where I think I need them, quick, before the nightly tester starts
llvm-svn: 24560
2005-12-01 01:53:10 +00:00
Evan Cheng 4b02426130 Proper support for shifts with register shift value.
llvm-svn: 24559
2005-12-01 00:43:55 +00:00
Evan Cheng d94aa71e1a Use a getCopyToReg() variant to generate a flaggy CopyToReg node.
llvm-svn: 24558
2005-12-01 00:41:50 +00:00
Chris Lattner 4b25924d2a SelectNodeTo now returns its result, we must pay attention to it.
llvm-svn: 24552
2005-11-30 23:04:38 +00:00
Chris Lattner a75694aa16 Pay attn to the node returned by SelectNodeTo
llvm-svn: 24551
2005-11-30 23:02:08 +00:00
Chris Lattner af2e0373dd SelectNodeTo now returns its result, we must pay attention to it.
llvm-svn: 24550
2005-11-30 22:59:19 +00:00
Chris Lattner e318977940 SelectNodeTo now returns N. Use it instead of return N directly.
llvm-svn: 24549
2005-11-30 22:53:06 +00:00
Chris Lattner be5dd5da19 Make SelectNodeTo return N
llvm-svn: 24548
2005-11-30 22:45:14 +00:00
Chris Lattner 3713e6b49c Fix Regression/CodeGen/PowerPC/2005-11-30-vastart-crash.ll
llvm-svn: 24547
2005-11-30 20:40:54 +00:00
Chris Lattner dc4ffef633 Fix a bug where we didn't realize that vaarg reads memory. This fixes
Transforms/DeadStoreElimination/2005-11-30-vaarg.ll

llvm-svn: 24545
2005-11-30 19:38:22 +00:00
Nate Begeman 11695c0537 Fix a typo in my latest change
llvm-svn: 24542
2005-11-30 18:57:39 +00:00
Nate Begeman 6f8c1ace6e No longer track value types for asm printer operands, and remove them as
an argument to every operand printing function.  Requires some slight
tweaks to x86, the only user.

llvm-svn: 24541
2005-11-30 18:54:35 +00:00
Chris Lattner c174048430 CALLSEQ_START/END nodes don't get memoized, do not add them in when
replaceAllUses'ing.

llvm-svn: 24539
2005-11-30 18:20:52 +00:00
Andrew Lenharth 7ffe3affda remove redundant code
llvm-svn: 24538
2005-11-30 17:14:11 +00:00
Andrew Lenharth 6ee8566cae At long last, you can say that f32 isn't supported for setcc
llvm-svn: 24537
2005-11-30 17:12:26 +00:00
Andrew Lenharth ede966e8ee Make typesafe that which isn't: FCMOVxx
llvm-svn: 24536
2005-11-30 17:11:20 +00:00
Andrew Lenharth 873ed82a36 FPSelect and more custom lowering
llvm-svn: 24535
2005-11-30 16:10:29 +00:00
Nate Begeman 1064d6ec43 First chunk of actually generating vector code for packed types. These
changes allow us to generate the following code:

_foo:
        li r2, 0
        lvx v0, r2, r3
        vaddfp v0, v0, v0
        stvx v0, r2, r3
        blr

for this llvm:

void %foo(<4 x float>* %a) {
entry:
        %tmp1 = load <4 x float>* %a
        %tmp2 = add <4 x float> %tmp1, %tmp1
        store <4 x float> %tmp2, <4 x float>* %a
        ret void
}

llvm-svn: 24534
2005-11-30 08:22:07 +00:00
Andrew Lenharth 6db615df14 All sorts of stuff.
Getting in on the custom lowering thing, yay
evilness with fp setcc, yuck
trivial int select, hmmm
in memory args for functions, yay
DIV and REM, always handy.  They should be custom lowered though.

Lots more stuff compiles now (go go single source!).  Of course, none of it
probably works, but that is what the nightly tester can find out :)

llvm-svn: 24533
2005-11-30 07:19:56 +00:00
Andrew Lenharth 8d17c70171 add support for custom lowering SINT_TO_FP
llvm-svn: 24531
2005-11-30 06:43:03 +00:00
Reid Spencer 3fd1b4c9bf Fix a problem with llvm-ranlib that (on some platforms) caused the archive
file to become corrupted due to interactions between mmap'd memory segments
and file descriptors closing. The problem is completely avoiding by using
a third temporary file.

Patch provided by Evan Jones

llvm-svn: 24527
2005-11-30 05:21:10 +00:00
Chris Lattner 9c7af08bc9 Fix a bug in a recent patch that broke shifts
llvm-svn: 24526
2005-11-30 05:11:18 +00:00
Evan Cheng 4eb7af9bc9 Added support to STORE and shifts to DAG to DAG isel.
llvm-svn: 24525
2005-11-30 02:51:20 +00:00
Evan Cheng 11d61613af Fixed a bug introduced by my last commit: TargetGlobalValues should key on
GlobalValue * and index pair. Update getGlobalAddress() for symmetry.

llvm-svn: 24524
2005-11-30 02:49:21 +00:00
Evan Cheng 0e0de2f3f0 Added an index field to GlobalAddressSDNode so it can represent X+12, etc.
llvm-svn: 24523
2005-11-30 02:04:11 +00:00
Evan Cheng d2cb70513d Fixed a minor bug: - -offset != offset iff offset == MININT
llvm-svn: 24522
2005-11-30 01:59:00 +00:00
Nate Begeman 048b26387b Represent the encoding of the SPR instructions as they actually are, so
that we can use the correct SPR numbers in the InstrInfo.td file.  This is
necessary to support VRsave.

llvm-svn: 24521
2005-11-29 22:42:50 +00:00
Evan Cheng 72ab335858 Add more X86 ISel patterns.
llvm-svn: 24520
2005-11-29 19:38:52 +00:00
Nate Begeman 3e7db9c6d5 Hook up one type, v4f32, to the VR RegisterClass for now.
llvm-svn: 24517
2005-11-29 08:17:20 +00:00
Nate Begeman c138118cdb Add the remainder of the AltiVec 4 x float instructions. Further
enhancements will be necessary to teach the code generator that since
there is no fmul, it will have to do vmaddfp, adding +0.0.

llvm-svn: 24516
2005-11-29 08:04:45 +00:00
Chris Lattner 435b402e1f Add support for a new STRING and LOCATION node for line number support, patch
contributed by Daniel Berlin, with a few cleanups here and there by me.

llvm-svn: 24515
2005-11-29 06:21:05 +00:00
Chris Lattner 9c415364cf No targets support line number info yet.
llvm-svn: 24513
2005-11-29 06:16:21 +00:00
Nate Begeman 89b049af90 Add the majority of the vector machien value types we expect to support,
and make a few changes to the legalization machinery to support more than
16 types.

llvm-svn: 24511
2005-11-29 05:45:29 +00:00
Evan Cheng 1d4af53444 Fixed a comment bug:
createPPCPatternInstructionSelector -> createPPCISelPattern

llvm-svn: 24510
2005-11-29 04:59:46 +00:00
Chris Lattner c418b5d938 refix typo
llvm-svn: 24505
2005-11-29 00:42:30 +00:00
Chris Lattner 7a18a25d33 don't say this is i128, because it isn't yet. Hopefully nate will change
this to be something sane, but in the mean time it is unused, so safe to
make something bogus.

llvm-svn: 24504
2005-11-29 00:41:40 +00:00
Chris Lattner d3bc8cb26d revert my change for the time being, which broke the build
llvm-svn: 24503
2005-11-29 00:24:08 +00:00
Chris Lattner 50986909dc fix a typo :)
llvm-svn: 24501
2005-11-28 22:42:15 +00:00
Andrew Lenharth d251192910 a few more comments on the interfaces and functions
llvm-svn: 24500
2005-11-28 18:10:59 +00:00
Andrew Lenharth 517caef495 Added documented rsprofiler interface. Also remove new profiler passes, the
old ones have been updated to implement the interface.

llvm-svn: 24499
2005-11-28 18:00:38 +00:00
Jeff Cohen 7ff44ec372 Fix VC++ warning.
llvm-svn: 24496
2005-11-28 06:45:57 +00:00
Chris Lattner 820c94e467 Add a missed optimization
llvm-svn: 24495
2005-11-28 04:52:39 +00:00
Andrew Lenharth 93e59f6032 Random sampling (aka Arnold and Ryder) profiling. This is still preliminary, but it works on spec on x86 and alpha. The idea is to allow profiling passes to remember what profiling they inserted, then a random sampling framework is inserted which consists of duplicated basic blocks (without profiling), such that at each backedge in the program and entry into every function, the framework chooses whether to use the instrumented code or the instrumentation free code. The goal of such a framework is to make it reasonably cheap to do random sampling of very expensive profiling products (such as load-value profiling).
The code is organized into 3 parts (2 passes)
1) a linked set of profiling passes, which implement an analysis group (linked, like alias analysis are).  These insert profiling into the program, and remember what they inserted, so that at a later time they can be queried about any instruction.

2) a pass that handles inserting the random sampling framework.  This also has options to control how random samples are choosen.  Currently implemented are Global counters, register allocated global counters, and read cycle counter (see? there was a reason for it).

The profiling passes are almost identical to the existing ones (block, function, and null profiling is supported right now), and they are valid passes without the sampling framework (hence the existing passes can be unified with the new ones, not done yet).

Some things are a bit ugly still, but that should be fixed up soon enough.

Other todo? making the counter values not "magic 2^16 -1" values, but dynamically choosable.

llvm-svn: 24493
2005-11-28 00:58:09 +00:00
Nate Begeman 11fd6b22b1 Small tweaks noticed while on the plane.
llvm-svn: 24492
2005-11-26 22:39:34 +00:00
Andrew Lenharth 5fc3794e71 since reg2mem requires it, might as well mention that it preserves it
llvm-svn: 24491
2005-11-25 16:04:54 +00:00
Duraid Madina 0c88f150c6 add support for dynamic_stackalloc to the dag isel (thanks andrew ;)
next up: support argument passing in memory, not just registers

llvm-svn: 24490
2005-11-25 07:49:25 +00:00
Nate Begeman 8492fd30ab Some first bits of AltiVec stuff: Instruction Formats, Encodings, and
Registers.  Apologies to Jim if the scheduling info so far isn't accurate.

There's a few more things like VRsave support that need to be finished up
in my local tree before I can commit code that Does The Right Thing for
turning 4 x float into the various altivec packed float instructions.

llvm-svn: 24489
2005-11-23 05:29:52 +00:00
Andrew Lenharth 061029dee2 Reg2Mem is something a pass may depend on, so allow that
llvm-svn: 24488
2005-11-22 22:14:23 +00:00
Andrew Lenharth 71b09bbb07 turns out, demotion and invokes and critical edges don't mix
llvm-svn: 24487
2005-11-22 21:45:19 +00:00
Andrew Lenharth d6a0308470 Fix warning, the better way. Really, this is what this instruction is for, so use it
llvm-svn: 24486
2005-11-22 20:59:00 +00:00
Andrew Lenharth 03390557fa Fix warning
llvm-svn: 24485
2005-11-22 20:56:05 +00:00
Nate Begeman d37c13154a Check in code to scalarize arbitrarily wide packed types for some simple
vector operations (load, add, sub, mul).

This allows us to codegen:
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

on ppc as:
_foo:
        lfs f0, 12(r3)
        lfs f1, 8(r3)
        lfs f2, 4(r3)
        lfs f3, 0(r3)
        fadds f0, f0, f0
        fadds f1, f1, f1
        fadds f2, f2, f2
        fadds f3, f3, f3
        stfs f0, 12(r3)
        stfs f1, 8(r3)
        stfs f2, 4(r3)
        stfs f3, 0(r3)
        blr

llvm-svn: 24484
2005-11-22 18:16:00 +00:00
Andrew Lenharth 0294e33ea4 massive DAGISel patch. lots and lots more stuff compiles now
llvm-svn: 24483
2005-11-22 04:20:06 +00:00
Nate Begeman 07890bbec4 Rather than attempting to legalize 1 x float, make sure the SD ISel never
generates it.  Make MVT::Vector expand-only, and remove the code in
Legalize that attempts to legalize it.

The plan for supporting N x Type is to continually epxand it in ExpandOp
until it gets down to 2 x Type, where it will be scalarized into a pair of
scalars.

llvm-svn: 24482
2005-11-22 01:29:36 +00:00
Chris Lattner ac6cb46429 Use HasDotTypeDotSizeDirective instead of forELF
llvm-svn: 24481
2005-11-21 23:06:54 +00:00
Chris Lattner 78161dbc84 Remove a level of indentation by using a continue.
llvm-svn: 24479
2005-11-21 22:48:18 +00:00
Chris Lattner 40f8c8450d Simplify the subtarget info, allow the asmwriter to do some target sensing
based on TargetType.

llvm-svn: 24478
2005-11-21 22:43:58 +00:00
Chris Lattner 99be8f766f Use subtarget information computed by X86Subtarget instead of rolling our own.
llvm-svn: 24477
2005-11-21 22:39:40 +00:00
Chris Lattner 3eb876117a Make the X86 subtarget compute the basic target type: ELF, Cygwin, Darwin,
or native Win32

llvm-svn: 24476
2005-11-21 22:31:58 +00:00
Chris Lattner ebc39f5a9c Add a forELF flag, allowing the removal of forCygwin and simplification of
conditionals.

llvm-svn: 24475
2005-11-21 22:19:48 +00:00
Chris Lattner 7df25ab429 simplify and genericize this code
llvm-svn: 24473
2005-11-21 19:50:31 +00:00
Duraid Madina 8edbf805d7 add support for div/rem to the dag->dag isel. yay.
llvm-svn: 24472
2005-11-21 14:14:54 +00:00
Duraid Madina f28b3bd8b4 I think I know what you meant here, but just to be safe I'll let you
do it. :)

    <_sabre_> excuses excuses

llvm-svn: 24471
2005-11-21 14:09:40 +00:00
Chris Lattner b9db67a045 Eliminate unneeded intermediate class. Move doFinalizeMethod to bottom of
file.

llvm-svn: 24470
2005-11-21 08:40:17 +00:00
Chris Lattner b55de47595 Start using shared asmprinter Constant Pool emitter, use shorter cpi names.
llvm-svn: 24469
2005-11-21 08:38:26 +00:00
Chris Lattner 4a7eb5132b prune #include
llvm-svn: 24468
2005-11-21 08:33:17 +00:00
Chris Lattner 8a5f3c1b68 Switch to using the shared constant pool printer, along with using shorter
CPI ids

llvm-svn: 24467
2005-11-21 08:32:23 +00:00
Chris Lattner 882b9fa977 Switch to using the generic constant pool emitter impl, use shorter
CPI names

llvm-svn: 24466
2005-11-21 08:29:17 +00:00
Chris Lattner ef83ebd45d Use generic constant pool emission code in the AsmPrinter class.
llvm-svn: 24465
2005-11-21 08:26:15 +00:00
Chris Lattner f2991cee1f Allow target to customize directive used to switch to arbitrary section in SwitchSection,
add generic constant pool emitter

llvm-svn: 24464
2005-11-21 08:25:09 +00:00
Chris Lattner ffbfa71866 Use the FunctionNumber provided by the AsmPrinter class
llvm-svn: 24462
2005-11-21 08:14:07 +00:00
Chris Lattner 08adbd13ff increment the function number in SetupMachineFunction
llvm-svn: 24461
2005-11-21 08:13:27 +00:00
Chris Lattner dd3bf8e4a2 Use CommentString where possible, fix a bug where aix mode wouldn't assemble
due to basic blocks being misnamed.

llvm-svn: 24459
2005-11-21 08:02:41 +00:00
Chris Lattner a0222a1698 unify the darwin and aix constant pool printers
llvm-svn: 24458
2005-11-21 07:57:37 +00:00
Chris Lattner bb644e39c0 Adjust to capitalized asmprinter method names
llvm-svn: 24457
2005-11-21 07:51:36 +00:00
Chris Lattner 99946fb63f Adjust to capitalized AsmPrinter method names
llvm-svn: 24456
2005-11-21 07:51:23 +00:00
Chris Lattner d365627d3e Use PrivateGlobalPrefix for basic block labels. This allows the x86 darwin
port to properly use L for the bb prefix instead of .

llvm-svn: 24454
2005-11-21 07:43:59 +00:00
Chris Lattner c2bc19af57 use PrivateGlobalPrefix for basic blocks
llvm-svn: 24453
2005-11-21 07:41:05 +00:00
Chris Lattner 2b53ea99b0 Use PrivateGlobalPrefix for basic block labels
llvm-svn: 24452
2005-11-21 07:39:22 +00:00
Chris Lattner 9885c97088 Use PrivateGlobalPrefix for basic blocks
llvm-svn: 24451
2005-11-21 07:38:08 +00:00
Chris Lattner a43b832f7f Switch to the new shared SwitchSection
llvm-svn: 24450
2005-11-21 07:30:28 +00:00
Chris Lattner 2bccd73dbb Start using SwitchSection, allowing globals and functions to be emitted
to specific sections.  Delete some dead functions copied from the X86 backend.

llvm-svn: 24449
2005-11-21 07:26:04 +00:00
Chris Lattner 050bf2faf8 convert the rest of this over to use SwitchSection
llvm-svn: 24448
2005-11-21 07:16:34 +00:00
Chris Lattner 024e32e118 Start using the AsmPrinter shared SwitchSection code. This allows the X86
backend to implement global variables in sections.

llvm-svn: 24447
2005-11-21 07:11:11 +00:00
Chris Lattner b650241f8b This is now implemented in common codegen code
llvm-svn: 24446
2005-11-21 07:06:58 +00:00
Chris Lattner 2ea5c99eca Add section switching to common code generator code. Add a couple of
asserts.

llvm-svn: 24445
2005-11-21 07:06:27 +00:00
Chris Lattner 2c0b435ba6 Rename SwitchSection -> switchSection to avoid conflicting with a future
change.

llvm-svn: 24443
2005-11-21 06:55:27 +00:00
Chris Lattner 8a4995e42a Start using PrivateGlobalPrefix correctly
llvm-svn: 24442
2005-11-21 06:51:52 +00:00
Chris Lattner 41cb115afb set PrivateGlobalPrefix on darwin, use it when printing out CP references
llvm-svn: 24441
2005-11-21 06:47:58 +00:00
Chris Lattner 618981fd03 Naturally align doubles in the constant pool, set PrivateGlobalPrefix on
darwin, use it when printing the constant pool indices so the labels are
appropriately private, emit cp entries to .const instead of .data on darwin
and only emit a single .section for the constant pool, not one for each
entry.

llvm-svn: 24440
2005-11-21 06:46:22 +00:00
Chris Lattner 6c1ca888d4 Lower READCYCLECOUNTER correctly, preserving the chain result
llvm-svn: 24438
2005-11-20 22:57:19 +00:00
Chris Lattner 44c28c22b7 Legalize MERGE_VALUES, expand READCYCLECOUNTER correctly, so it doesn't
break control dependence.

llvm-svn: 24437
2005-11-20 22:56:56 +00:00
Chris Lattner d1061ac8d1 encode rdtsc correctly
llvm-svn: 24435
2005-11-20 22:13:18 +00:00
Chris Lattner 6df9e11989 use chain operands to ensure the copies don't wander from the rdtsc instruction.
llvm-svn: 24434
2005-11-20 22:01:40 +00:00
Andrew Lenharth 0bf68ae434 The second patch of X86 support for read cycle counter.
llvm-svn: 24430
2005-11-20 21:41:10 +00:00
Andrew Lenharth 627cbd49b1 The first patch of X86 support for read cycle counter
llvm-svn: 24429
2005-11-20 21:32:07 +00:00
Chris Lattner a8d37d748f more progress towards bug 291 being finished. Patch by Owen Anderson,
HAVE_GV case fixed up by me.

llvm-svn: 24428
2005-11-20 03:45:52 +00:00
Chris Lattner 19baba67b5 Unbreak codegen of bools. This should fix the llc/jit/llc-beta failures
from last night.

llvm-svn: 24427
2005-11-19 18:40:42 +00:00
Chris Lattner 377bdbff91 Improve Selection DAG printer portability. Patch by Owen Anderson!
llvm-svn: 24425
2005-11-19 07:44:09 +00:00
Chris Lattner d7102c4980 Teach the x86 backend about the register constraints of its addressing mode.
Patch by Evan Cheng

llvm-svn: 24423
2005-11-19 07:01:30 +00:00
Chris Lattner 252d88c68e Capture more operand info, patch by Evan Cheng
llvm-svn: 24422
2005-11-19 07:00:10 +00:00
Chris Lattner a22eae0163 Teach the graph viewer to handle register operands that are zero.
llvm-svn: 24421
2005-11-19 06:58:46 +00:00
Chris Lattner 301015a703 Silence a bogus warning
llvm-svn: 24420
2005-11-19 05:51:46 +00:00
Chris Lattner 3f0f71b92b Add load and other support to the dag-dag isel. Patch contributed by Evan
Cheng!

llvm-svn: 24419
2005-11-19 02:11:08 +00:00
Chris Lattner f090f7eb0e Add some method variants, patch by Evan Cheng
llvm-svn: 24418
2005-11-19 01:44:53 +00:00
Nate Begeman b2e089c31b Teach LLVM how to scalarize packed types. Currently, this only works on
packed types with an element count of 1, although more generic support is
coming.  This allows LLVM to turn the following code:

void %foo(<1 x float> * %a) {
entry:
  %tmp1 = load <1 x float> * %a;
  %tmp2 = add <1 x float> %tmp1, %tmp1
  store <1 x float> %tmp2, <1 x float> *%a
  ret void
}

Into:

_foo:
        lfs f0, 0(r3)
        fadds f0, f0, f0
        stfs f0, 0(r3)
        blr

llvm-svn: 24416
2005-11-19 00:36:38 +00:00
Chris Lattner 9c37f23645 Fix a crash building 176.gcc due to my recent patch, which only fixed
half the problem.

llvm-svn: 24414
2005-11-18 18:30:47 +00:00
Andrew Lenharth 6bc51c6f34 prevent latent switch creation
llvm-svn: 24413
2005-11-18 13:57:03 +00:00
Nate Begeman 127321b14c Split out the shift code from visitBinary.
llvm-svn: 24412
2005-11-18 07:42:56 +00:00
Chris Lattner 3e9e8bd25c Implement a refinement to the mem2reg algorithm for cases where an alloca
has a single def.  In this case, look for uses that are dominated by the def
and attempt to rewrite them to directly use the stored value.

This speeds up mem2reg on these values and reduces the number of phi nodes
inserted.  This should address PR665.

llvm-svn: 24411
2005-11-18 07:31:42 +00:00
Chris Lattner 31dc3827d3 This needs proper dominance
llvm-svn: 24410
2005-11-18 07:29:44 +00:00
Chris Lattner b14c41378d post-dom-frontiers requires proper post-dominance
llvm-svn: 24409
2005-11-18 07:28:26 +00:00
Chris Lattner f519d1c6ef This requires proper dominance
llvm-svn: 24408
2005-11-18 07:27:53 +00:00
Chris Lattner 57ce97862d add more patterns, patch by Evan Cheng.
llvm-svn: 24406
2005-11-18 01:04:42 +00:00
Nate Begeman 227f1bdd2f Also add the new vector value type here, for completeness.
llvm-svn: 24405
2005-11-18 00:53:32 +00:00
Chris Lattner cdde9990b7 only use dyld stubs if not in ppc-static mode. This completes support for
non-static codegen.

llvm-svn: 24403
2005-11-17 19:40:30 +00:00
Chris Lattner bca0be812d This was checking the wrong GEP expression. Fixing this fixes a gccas crash
compiling mysql reported by Ted Kremenek.

llvm-svn: 24402
2005-11-17 19:35:42 +00:00
Chris Lattner 6ab87fa360 refactor call operand handling to eliminate special cases from printOp.
llvm-svn: 24401
2005-11-17 19:25:59 +00:00
Chris Lattner bd9efdb64c disentangle call operands from branch operands a bit
llvm-svn: 24400
2005-11-17 19:16:08 +00:00
Chris Lattner 3570cf456b add an option to generate completely non-pic code, corresponding to what
gcc -static produces on PPC.  This is used for building kexts and other things.

With this, materializing the address of a global looks like:

        lis r2, ha16(L_H$non_lazy_ptr)
        la r3, lo16(L_H$non_lazy_ptr)(r2)

we're still emitting stubs for functions, which is wrong.  That is next.

llvm-svn: 24399
2005-11-17 18:55:48 +00:00
Chris Lattner 8f8ed28a64 Fix a bug that resistor on IRC hit where we tried to create token factor
nodes of load results, not of their chain results.

llvm-svn: 24398
2005-11-17 18:30:17 +00:00
Chris Lattner 5aba6ae3b3 Enable global address legalization, fixing a todo and allowing the removal
of some code.  This exposes the implicit load from the stubs to the DAG, allowing
them to be optimized by the dag combiner.  It also moves darwin specific stuff
out of the isel into the legalizer, and allows more to be moved to the .td file.

llvm-svn: 24397
2005-11-17 18:26:56 +00:00
Chris Lattner 0fe88e3f32 Teach the selector to fold lo(g) into load instruction immediate fields
llvm-svn: 24396
2005-11-17 18:02:16 +00:00
Chris Lattner 4b11fa284d Generate LA and ADDIS when possible.
llvm-svn: 24395
2005-11-17 17:52:01 +00:00
Chris Lattner 3648c20472 Use the right accessor to create this node
llvm-svn: 24394
2005-11-17 17:51:38 +00:00
Chris Lattner 595088aa0f Add an initial hack at legalizing GlobalAddress into the appropriate nodes
on Darwin to remove smarts from the isel.  This is currently disabled by
default (uncomment setOperationAction(ISD::GlobalAddress to enable it).
tblgen needs to become smarter about tglobaladdr nodes and bigger patterns
needed to be added to the .td file.  However, we can currently emit stuff like
this:  :)

        li r2, lo16(L_x$non_lazy_ptr)
        lis r3, ha16(L_x$non_lazy_ptr)
        lwzx r2, r3, r2

The obvious improvements will follow.

llvm-svn: 24390
2005-11-17 07:30:41 +00:00
Chris Lattner 840458276c Add globaladdress and targetglobaladdress nodes for dag patterns
llvm-svn: 24389
2005-11-17 07:20:15 +00:00
Chris Lattner 63ed749ce0 LI could theoretically be used for the lo-part of a global address, just like
lis can be used for the high part.

llvm-svn: 24388
2005-11-17 07:04:43 +00:00
Chris Lattner 45ca1c0194 Allow targets to custom legalize leaf nodes like GlobalAddress.
llvm-svn: 24387
2005-11-17 06:41:44 +00:00
Chris Lattner b7025749e1 When lowering direct calls, lower them to use a targetglobaladress directly
instead of a globaladdress.  This has no effect on the generated code at all.

llvm-svn: 24386
2005-11-17 05:56:14 +00:00
Chris Lattner 4ff65ec745 Teach legalize about targetglobaladdress
llvm-svn: 24385
2005-11-17 05:52:24 +00:00
Chris Lattner 2bf458af92 Add patterns for some 16-bit immediate instructions, patch contributed by
Evan Cheng.

llvm-svn: 24384
2005-11-17 02:01:55 +00:00
Chris Lattner 5930d3df3d Add patterns for several simple instructions that take i32 immediates.
Patch contributed by Evan Cheng!

llvm-svn: 24382
2005-11-16 22:59:19 +00:00
Andrew Lenharth 59eefd4787 who would have thought you would want to write into globals too
llvm-svn: 24381
2005-11-16 21:15:53 +00:00
Chris Lattner f2b62f317c when debugging lower dbg intrinsics to calls
llvm-svn: 24377
2005-11-16 07:22:30 +00:00
Chris Lattner 168fe79229 tell selectiondag when we're debugging
llvm-svn: 24376
2005-11-16 07:21:47 +00:00
Chris Lattner fdc8b19ad6 indicate when a tool is a debug build.
llvm-svn: 24374
2005-11-16 06:36:47 +00:00
Chris Lattner 6b41edb30f * Fix DerivedType::dropAllTypeUses to not change the number of types in a
type when it gets refined.  This allows us to hash on this crucial value.
* Fix several issues in TypeMap::RefineAbstractType that prevent it from
  handling hash values that change correctly.
* Define hashTypeStructure to not always return 0.  :)

This last part (which depends on the first two) speeds up gccld time on eon
from 3.78s to 2.75s with a release build (a 28% speedup!).  This resolves
PR474.

llvm-svn: 24372
2005-11-16 06:09:47 +00:00
Chris Lattner 655e7dfd0d initial step at adding a dag-to-dag isel for X86 backend. Patch contributed
by Evan Cheng!

llvm-svn: 24371
2005-11-16 01:54:32 +00:00
Nate Begeman a171f6b20c Patch to clean up function call pseudos and support the BLA instruction,
which branches to an absolute address.  This is required to support objc
direct dispatch.

llvm-svn: 24370
2005-11-16 00:48:01 +00:00
Chris Lattner 63985e2892 Make sure to use SwitchSection to switch sections so that we don't accidentally emit
functions into the .const section.  Whoops.

llvm-svn: 24363
2005-11-15 01:45:01 +00:00
Chris Lattner 7c727b2736 Fix handling of multiple unnamed globals with the same type
llvm-svn: 24362
2005-11-15 01:32:03 +00:00
Chris Lattner 76ac068568 Separate X86ISelLowering stuff out from the X86ISelPattern.cpp file. Patch
contributed by Evan Cheng.

llvm-svn: 24358
2005-11-15 00:40:23 +00:00
Chris Lattner bba9c372c1 Remove extraneous parents around constants when using a constant expr cast.
llvm-svn: 24357
2005-11-15 00:03:16 +00:00
Chris Lattner 1a4adc7aee Handle globals with explicit alignment requests
llvm-svn: 24355
2005-11-14 19:00:30 +00:00
Chris Lattner dd8eeed096 Teach emitAlignment to handle explicit alignment requests by globals.
llvm-svn: 24354
2005-11-14 19:00:06 +00:00
Chris Lattner 0aacd2ab9b Teach the PPC asmwriter to honor globals with explicit section requests.
llvm-svn: 24353
2005-11-14 18:52:46 +00:00
Chris Lattner 16cbc6a177 instead of using mstats, use malloc_zone_statistics which returns numbers
that actually make sense.

llvm-svn: 24352
2005-11-14 07:27:56 +00:00
Chris Lattner 698fa760f4 Teach -track-memory to work on darwin. Looking at sbrk doesn't work because
the default allocator uses mmap.

llvm-svn: 24349
2005-11-14 07:00:29 +00:00
Duraid Madina 76034f95f6 add FP select. next up - divide!
llvm-svn: 24346
2005-11-14 01:17:30 +00:00
Chris Lattner 0333e68f72 Add some dummy method impls
llvm-svn: 24345
2005-11-13 03:26:33 +00:00
Chris Lattner 06b453b2dc Move some methods around. Refactor the parts of TypeMap that do not depend
on its template arguments into a base class so that the code isn't duplicated
5 times.

llvm-svn: 24343
2005-11-13 03:14:09 +00:00
Chris Lattner 5c28b96304 Split the type refinement case completely out of the type-becomes-concrete
case, simplifying the code.

llvm-svn: 24340
2005-11-13 01:58:06 +00:00
Chris Lattner 54c8fcf303 unbreak the build
llvm-svn: 24339
2005-11-13 01:45:23 +00:00
Chris Lattner 708bb251d8 Separate the type-became-concrete case from the type-is-resolved case, the
former of which takes much less work than the later.  This speeds up linking
eon from 3.749 to 3.637s with a release build (about 3%).

llvm-svn: 24338
2005-11-13 01:27:50 +00:00
Andrew Lenharth ab72424488 enable LSR by default on alpha
llvm-svn: 24337
2005-11-12 19:21:08 +00:00
Andrew Lenharth 2ba45d1ee9 fix more regressions
llvm-svn: 24335
2005-11-12 19:06:28 +00:00
Andrew Lenharth 56526ec1a9 fix READCYCLECOUNTER
llvm-svn: 24334
2005-11-12 19:04:09 +00:00
Chris Lattner 026a5ef177 trivial cleanup
llvm-svn: 24330
2005-11-12 18:34:09 +00:00
Chris Lattner b264c5d4dc Fix reading LLVM 1.3 bc files.
llvm-svn: 24329
2005-11-12 18:31:54 +00:00
Chris Lattner 11ca4d636b regenerate
llvm-svn: 24328
2005-11-12 18:22:38 +00:00
Chris Lattner bce7ca8a73 refactor grammar to eliminate shift-reduce conflict. Move alignment checking
code out of all of the clients and into OptAlign/OptCAlign

llvm-svn: 24327
2005-11-12 18:21:21 +00:00
Chris Lattner f2794fa073 Unswitch a loop, add more assertions, eliminate use of removeUserFromConcrete.
llvm-svn: 24324
2005-11-12 08:39:48 +00:00
Chris Lattner 11edcc19da Tiny speedup, improve comments and code organization.
llvm-svn: 24323
2005-11-12 08:22:41 +00:00
Chris Lattner 8e1e6117d0 Read and write section info from/to .bc files
llvm-svn: 24321
2005-11-12 01:33:40 +00:00
Jeff Cohen 045f096b18 Wrap long line.
llvm-svn: 24320
2005-11-12 01:01:50 +00:00
Jeff Cohen 93b3d8f415 Fix VC++ warning that bools cannot be ORed.
llvm-svn: 24319
2005-11-12 00:59:39 +00:00
Jeff Cohen cf1f782a2f Fix operator precedence bug caught by VC++.
llvm-svn: 24318
2005-11-12 00:59:01 +00:00
Chris Lattner a0c20b4f8b regenerate
llvm-svn: 24316
2005-11-12 00:11:49 +00:00
Chris Lattner 9da804d8e9 add a token
llvm-svn: 24315
2005-11-12 00:11:30 +00:00
Chris Lattner 71b936cab9 Parse section info
llvm-svn: 24314
2005-11-12 00:11:10 +00:00
Chris Lattner 4b96c540f6 print section info
llvm-svn: 24313
2005-11-12 00:10:19 +00:00
Andrew Lenharth 97e8207a05 fix yet more regressions
llvm-svn: 24308
2005-11-11 23:08:46 +00:00
Andrew Lenharth fab772045e generate chain result
llvm-svn: 24307
2005-11-11 23:02:55 +00:00
Andrew Lenharth de1b5d6baa added a chain output
llvm-svn: 24306
2005-11-11 22:48:54 +00:00
Andrew Lenharth 5b3b9d7052 Fix a bunch more alpha regressions
llvm-svn: 24304
2005-11-11 19:52:25 +00:00
Andrew Lenharth 5278ca3fa2 prevent cse of readcyclecounter
llvm-svn: 24303
2005-11-11 19:02:54 +00:00
Andrew Lenharth 01aa56397d continued readcyclecounter support
llvm-svn: 24300
2005-11-11 16:47:30 +00:00
Chris Lattner ecc301df17 Fix the optimized code handling of user asm strings
llvm-svn: 24296
2005-11-10 23:24:26 +00:00
Chris Lattner fafff9ba1d Make BB and CPI labels use the function number, not the function name as a
uniquing id.  This makes things happy when the function name is quoted,
preventing labels like LBB"foo"_2.

llvm-svn: 24295
2005-11-10 21:59:25 +00:00
Chris Lattner 86164e6e9e speedup the common case where nothing needs to be quoted
llvm-svn: 24294
2005-11-10 21:47:01 +00:00
Chris Lattner e1d34bac0b Allow per-character control over what target assemblers allow in symbol
names.  This also changes the default to allow all of "$_." in addition
to letters and numbers as symbol names.  If you don't want this, use
markCharUnacceptable to remove one of these or markCharAcceptable to add
to the set.  This corresponds with what GAS accepts by default.

Also, this includes some minor speedups

llvm-svn: 24293
2005-11-10 21:40:01 +00:00
Chris Lattner 4b3b9192b2 do not allow '.' in symbol names
llvm-svn: 24292
2005-11-10 21:39:29 +00:00