Commit Graph

459 Commits

Author SHA1 Message Date
Nate Begeman
f3d08f31b3 Implement div, rem, and frameindex
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20907 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-29 00:03:27 +00:00
Nate Begeman
f70b576ccc Pattern ISel: fix argument loading for i64s (thanks chris)
Simple  ISel: fix i64 subtract


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20903 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28 23:08:54 +00:00
Nate Begeman
ca12a2bd91 Remove fake instruction 'subc' (mnemonic for subfc).
More pattern isel updates


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20902 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28 22:28:37 +00:00
Nate Begeman
9db505ca9d Implement proper loads and zero-extends of all types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20897 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28 19:36:43 +00:00
Nate Begeman
7532e2f555 Fix that pesky floats in integer regs problem by assigning the f32 type to
the correct register class.  Also remove the loading of float data into int
regs part of varargs; it will need to be implemented differently later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20857 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 08:25:22 +00:00
Nate Begeman
f7e4338035 Get closer to having varargs working. There's still something strange
going on with copies between floating point and integer register files
being generated.  Once that is solved, varargs will be done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20856 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 07:46:36 +00:00
Nate Begeman
f26226155e Make 64bit args and float args work correct with calls. Thanks to Chris
for explaining EXTRACT_ELEMENT to me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20847 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 02:17:46 +00:00
Nate Begeman
307e7443b8 Next round of pattern isel changes, mostly dealing with calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20841 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 01:28:53 +00:00
Nate Begeman
c13a7f0eb3 Correct a documention link
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20840 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 01:28:05 +00:00
Nate Begeman
c7b09f1f01 Support global addresses and fix call returns. Varargs still aren't
handled correctly for floating point arguments, or more than 8 arguemnts.
This does however, allow hello world to run.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20832 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-25 08:34:25 +00:00
Nate Begeman
9e3e1b5d44 Implement next round of Pattern ISel fixes
1. void returns
2. multiplies
3. calls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20822 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 23:35:30 +00:00
Nate Begeman
7ca541b75a Fix an incorrect argument being passed to BuildMI for indirect calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20821 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 23:34:38 +00:00
Nate Begeman
2daec45751 Commit Gabor Greif's patch to use iterators in lowering intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20816 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 20:07:16 +00:00
Chris Lattner
1bcb9abb30 eliminate dead variables, patch contributed by Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20812 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 17:32:20 +00:00
Nate Begeman
5e9666129a Implement more of the PPC32 Pattern ISel:
1) dynamic stack alloc
2) loads
3) shifts
4) subtract
5) immediate form of add, and, or, xor
6) change flag from -pattern-isel to -enable-ppc-pattern-isel

Remove dead arguments from getGlobalBaseReg in the simple ISel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20810 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 06:28:42 +00:00
Chris Lattner
246fa6316d Fix silly "no newline at end of file" warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20809 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 06:16:18 +00:00
Nate Begeman
a9795f81e9 Addition of the PPC32 Pattern ISel. While it is far from complete, it will
be brought up to parity with the current simple ISel in the coming days.
Currently, -pattern-isel is required to trigger it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20805 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-24 04:41:43 +00:00
Misha Brukman
c7cd5e5672 We may be adding functions to the Module during initialization, so
conservatively, it's modified


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20735 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-21 19:22:14 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Chris Lattner
411eba0eaf Fix a crash handling 'undef bool', fixing an llc crash on 186.crafty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-08 22:53:09 +00:00
Chris Lattner
4318a3d0e9 cleanup the cfg after lsr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20410 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-02 21:56:00 +00:00
Chris Lattner
0c7490617a Add a temporary option for llc-beta: -enable-lsr-for-ppc, which turns on
Loop Strength Reduction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20399 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-02 06:19:22 +00:00
Chris Lattner
7a823bd01f Fix a problem where the PPC backend lost track of the fact that it had
to save and restore the LR register on entry and exit of a leaf function
that needed to access globals or the constant pool.  This should hopefully
fix oscar from sending the PPC tester spinning out of control.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20197 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-15 20:26:49 +00:00
Chris Lattner
3c70764907 Fix Regression/CodeGen/PowerPC/2005-01-14-UndefLong.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19557 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 20:22:02 +00:00
Chris Lattner
fbd4de1d9b Fix: Regression/CodeGen/PowerPC/2005-01-14-SetSelectCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19555 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 19:31:00 +00:00
Chris Lattner
35e5c7c186 This hunk:
-  unsigned TrueValue = getReg(TrueVal, BB, BB->begin());
+  unsigned TrueValue = getReg(TrueVal);

Fixes the PPC regressions from last night.

The other hunk is just a clarity improvement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19263 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-02 23:07:31 +00:00
Chris Lattner
6dec0b09d5 Fix a FIXME: Select instructions on longs were miscompiled.
While we're at it, improve codegen of select instructions.  For this
testcase:

int %test(bool %C, int %A, int %B) {
  %D = select bool %C, int %A, int %B
  ret int %D
}

