oota-llvm.git
20 years agoPrint a semicolon for the unreacahble instruction. This fixes problems
Chris Lattner [Sun, 17 Oct 2004 23:49:11 +0000 (23:49 +0000)]
Print a semicolon for the unreacahble instruction.  This fixes problems
where C requires semicolons in some cases to indicate null statements.

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

20 years agoGetting ADCE to interact well with unreachable instructions seems like a nontrivial
Chris Lattner [Sun, 17 Oct 2004 23:45:06 +0000 (23:45 +0000)]
Getting ADCE to interact well with unreachable instructions seems like a nontrivial
exercise that I'm not interested in tackling right now.  Just punt and treat them
like unwind's.

This 'fixes' test/Regression/Transforms/ADCE/unreachable-function.ll

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

20 years agoNew testcase that ADCE shouldn't crash on
Chris Lattner [Sun, 17 Oct 2004 23:44:02 +0000 (23:44 +0000)]
New testcase that ADCE shouldn't crash on

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

20 years agoFix Regression/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
Chris Lattner [Sun, 17 Oct 2004 23:21:07 +0000 (23:21 +0000)]
Fix Regression/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll

If a function had no return instruction in it, and the result of the inlined
call instruction was used, we would crash.

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

20 years agoNew testcase that crashes the inliner
Chris Lattner [Sun, 17 Oct 2004 23:20:29 +0000 (23:20 +0000)]
New testcase that crashes the inliner

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

20 years agoPass -single_module option to gcc when linking dynamic libraries for use with bugpoin...
Nate Begeman [Sun, 17 Oct 2004 23:03:32 +0000 (23:03 +0000)]
Pass -single_module option to gcc when linking dynamic libraries for use with bugpoint, so that we can bugpoint multiple .cp files

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

20 years agoGenerate correct stubs for weak-linked symbols
Nate Begeman [Sun, 17 Oct 2004 23:01:34 +0000 (23:01 +0000)]
Generate correct stubs for weak-linked symbols

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

20 years agofold gep undef, ... -> undef
Chris Lattner [Sun, 17 Oct 2004 21:54:55 +0000 (21:54 +0000)]
fold gep undef, ... -> undef
This comes up many times in perlbmk and probably others.

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

20 years agoRemove printout, realize that instructions in the entry block dominate all
Chris Lattner [Sun, 17 Oct 2004 21:31:34 +0000 (21:31 +0000)]
Remove printout, realize that instructions in the entry block dominate all
other blocks.

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

20 years agoWhen inserting PHI nodes, don't insert any phi nodes that are obviously
Chris Lattner [Sun, 17 Oct 2004 21:25:56 +0000 (21:25 +0000)]
When inserting PHI nodes, don't insert any phi nodes that are obviously
unneccesary.  This allows us to delete several hundred phi nodes of the
form PHI(x,x,x,undef) from 253.perlbmk and probably other programs as well.

This implements Mem2Reg/UndefValuesMerge.ll

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

20 years agoNew testcase, no PHI should be inserted.
Chris Lattner [Sun, 17 Oct 2004 21:25:32 +0000 (21:25 +0000)]
New testcase, no PHI should be inserted.

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

20 years agoEnhance hasConstantValue to ignore undef values in phi nodes. This allows it
Chris Lattner [Sun, 17 Oct 2004 21:23:26 +0000 (21:23 +0000)]
Enhance hasConstantValue to ignore undef values in phi nodes.  This allows it
to think that PHI[4, undef] == 4.

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

20 years agohasConstantValue will soon return instructions that don't dominate the PHI node,
Chris Lattner [Sun, 17 Oct 2004 21:22:38 +0000 (21:22 +0000)]
hasConstantValue will soon return instructions that don't dominate the PHI node,
so prepare for this.

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

20 years agoThe first hunk corrects a bug when printing undef null values. We would print
Chris Lattner [Sun, 17 Oct 2004 17:48:59 +0000 (17:48 +0000)]
The first hunk corrects a bug when printing undef null values.  We would print
0->field, which is illegal.  Now we print ((foo*)0)->field.

The second hunk is an optimization to not print undefined phi values.

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

