Commit Graph

8063 Commits

Author SHA1 Message Date
Reid Spencer
761920301d PPC32GenCodeEmitter instead of PowerPCGenCodeEmitter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:59:38 +00:00
Chris Lattner
56a31c69c8 Rewrite support for cast uint -> FP. In particular, we used to compile this:
double %test(uint %X) {
        %tmp.1 = cast uint %X to double         ; <double> [#uses=1]
        ret double %tmp.1
}

into:

test:
        sub %ESP, 8
        mov %EAX, DWORD PTR [%ESP + 12]
        mov %ECX, 0
        mov DWORD PTR [%ESP], %EAX
        mov DWORD PTR [%ESP + 4], %ECX
        fild QWORD PTR [%ESP]
        add %ESP, 8
        ret

... which basically zero extends to 8 bytes, then does an fild for an
8-byte signed int.

Now we generate this:


test:
        sub %ESP, 4
        mov %EAX, DWORD PTR [%ESP + 8]
        mov DWORD PTR [%ESP], %EAX
        fild DWORD PTR [%ESP]
        shr %EAX, 31
        fadd DWORD PTR [.CPItest_0 + 4*%EAX]
        add %ESP, 4
        ret

        .section .rodata
        .align  4
.CPItest_0:
        .quad   5728578726015270912

This does a 32-bit signed integer load, then adds in an offset if the sign
bit of the integer was set.

It turns out that this is substantially faster than the preceeding sequence.
Consider this testcase:

unsigned a[2]={1,2};
volatile double G;

void main() {
    int i;
    for (i=0; i<100000000; ++i )
        G += a[i&1];
}

On zion (a P4 Xeon, 3Ghz), this patch speeds up the testcase from 2.140s
to 0.94s.

On apoc, an athlon MP 2100+, this patch speeds up the testcase from 1.72s
to 1.34s.

Note that the program takes 2.5s/1.97s on zion/apoc with GCC 3.3 -O3
-fomit-frame-pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17083 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 08:01:28 +00:00
Chris Lattner
07306de06e Unify handling of constant pool indexes with the other code paths, allowing
us to use index registers for CPI's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:49:45 +00:00
Chris Lattner
0e0ed85697 Give the asmprinter the ability to print memrefs with a constant pool index,
index reg and scale


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:16:32 +00:00
Chris Lattner
de95c9e0bb fold:
%X = and Y, constantint
  %Z = setcc %X, 0

instead of emitting:

        and %EAX, 3
        test %EAX, %EAX
        je .LBBfoo2_2   # UnifiedReturnBlock

We now emit:

        test %EAX, 3
        je .LBBfoo2_2   # UnifiedReturnBlock

This triggers 581 times on 176.gcc for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 06:10:40 +00:00
Chris Lattner
9894cd300e All of these labels are off by one now that the unreachable instruction exists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:37:47 +00:00
Nate Begeman
1b75022cd3 Implement bitfield insert by recognizing the following pattern:
1. optional shift left
2. and x, immX
3. and y, immY
4. or z, x, y
==> rlwimi z, x, y, shift, mask begin, mask end

where immX == ~immY and immX is a run of set bits. This transformation
fires 32 times on voronoi, once on espresso, and probably several
dozen times on external benchmarks such as gcc.

To put this in terms of actual code generated for
struct B { unsigned a : 3; unsigned b : 2; };
void storeA (struct B *b, int v) { b->a = v;}
void storeB (struct B *b, int v) { b->b = v;}

Old:
_storeA:
        rlwinm r2, r4, 0, 29, 31
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 0, 28
        or r2, r4, r2
        stw r2, 0(r3)
        blr

_storeB:
        rlwinm r2, r4, 3, 0, 28
        rlwinm r2, r2, 0, 27, 28
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 29, 26
        or r2, r2, r4
        stw r2, 0(r3)
        blr

New:
_storeA:
        lwz r2, 0(r3)
        rlwimi r2, r4, 0, 29, 31
        stw r2, 0(r3)
        blr

_storeB:
        lwz r2, 0(r3)
        rlwimi r2, r4, 3, 27, 28
        stw r2, 0(r3)
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:19:20 +00:00
Chris Lattner
35f92ae3af Fix constant folding relational operators with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17077 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 04:01:51 +00:00
Chris Lattner
7ff5a32a48 I forgot that sparc no longer uses the shared asmwriter. Give it support
for undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17075 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:44:45 +00:00
Chris Lattner
d14d5b4223 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17074 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:42:42 +00:00
Chris Lattner
71d3778c0b Implement constant folding of undef values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17070 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:31:32 +00:00
Chris Lattner
79a564caa7 Fix a type violation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:28:04 +00:00
Nate Begeman
2d4c98d79b Finally fix one of the oldest FIXMEs in the PowerPC backend: correctly
flag rotate left word immediate then mask insert (rlwimi) as a two-address
instruction, and update the ISel usage of the instruction accordingly.

This will allow us to properly schedule rlwimi, and use it to efficiently
codegen bitfield operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 20:43:38 +00:00
Chris Lattner
6e758aee74 Kill the bogon that slipped into my buffer before I committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:46:33 +00:00
Chris Lattner
061718cba8 Implement InstCombine/getelementptr.ll:test9, which is the source of many
ugly and giant constnat exprs in some programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:44:59 +00:00
Chris Lattner
2e7ec128f9 Do not erroneously accept revision 6 bytecode files when the format hasn't
been defined yet!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:56:02 +00:00
Chris Lattner
9270efcc5f Fix fix fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17057 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:21:50 +00:00
Chris Lattner
ec7c1ab1da Add support for unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17056 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:21:33 +00:00
Chris Lattner
bd1d382cc4 Add support for undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:19:26 +00:00
Chris Lattner
a79e7cca0d Add support for undef, unreachable, and function flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17054 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:18:16 +00:00
Chris Lattner
16710e9574 Parse undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17053 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:17:13 +00:00
Chris Lattner
c17edbdeeb Add support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17052 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:16:19 +00:00
Chris Lattner
5a083b81c4 Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17051 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:14:10 +00:00
Chris Lattner
289a49ab7d ADd support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17050 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:13:47 +00:00
Chris Lattner
30483b0c84 Teach the X86 backend about unreachable and undef. Among other things, we
now compile:

'foo() {}' into "ret" instead of "mov EAX, 0; ret"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17049 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:13:05 +00:00
Chris Lattner
a9d12c0a56 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:12:13 +00:00
Chris Lattner
e87597fb75 Optimize instructions involving undef values. For example X+undef == undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17047 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:11:37 +00:00
Chris Lattner
82731c793a Add support for UndefValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17046 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:10:31 +00:00
Chris Lattner
b20724dff4 When promoting mem2reg, make uninitialized values become undef isntead of 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:10:06 +00:00
Chris Lattner
5d356a7c82 Handle undef values as undefined on the constant lattice
ignore unreachable instructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17044 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:41 +00:00
Chris Lattner
b2f59a2af7 Add note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17043 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:25 +00:00
Chris Lattner
7a7ed0274d Add support for the undef value. Implement a new optimization based on globals
that are initialized with undef.  When promoting malloc to a global, start out
initialized to undef


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17042 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:00 +00:00
Chris Lattner
b976e66816 Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17041 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:08:06 +00:00
Chris Lattner
b9f18592a6 Implement UndefValue class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17040 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:07:16 +00:00
Chris Lattner
b7a16ce3b1 Add a missing dependency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17031 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 17:12:55 +00:00
Chris Lattner
f146ab1e51 Fix file header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17030 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 16:37:42 +00:00
Chris Lattner
a35339dfb6 Be more careful about looking for constants when we really want constantint's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17029 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 16:07:10 +00:00
Chris Lattner
795948a5d1 Move the implementation of the instructions clone methods to this file so
that the vtables for these classes are only instantiated in this translation
unit, not in every xlation unit they are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17026 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 23:52:53 +00:00
Chris Lattner
f91d68be8d There is no reason not to build these in parallel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17023 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 23:22:15 +00:00
Misha Brukman
961ca77e5b Add a space between the type and name of value when printing error message
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17022 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 23:08:50 +00:00
Chris Lattner
4a8167fe5c Don't print a bunch of metrics that are meaningless for external functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 19:40:31 +00:00
Chris Lattner
358a9027a8 Instruction select globals with offsets better. For example, on this test
case:

int C[100];
int foo() {
  return C[4];
}

We now codegen:

foo:
        mov %EAX, DWORD PTR [C + 16]
        ret

instead of:

foo:
        mov %EAX, OFFSET C
        mov %EAX, DWORD PTR [%EAX + 16]
        ret

Other impressive features may be coming later.

This patch is contributed by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17011 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 05:05:29 +00:00
Chris Lattner
8cce7cd0ae Give the X86 JIT the ability to encode global+disp constants. Patch
contributed by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17010 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:53:13 +00:00
Chris Lattner
d416f086cc Give the X86 asm printer the ability to print out addressing modes that have
constant displacements from global variables.  Patch by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17009 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:44:53 +00:00
Chris Lattner
fb3d844e50 Allow X86 addressing modes to represent globals with offsets. Patch contributed
by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17008 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:43:20 +00:00
Chris Lattner
ca4f6ebefc Allow machine operands to represent global variables with offsets. This is
useful when you have a reference like:

int A[100];

void foo() { A[10] = 1; }

In this case, &A[10] is a single constant and should be treated as such.

Only MO_GlobalAddress and MO_ExternalSymbol are allowed to use this field, no
other operand type is.

This is another fine patch contributed by Jeff Cohen!!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17007 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:38:41 +00:00
Chris Lattner
47eb6567e2 This patch fixes the nasty bug that caused 175.vpr to fail for X86 last night.
The problem occurred when trying to reload this instruction:

MOV32mr %reg2326, 8, %reg2297, 4, %reg2295

The value of reg2326 was available in EBX, so it was reused from there, instead
of reloading it into EDX.

The value of reg2297 was available in EDX, so it was reused from there, instead
of reloading it into EDI.

The value of reg2295 was not available, so we tried reloading it into EBX, its
assigned register.  However, we checked and saw that we already reloaded
something into EBX, so we chose what reg2326 was assigned to (EDX) and reloaded
into that register instead.

Unfortunately EDX had already been used by reg2297, so reloading into EDX
clobbered the value used by the reg2326 operand, breaking the program.

The fix for this is to check that the newly picked register is ok.  In this
case we now find that EDX is already used and try using EDI, which succeeds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17006 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 03:19:31 +00:00
Chris Lattner
8df6a594d2 This patch adds and improves debugging output. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17005 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 03:16:29 +00:00
Nate Begeman
e0c83a86b0 Better codegen of binary integer ops with 32 bit immediate operands.
This transformation fires a few dozen times across the testsuite.

For example, int test2(int X) { return X ^ 0x0FF00FF0; }
Old:
_test2:
        lis r2, 4080
        ori r2, r2, 4080
        xor r3, r3, r2
        blr

New:
_test2:
        xoris r3, r3, 4080
        xori r3, r3, 4080
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17004 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 00:50:19 +00:00
Misha Brukman
d36047dbdb The field is called imm22', not simply imm'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17003 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 22:33:32 +00:00
Misha Brukman
3df04c58fc Synthetic instructions RET and RETL need to have all 3 parameters specified
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17002 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 22:32:49 +00:00
Misha Brukman
45a68268a4 Class F2_1 already inherits the imm22 field from class F2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17001 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 22:32:24 +00:00
Misha Brukman
009d3f400c Generate the SparcV8 code emitter from .td files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17000 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 21:57:19 +00:00
Misha Brukman
17187e936a * In the F3_1 class, default asi to 0 because it's not currently used
* In the F3_3 class, remove mention of asi because it's not part of the format


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16999 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 21:53:39 +00:00
Chris Lattner
b23cd2f688 Fix a bug John tracked down in libstdc++ where we were incorrectly deleting
weak functions.  Thanks for finding this John!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16997 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 19:53:50 +00:00
Brian Gaeke
59e12ed789 Add FSTOI, FDTOI (fp to integer cast) instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16996 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 19:39:35 +00:00
Brian Gaeke
8b6c1ff677 Rewrite emitCastOperation, refactoring parts of it into emitIntegerCast, and
adding emitFPToIntegerCast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16995 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 19:39:34 +00:00
Brian Gaeke
941833a37c Add list of libc procedures we'll use, at some point.
Update list of currently failing tests.
ADJCALLSTACK* support is done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16994 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 19:39:33 +00:00
Chris Lattner
a06b3af2fe Make sure any client of Dominators.h links in Dominators.cpp
Patch by Morten Ofstad


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16987 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 15:47:16 +00:00
Chris Lattner
979c38ba20 Do not use the same variable name for two different variables in the
same scope.  This confused VC++ (and probably people too!).  Patch by
Morten Ofstad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16985 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 14:59:16 +00:00
Misha Brukman
c982cfad87 * Claim to support machine code emission - return false from
addPassesToEmitMachineCode()
* Add support for registers and constants in getMachineOpValue()

This enables running "int main() { ret 0 }" via the PowerPC JIT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16983 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 06:39:56 +00:00
Misha Brukman
d37faba5b4 * Include the real (generated) version of getBinaryCodeForInstr()
* Add implementation of getMachineOpValue() for generated code emitter
* Convert assert()s in unimplemented functions to abort()s so that non-debug
  builds fail predictably
* Add file header comments


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16981 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 06:07:25 +00:00
Misha Brukman
bab2adf496 * Make a PPC32-specific code emitter because we have separate classes for 32-
and 64-bit code emitters that cannot share code unless we use virtual
  functions
* Identify components being built by tablegen with more detail by assigning them
  to PowerPC, PPC32, or PPC64 more specifically; also avoids seeing 'building
  PowerPC XYZ' messages twice, where one is for PPC32 and one for PPC64


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16980 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 06:04:56 +00:00
Tanya Lattner
a645750722 Checking in code that works on my simple test case. However, there is still a bug with branches that I need to fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16979 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 06:04:28 +00:00
Misha Brukman
a671f3b1d4 There is only one field in an instruction, and that is `Inst', the final view of
the instruction binary format, all others are simply operands and should not
have the `field' label


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16978 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 05:55:37 +00:00
Misha Brukman
315d3341fd PowerPC instruction definitions use LittleEndian-style encoding [0..31]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16977 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 05:54:38 +00:00
Misha Brukman
99ee67ab19 Add isLittleEndianEncoding to InstrInfo class, defaults to `off'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16976 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 05:53:40 +00:00
Chris Lattner
9c07866ef8 When converting phi nodes into select instructions, we shouldn't promote PHI
nodes unless we KNOW that we are able to promote all of them.

This fixes: test/Regression/Transforms/SimplifyCFG/PhiNoEliminate.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16973 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 05:13:36 +00:00
Reid Spencer
83d3aad50e Allow this file to compile on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16971 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 03:33:25 +00:00
Reid Spencer
8af3ed0354 Use __MINGW instead of __MING. Patch contributed by Henrik Bach.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16970 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 03:09:02 +00:00
Reid Spencer
7d5ec231ca Get proper BSD #includes for MappedFile implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16969 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 03:06:59 +00:00
Reid Spencer
8545fc151e Implementation of MappedFile for Win32. Patch provided by Jeff Cohen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16968 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 03:05:59 +00:00
Chris Lattner
f74acc7669 Today is not my day. Fix broken #
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16967 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 02:31:35 +00:00
Chris Lattner
823cacc276 unbreak previous checkin :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16966 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 02:06:48 +00:00
Chris Lattner
84d1ced4a9 Add back a missing paren
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16965 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:57:28 +00:00
Chris Lattner
1c765b0037 Fit to 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16964 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:49:34 +00:00
Chris Lattner
f9d7178ba8 Wrap to 80 cols, delete some seriously old debugging printouts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16963 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:46:07 +00:00
Chris Lattner
4a242b32f6 Fit in 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16962 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:39:18 +00:00
Chris Lattner
b0bf6643b0 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16961 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:35:17 +00:00
Reid Spencer
d96cb6eaa0 Update to reflect changes in Makefile rules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16950 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-13 11:46:52 +00:00
Chris Lattner
15d879e139 Minor cleanups:
* fit in 80 lines
 * Eliminate extra namespaces
 * Drop llvm::


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16935 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 16:52:09 +00:00
Chris Lattner
35b9e48cfd Transform memmove -> memcpy when the source is obviously constant memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16932 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 04:52:52 +00:00
Chris Lattner
a28809d1fd Minor tweaks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16929 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 04:32:37 +00:00
Chris Lattner
4ec82eb1de Implement a new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16927 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 04:20:25 +00:00
Chris Lattner
673e02b0c3 This nutty patch has been in my tree since before 1.3 went out, and it needs
to go in.  This patch allows us to compute the trip count of loops controlled
by values loaded from constant arrays.  The cannonnical example of this is
strlen when passed a constant argument:

for (int i = 0; "constantstring"[i]; ++i) ;
return i;

In this case, it will compute that the loop executes 14 times, which means
that the exit value of i is 14.  Because of this, the loop gets DCE'd and
we are happy.  This also applies to anything that does similar things, e.g.
loops like this:

  const float Array[] = { 0.1, 2.1, 3.2, 23.21 };
  for (int i = 0; Array[i] < 20; ++i)

and is actually fairly general.

The problem with this is that it almost never triggers.  The reason is that
we run indvars and the loop optimizer only at compile time, which is before
things like strlen and strcpy have been inlined into the program from libc.
Because of this, it almost never is used (it triggers twice in specint2k).

I'm committing it because it DOES work, may be useful in the future, and
doesn't slow us down at all.  If/when we start running the loop optimizer
at link-time (-O4?) this will be very nice indeed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16926 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 01:49:27 +00:00
Chris Lattner
989cbd58fb Fix a REALLY obscure bug in my previous checkin, which was splicing the END
marker from one ilist into the middle of another basic block!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16925 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 01:02:29 +00:00
Chris Lattner
a4b9c7841f Handle a common case more carefully. In particular, instead of transforming
pointer recurrences into expressions from this:

  %P_addr.0.i.0 = phi sbyte* [ getelementptr ([8 x sbyte]* %.str_1, int 0, int 0), %entry ], [ %inc.0.i, %no_exit.i ]
  %inc.0.i = getelementptr sbyte* %P_addr.0.i.0, int 1            ; <sbyte*> [#uses=2]

into this:

  %inc.0.i = getelementptr sbyte* getelementptr ([8 x sbyte]* %.str_1, int 0, int 0), int %inc.0.i.rec

Actually create something nice, like this:

  %inc.0.i = getelementptr [8 x sbyte]* %.str_1, int 0, int %inc.0.i.rec


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16924 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 23:06:50 +00:00
Chris Lattner
7fa6e666ec Allow creation of GEP constantexprs with a vector of value* operands as
well as a vector of constant*'s.  It turns out that this is more efficient
and all of the clients want to do that, so we should cater to them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16923 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 22:52:25 +00:00
Chris Lattner
4b83380f33 Implement remove/eraseFromParent methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16922 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 22:21:39 +00:00
Chris Lattner
c9b938065a Make this build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16919 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 20:53:28 +00:00
Chris Lattner
6a9fdfaec8 Reenable the transform, turning X/-10 < 1 into X > -10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16918 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 19:40:04 +00:00
Chris Lattner
c71ff4c34b Fix a warning that is emitted on the suns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16917 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 15:50:40 +00:00
Chris Lattner
30ba5690cf This patch implements two things (sorry).
First, it allows SRA of globals that have embedded arrays, implementing
GlobalOpt/globalsra-partial.llx.  This comes up infrequently, but does allow,
for example, deleting several stores to dead parts of globals in dhrystone.

Second, this implements GlobalOpt/malloc-promote-*.llx, which is the
following nifty transformation:

Basically if a global pointer is initialized with malloc, and we can tell
that the program won't notice, we transform this:

struct foo *FooPtr;
...
  FooPtr = malloc(sizeof(struct foo));
...
  FooPtr->A   FooPtr->B

Into:

struct foo FooPtrBody;
...
   FooPtrBody.A  FooPtrBody.B

This comes up occasionally, for example, the 'disp' global in 183.equake (where
the xform speeds the CBE version of the program up from 56.16s to 52.40s (7%)
on apoc), and the 'desired_accept', 'fixLRBT', 'macroArray', & 'key_queue'
globals in 300.twolf (speeding it up from 22.29s to 21.55s (3.4%)).

The nice thing about this xform is that it exposes the resulting global to
global variable optimization and makes alias analysis easier in addition to
eliminating a few loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16916 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 05:54:41 +00:00
Chris Lattner
4a2b23e189 Fix SingleSource/Benchmarks/McGill/chomp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16912 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 04:07:27 +00:00
Chris Lattner
f8d1097e9d If we are trying to create a ConstantExpr cast that is really a GEP to the
first element of an array, return a GEP instead of a cast.  This allows us
to transparently fold this:

int* getelementptr (int* cast ([100 x int]* %Gbody to int*), int 40)

into this:

int* getelementptr ([100 x int]* %Gbody, int 0, int 40)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16911 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 03:57:30 +00:00
Misha Brukman
de2a9432f9 ModuloScheduling has moved to lib/Target/SparcV9
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16906 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:37:40 +00:00
Misha Brukman
b15d4c6072 Add ModuloScheduling to the recursive build tree
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16905 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:36:09 +00:00
Misha Brukman
7da1e6e27c Adjust header file inclusion due to move
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16904 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:34:50 +00:00
Misha Brukman
0a18934a23 Adjust comment header and paths to refect move
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16903 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:34:36 +00:00
Misha Brukman
f60a149df6 ModuloScheduling moved to lib/Target/SparcV9 as it is SparcV9-specific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16902 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:33:20 +00:00