We used to generate this code:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        b .LBB_test_3   ;
.LBB_test_2:    ;
        or r5, r4, r4
.LBB_test_3:    ;
        or r3, r5, r5
        blr

Now we emit:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r4, r5, r5
.LBB_test_2:    ;
        or r3, r4, r4
        blr

-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19214 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:10:12 +00:00
Chris Lattner
47f9dd14b2 Specify all of the targets built.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18985 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 17:26:44 +00:00
Chris Lattner
be686a8897 Factor out common .td file chunks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18982 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 16:31:57 +00:00
Chris Lattner
869f45937b Fix Regression/CodeGen/PowerPC/2004-12-12-ZeroSizeCommon.ll, and all programs
when compiled with debug information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18835 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 20:36:19 +00:00
Chris Lattner
8363ad6bfc CSE calls to getTypeSize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18833 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 20:31:00 +00:00
Chris Lattner
3ea78c4276 Use the target triple to pick this target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 17:40:28 +00:00
Chris Lattner
0284628e8e Fix several bugs in 'op x, imm' handling. Foremost is that we now emit
addi r3, r3, -1
instead of
   addi r3, r3, 1

for 'sub int X, 1'.

Secondarily, this fixes several cases where we could crash given an unsigned
constant.  And fixes a couple of minor missed optimization cases, such as
xor X, ~0U -> not X


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18379 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:30:20 +00:00
Chris Lattner
35f2bbe8c6 Fix CodeGen/PowerPC/2004-11-30-shr-var-crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18376 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 06:40:04 +00:00
Chris Lattner
e74ed0d53b Fix test/Regression/CodeGen/PowerPC/2004-11-29-ShrCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18374 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 06:36:11 +00:00
Chris Lattner
7747040410 Fix test/Regression/CodeGen/PowerPC/2004-11-30-shift-crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18371 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 06:29:10 +00:00
Chris Lattner
9d0087e043 The LLVM bool type shall have 1 byte alignment on PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18311 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 21:16:45 +00:00
Nate Begeman
3330e08888 Remove the ISel->AsmPrinter link via the TargetMachine that was put in
place to help bring up the PowerPC back end on Darwin.  This code is no
longer serves any purpose now that the AsmPrinter does the right thing
all the time printing GlobalValues.  --Cruft.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18267 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-27 04:45:11 +00:00
Chris Lattner
15ee8adb00 There is no reason to store <x,x>, just store <x>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18263 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-26 20:25:17 +00:00
Nate Begeman
d4c8bea47f Enable optimization suggested by Chris Lattner to not emit reloc stubs for
static global variables whose addresses are taken.  This allows us to
convert the following code for taking the address of a static function foo

        addis r2, r30, ha16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")
        lwz r3, lo16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")(r2)

which also includes linker stub code emitted at the end of the .s file not
shown here, and replace it with this:

        addis r2, r30, ha16(l1__2E_foo_2-"L00001$pb")
        la r3, lo16(l1__2E_foo_2-"L00001$pb")(r2)

which in addition to not needing linker help, also has no load instruction.
For those not up on PowerPC mnemonics, la is shorthand for add immediate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 07:09:01 +00:00
Chris Lattner
fde839b4ff Fix the build on non ppc machines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18235 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 06:14:45 +00:00
Chris Lattner
2a0c0dff0b The JIT works enough
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18228 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 04:14:54 +00:00
Chris Lattner
5cbf3bc202 Fix encoding of fsel, fixing olden/power, McCat/bisort and several others.
All of Olden passes now! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18227 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 04:11:07 +00:00
Chris Lattner
a1ab451392 Fix encoding of fneg instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18226 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 03:53:44 +00:00
Chris Lattner
cd61ec837f Fix encoding of swari, fixing several programs, including Olden/mst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18225 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 03:40:20 +00:00
Chris Lattner
b752a97ca4 There is not a 1-1 mappign between llvm blocks and PPC blocks, do not use
LLVM blocks as the keys for the branch rewriter.  This fixes treeadd and
many other programs with the JIT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18223 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 00:33:57 +00:00
Chris Lattner
5efb75daed * Rename existing relocations to be more specific
* Add relocations for refernces to non-lazy darwin stubs and implement
  them correctly.

With this change, we can correctly references external globals, and now
all but two UnitTests and all but 1 Regression/C tests pass.

More importantly, bugpoint-jit will start giving us useful testcases,
instead of always telling us that references to external globals don't
work :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18222 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 22:30:08 +00:00
Nate Begeman
53e4aa57c6 Add the same optimization that we do loading from fixed alloca slots to
storing to fixed alloca slots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18221 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 21:53:14 +00:00
Chris Lattner
73278080c8 Write CompilationCallback as an explicit assembly stub to avoid getting GCC's
prolog.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18220 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 21:01:46 +00:00
Chris Lattner
892afa9556 When rewriting the original call instruction, make sure to rewrite it to
call the right address.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18213 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 18:00:02 +00:00