20 years agoDon't print stuff out from the code generator. This broke the JIT horribly
Chris Lattner [Sun, 17 Oct 2004 17:40:50 +0000 (17:40 +0000)]
Don't print stuff out from the code generator.  This broke the JIT horribly
last night. :)  bork!

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

20 years agoAdd HAVE_BZLIB_H and HAVE_ZLIB_H tests.
Reid Spencer [Sun, 17 Oct 2004 17:07:29 +0000 (17:07 +0000)]
Add HAVE_BZLIB_H and HAVE_ZLIB_H tests.

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

20 years agoUpdate to reflect building zlib for LLVM
Reid Spencer [Sun, 17 Oct 2004 15:02:47 +0000 (15:02 +0000)]
Update to reflect building zlib for LLVM

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

20 years agoAdd missing targets for install/clean
Reid Spencer [Sun, 17 Oct 2004 15:01:59 +0000 (15:01 +0000)]
Add missing targets for install/clean

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

20 years agoMake the library name SparcV9 specific
Reid Spencer [Sun, 17 Oct 2004 15:01:12 +0000 (15:01 +0000)]
Make the library name SparcV9 specific

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

20 years agoConsolidate the definitions
Reid Spencer [Sun, 17 Oct 2004 15:00:26 +0000 (15:00 +0000)]
Consolidate the definitions

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

20 years agoPPC32GenCodeEmitter instead of PowerPCGenCodeEmitter
Reid Spencer [Sun, 17 Oct 2004 14:59:38 +0000 (14:59 +0000)]
PPC32GenCodeEmitter instead of PowerPCGenCodeEmitter

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

20 years agoAdd runtime directories
Reid Spencer [Sun, 17 Oct 2004 14:58:49 +0000 (14:58 +0000)]
Add runtime directories

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

20 years agoSupport bytecode generation, GenCodeEmitter, etc.
Reid Spencer [Sun, 17 Oct 2004 14:57:12 +0000 (14:57 +0000)]
Support bytecode generation, GenCodeEmitter, etc.

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

20 years agoAdd runtime directory, include Makefile_rules
Reid Spencer [Sun, 17 Oct 2004 14:56:15 +0000 (14:56 +0000)]
Add runtime directory, include Makefile_rules

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

20 years agoRewrite support for cast uint -> FP. In particular, we used to compile this:
Chris Lattner [Sun, 17 Oct 2004 08:01:28 +0000 (08:01 +0000)]
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

20 years agoUnify handling of constant pool indexes with the other code paths, allowing
Chris Lattner [Sun, 17 Oct 2004 07:49:45 +0000 (07:49 +0000)]
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

20 years agoGive the asmprinter the ability to print memrefs with a constant pool index,
Chris Lattner [Sun, 17 Oct 2004 07:16:32 +0000 (07:16 +0000)]
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

20 years agofold:
Chris Lattner [Sun, 17 Oct 2004 06:10:40 +0000 (06:10 +0000)]
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

20 years agoAll of these labels are off by one now that the unreachable instruction exists
Chris Lattner [Sun, 17 Oct 2004 05:37:47 +0000 (05:37 +0000)]
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

20 years agoImplement bitfield insert by recognizing the following pattern:
Nate Begeman [Sun, 17 Oct 2004 05:19:20 +0000 (05:19 +0000)]
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

20 years agoFix constant folding relational operators with undef operands.
Chris Lattner [Sun, 17 Oct 2004 04:01:51 +0000 (04:01 +0000)]
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

20 years agoReid added --version to the CommandLine lib. Don't conflict with it.
Chris Lattner [Sun, 17 Oct 2004 02:49:08 +0000 (02:49 +0000)]
Reid added --version to the CommandLine lib.  Don't conflict with it.

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

20 years agoI forgot that sparc no longer uses the shared asmwriter. Give it support
Chris Lattner [Sun, 17 Oct 2004 02:44:45 +0000 (02:44 +0000)]
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

20 years agoAdd support for unreachable and undef
Chris Lattner [Sun, 17 Oct 2004 02:42:42 +0000 (02:42 +0000)]
Add support for unreachable and undef

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

20 years agoInitial Makefile.am for building with automake
Reid Spencer [Sun, 17 Oct 2004 00:24:24 +0000 (00:24 +0000)]
Initial Makefile.am for building with automake

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

20 years agoInitial Makefile.am for building with automake.
Reid Spencer [Sun, 17 Oct 2004 00:20:42 +0000 (00:20 +0000)]
Initial Makefile.am for building with automake.

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

20 years agoMake sure that for systems where the string functions are actually macros
Reid Spencer [Sun, 17 Oct 2004 00:17:54 +0000 (00:17 +0000)]
Make sure that for systems where the string functions are actually macros
that we undefine the macro before using its name in the definition. This
can happen on Linux if _GNU_SOURCE is defined.

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

20 years agoImplement constant folding of undef values.
Chris Lattner [Sat, 16 Oct 2004 23:31:32 +0000 (23:31 +0000)]
Implement constant folding of undef values.

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

20 years agoFix a type violation
Chris Lattner [Sat, 16 Oct 2004 23:28:04 +0000 (23:28 +0000)]
Fix a type violation

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

20 years agoFinally fix one of the oldest FIXMEs in the PowerPC backend: correctly
Nate Begeman [Sat, 16 Oct 2004 20:43:38 +0000 (20:43 +0000)]
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

20 years agoKill the bogon that slipped into my buffer before I committed.
Chris Lattner [Sat, 16 Oct 2004 19:46:33 +0000 (19:46 +0000)]
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

20 years agoImplement InstCombine/getelementptr.ll:test9, which is the source of many
Chris Lattner [Sat, 16 Oct 2004 19:44:59 +0000 (19:44 +0000)]
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

20 years agoNew testcase, rework testcases to fail if there are any gep's other than those
Chris Lattner [Sat, 16 Oct 2004 19:44:23 +0000 (19:44 +0000)]
New testcase, rework testcases to fail if there are any gep's other than those
involving %B instead of allowing any geps except %A's.

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

20 years ago* Add a space between words
Misha Brukman [Sat, 16 Oct 2004 19:13:58 +0000 (19:13 +0000)]
* Add a space between words
* Wrap at 80 cols

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

20 years agoDo not erroneously accept revision 6 bytecode files when the format hasn't
Chris Lattner [Sat, 16 Oct 2004 18:56:02 +0000 (18:56 +0000)]
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

20 years agoUpdate release notes
Chris Lattner [Sat, 16 Oct 2004 18:35:57 +0000 (18:35 +0000)]
Update release notes

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

20 years agoNew testcase
Chris Lattner [Sat, 16 Oct 2004 18:28:01 +0000 (18:28 +0000)]
New testcase

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

20 years agoAdd support for undef and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:24:35 +0000 (18:24 +0000)]
Add support for undef and unreachable

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

20 years agotestcases for undefined and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:24:11 +0000 (18:24 +0000)]
testcases for undefined and unreachable

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

20 years agoFix fix fix
Chris Lattner [Sat, 16 Oct 2004 18:21:50 +0000 (18:21 +0000)]
Fix fix fix

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

20 years agoAdd support for unreachable
Chris Lattner [Sat, 16 Oct 2004 18:21:33 +0000 (18:21 +0000)]
Add support for unreachable

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

20 years agoAdd support for undef
Chris Lattner [Sat, 16 Oct 2004 18:19:26 +0000 (18:19 +0000)]
Add support for undef

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

20 years agoAdd support for undef, unreachable, and function flags
Chris Lattner [Sat, 16 Oct 2004 18:18:16 +0000 (18:18 +0000)]
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

20 years agoParse undef and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:17:13 +0000 (18:17 +0000)]
Parse undef and unreachable

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

20 years agoAdd support
Chris Lattner [Sat, 16 Oct 2004 18:16:19 +0000 (18:16 +0000)]
Add support

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

20 years agoAdd support for undef and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:14:10 +0000 (18:14 +0000)]
Add support for undef and unreachable

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

20 years agoADd support for undef and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:13:47 +0000 (18:13 +0000)]
ADd support for undef and unreachable

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

20 years agoTeach the X86 backend about unreachable and undef. Among other things, we
Chris Lattner [Sat, 16 Oct 2004 18:13:05 +0000 (18:13 +0000)]
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

20 years agoAdd support for unreachable and undef
Chris Lattner [Sat, 16 Oct 2004 18:12:13 +0000 (18:12 +0000)]
Add support for unreachable and undef

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

20 years agoOptimize instructions involving undef values. For example X+undef == undef.
Chris Lattner [Sat, 16 Oct 2004 18:11:37 +0000 (18:11 +0000)]
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

20 years agoAdd support for UndefValue
Chris Lattner [Sat, 16 Oct 2004 18:10:31 +0000 (18:10 +0000)]
Add support for UndefValue

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

20 years agoWhen promoting mem2reg, make uninitialized values become undef isntead of 0.
Chris Lattner [Sat, 16 Oct 2004 18:10:06 +0000 (18:10 +0000)]
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

20 years agoHandle undef values as undefined on the constant lattice
Chris Lattner [Sat, 16 Oct 2004 18:09:41 +0000 (18:09 +0000)]
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

20 years agoAdd note
Chris Lattner [Sat, 16 Oct 2004 18:09:25 +0000 (18:09 +0000)]
Add note

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

20 years agoAdd support for the undef value. Implement a new optimization based on globals
Chris Lattner [Sat, 16 Oct 2004 18:09:00 +0000 (18:09 +0000)]
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

20 years agoAdd support for undef and unreachable
Chris Lattner [Sat, 16 Oct 2004 18:08:06 +0000 (18:08 +0000)]
Add support for undef and unreachable

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

20 years agoImplement UndefValue class
Chris Lattner [Sat, 16 Oct 2004 18:07:16 +0000 (18:07 +0000)]
Implement UndefValue class

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

20 years agoAdd support for the unreachable instruction
Chris Lattner [Sat, 16 Oct 2004 18:06:43 +0000 (18:06 +0000)]
Add support for the unreachable instruction

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

20 years agoAdd new UndefValueVal type
Chris Lattner [Sat, 16 Oct 2004 18:06:07 +0000 (18:06 +0000)]
Add new UndefValueVal type

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

20 years agoAdd new UnreachableInst class
Chris Lattner [Sat, 16 Oct 2004 18:05:54 +0000 (18:05 +0000)]
Add new UnreachableInst class

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

20 years agoAdd new unreachable instruction
Chris Lattner [Sat, 16 Oct 2004 18:05:37 +0000 (18:05 +0000)]
Add new unreachable instruction

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

20 years agoAdd new UndefValue class
Chris Lattner [Sat, 16 Oct 2004 18:05:25 +0000 (18:05 +0000)]
Add new UndefValue class

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

20 years agoUndefValue's are constants
Chris Lattner [Sat, 16 Oct 2004 18:05:10 +0000 (18:05 +0000)]
UndefValue's are constants

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

20 years agoDocument unreachable instruction
Chris Lattner [Sat, 16 Oct 2004 18:04:13 +0000 (18:04 +0000)]
Document unreachable instruction

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

20 years agoAdd missing 'Instruction Opcodes' bullet to TOC
Chris Lattner [Sat, 16 Oct 2004 18:03:55 +0000 (18:03 +0000)]
Add missing 'Instruction Opcodes' bullet to TOC
Update for changes in LLVM 1.4 bytecode format.

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

20 years agoAdd a missing dependency
Chris Lattner [Sat, 16 Oct 2004 17:12:55 +0000 (17:12 +0000)]
Add a missing dependency

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

20 years agoFix file header
Chris Lattner [Sat, 16 Oct 2004 16:37:42 +0000 (16:37 +0000)]
Fix file header

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

20 years agoBe more careful about looking for constants when we really want constantint's.
Chris Lattner [Sat, 16 Oct 2004 16:07:10 +0000 (16:07 +0000)]
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

20 years agoNone of these have actually been implemented yet.
Chris Lattner [Sat, 16 Oct 2004 00:29:30 +0000 (00:29 +0000)]
None of these have actually been implemented yet.

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

20 years agoMove the implementation of the instructions clone methods to this file so
Chris Lattner [Fri, 15 Oct 2004 23:52:53 +0000 (23:52 +0000)]
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

20 years agoMove the implementation of the clone method for these classes to
Chris Lattner [Fri, 15 Oct 2004 23:52:05 +0000 (23:52 +0000)]
Move the implementation of the clone method for these classes to
Instructions.cpp, so that a vtable is not emitted into every translation unit
that uses the classes.

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

20 years agoFix hyphenation and quoting style for great justice
Misha Brukman [Fri, 15 Oct 2004 23:22:48 +0000 (23:22 +0000)]
Fix hyphenation and quoting style for great justice

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

20 years agoThere is no reason not to build these in parallel
Chris Lattner [Fri, 15 Oct 2004 23:22:15 +0000 (23:22 +0000)]
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

20 years agoAdd a space between the type and name of value when printing error message
Misha Brukman [Fri, 15 Oct 2004 23:08:50 +0000 (23:08 +0000)]
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

20 years agoDon't print a bunch of metrics that are meaningless for external functions
Chris Lattner [Fri, 15 Oct 2004 19:40:31 +0000 (19:40 +0000)]
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

20 years agoFix broken links
Chris Lattner [Fri, 15 Oct 2004 17:04:28 +0000 (17:04 +0000)]
Fix broken links

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

20 years agoInstruction select globals with offsets better. For example, on this test
Chris Lattner [Fri, 15 Oct 2004 05:05:29 +0000 (05:05 +0000)]
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

20 years agoGive the X86 JIT the ability to encode global+disp constants. Patch
Chris Lattner [Fri, 15 Oct 2004 04:53:13 +0000 (04:53 +0000)]
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

20 years agoGive the X86 asm printer the ability to print out addressing modes that have
Chris Lattner [Fri, 15 Oct 2004 04:44:53 +0000 (04:44 +0000)]
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

20 years agoAllow X86 addressing modes to represent globals with offsets. Patch contributed
Chris Lattner [Fri, 15 Oct 2004 04:43:20 +0000 (04:43 +0000)]
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

20 years agoAllow machine operands to represent global variables with offsets. This is
Chris Lattner [Fri, 15 Oct 2004 04:38:41 +0000 (04:38 +0000)]
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

20 years agoThis patch fixes the nasty bug that caused 175.vpr to fail for X86 last night.
Chris Lattner [Fri, 15 Oct 2004 03:19:31 +0000 (03:19 +0000)]
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

20 years agoThis patch adds and improves debugging output. No functionality changes.
Chris Lattner [Fri, 15 Oct 2004 03:16:29 +0000 (03:16 +0000)]
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

20 years agoBetter codegen of binary integer ops with 32 bit immediate operands.
Nate Begeman [Fri, 15 Oct 2004 00:50:19 +0000 (00:50 +0000)]
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

20 years agoThe field is called `imm22', not simply `imm'
Misha Brukman [Thu, 14 Oct 2004 22:33:32 +0000 (22:33 +0000)]
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

20 years agoSynthetic instructions RET and RETL need to have all 3 parameters specified
Misha Brukman [Thu, 14 Oct 2004 22:32:49 +0000 (22:32 +0000)]
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

20 years agoClass F2_1 already inherits the imm22 field from class F2
Misha Brukman [Thu, 14 Oct 2004 22:32:24 +0000 (22:32 +0000)]
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

20 years agoGenerate the SparcV8 code emitter from .td files
Misha Brukman [Thu, 14 Oct 2004 21:57:19 +0000 (21:57 +0000)]
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

20 years ago* In the F3_1 class, default asi to 0 because it's not currently used
Misha Brukman [Thu, 14 Oct 2004 21:53:39 +0000 (21:53 +0000)]
* 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

20 years ago* We don't use the ENABLE_*_JIT flags in the source base anymore
Misha Brukman [Thu, 14 Oct 2004 20:06:36 +0000 (20:06 +0000)]
* We don't use the ENABLE_*_JIT flags in the source base anymore
* Convert references to Sparc to SparcV9 to clearly identify CPU type

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