Commit Graph

92 Commits

Author SHA1 Message Date
Andrew Lenharth
558bc88a00 core changes for varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22254 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 18:34:52 +00:00
Misha Brukman
27177f8c16 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21457 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 18:06:01 +00:00
Misha Brukman
b5f662fa03 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21425 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:30: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
e7f96c515e Substantially improve the code generated by non-folded setcc instructions.
In particular, instead of compiling this:

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

to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        bl .LBBtest_1   !
        nop
        ba .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, 1, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_2:     !
        or %g0, 0, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_3:     !
        restore %g0, %g0, %g0
        retl
        nop

We now compile it to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        or %g0, 1, %i0
        bl .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, %g0, %i0
.LBBtest_2:     !
        restore %g0, %g0, %g0
        retl
        nop


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19213 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:06:57 +00:00
Chris Lattner
84c556e92a Remove unused #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19021 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 19:07:04 +00:00
Brian Gaeke
6b260e2638 Get rid of shifts by zero in most cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18931 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-14 08:21:02 +00:00
Brian Gaeke
f731be0dd5 Finally enable the setcc-branch folding code.
Also, fix a bug where ubyte 255 would sometimes be output as -1. This
was afflicting hbd.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18823 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 07:42:58 +00:00
Brian Gaeke
81cf150b5d Add (currently disabled) code for canFoldSetCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18820 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 06:22:30 +00:00
Brian Gaeke
6a8c46cde3 Add stubs for setcc-branch folding support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 06:01:26 +00:00
Brian Gaeke
4f70b63ebc Make GEPs not suck so much:
* Don't emit the Index * ElementSize multiply if Index is a constant.
* Use a shift, not a multiply, if ElementSize is 1/2/4/8.
* If ElementSize fits in the immediate field of SMUL, then put it there.

Fix a bug where struct offsets might be truncated (ConstantSInt::get is
now used instead of ConstantInt::get).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18792 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 05:19:02 +00:00
Brian Gaeke
1f42181f99 Support binary operations with immediates for <= cInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 08:39:28 +00:00
Brian Gaeke
31e575901f Fix bug in emitGEPOperation with large struct-member offsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 04:07:33 +00:00
Brian Gaeke
88108b8cfa Support shr long/ulong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18173 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 21:10:50 +00:00
Brian Gaeke
fbe558c993 pseudocode for 64-bit lshr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18154 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 08:14:09 +00:00
Brian Gaeke
9ffcf9fddd Add stub method for long shift codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18100 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 08:02:06 +00:00
Brian Gaeke
c7b4f1033f Implement setcc on longs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18088 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 08:11:28 +00:00
Brian Gaeke
5f91de2b38 Support add, sub, mul, div, rem on longs/ulongs (latter 3 by emitting libcalls).
Add a big comment containing my notes on how to do setcc for longs/ulongs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 07:13:16 +00:00
Brian Gaeke
79fe833411 Fix extraStack calculation -- I think in fact it might be getting a bit *too*
much stack, but that's better than not enough, which leads to miscompilations.

Fix FP vaarg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 03:35:22 +00:00
Brian Gaeke
b95cbee930 Support most cases of vaarg (except double).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 22:50:42 +00:00
Brian Gaeke
e6e7e3aadd Implement vacopy and vanext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18031 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 03:32:12 +00:00
Misha Brukman
1dc555c0d3 Revert the patch that adds Function* for each 64-bit libc div/mul/rem that we
want to do; instead, we can use MachineInstr::addExternalSymbol(char*, bool) and
thus we don't have to modify the Module as we are code generating for it


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18025 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 00:10:20 +00:00
Misha Brukman
d159aafc26 Add protoypes for 64-bit long/ulong div, mul, and rem functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18019 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 22:14:35 +00:00
Brian Gaeke
b6c409a13d Add VANext and VAArg stubs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18012 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 21:08:18 +00:00
Brian Gaeke
d90282db12 Implement va_start.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18011 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 20:57:24 +00:00
Brian Gaeke
4e459c465e First part of varargs support: getting all varargs which could possibly
be in registers into memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18006 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 20:31:08 +00:00
Brian Gaeke
2f95ed65e0 va_end can safely be codegen'd to nothing on v8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18004 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 19:21:34 +00:00
Brian Gaeke
9e672a2d1b A very sorry stub implementation of varargs intrinsics...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18003 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 18:53:59 +00:00
Brian Gaeke
a54df2503b Fix bug in casting to long/ulong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18001 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 18:48:10 +00:00
Brian Gaeke
7c0afe04ab Rewrite LoadArgumentsToVirtualRegs, making it match almost exactly how
visitCallInst works.  Support cast of byte/short/int to long.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17949 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-18 07:43:33 +00:00
Brian Gaeke
b3e0017763 We were (somehow) getting the wrong branch opcode for setcc float instrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17925 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-17 22:06:56 +00:00
Brian Gaeke
da9b3668c2 Fix problem with insertion point for ADJCALLSTACKDOWN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17733 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 06:32:08 +00:00
Brian Gaeke
04fe7477b1 Fix NotTest - round up extraStack to the nearest doubleword, if it is
not zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17728 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 05:19:00 +00:00
Brian Gaeke
24b90c3647 Rewrite outgoing arg handling to handle more weird corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17722 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 03:22:07 +00:00
Brian Gaeke
6931fd61c0 Handle "call" operands of type long/ulong passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17464 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-04 00:27:04 +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
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
299b39d356 Fix assertion failure when calling or returning from a function which
returns 'bool' type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:34:17 +00:00
Brian Gaeke
50094edf96 Fix whitespace and wrap some long lines.
Deal with allocating stack space for outgoing args and copying them into the
correct stack slots (at least, we can copy <=32-bit int args).
We now correctly generate ADJCALLSTACK* instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16881 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 19:57:18 +00:00
Brian Gaeke
6672f86a4d I think this will handle double args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16618 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-30 19:44:32 +00:00
Brian Gaeke
1df468ea9b Simplify copyConstantToRegister() for longs, using a pair of recursive calls.
Copy constant-pool entries' addresses into registers before loading out of them,
to avoid errors from the assembler.
Handle loading call args past the 6th one off the stack.
Add IMPLICIT_DEF pseudo-instrs for double and long arguments passed in register
pairs.
Use FpMOVD to copy doubles around instead of the horrible store-load thing we
were doing before.
Handle 'ret double' and 'ret long'.
Fix a bug in handling 'and/or/xor long'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16577 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:34:41 +00:00
Brian Gaeke
f539ffe1b6 This file does not need <iostream>, I think.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16245 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-08 04:10:52 +00:00
Brian Gaeke
74dfcf1200 Back to compiling land for v8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16138 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-02 02:37:43 +00:00
Chris Lattner
7330248482 CPR fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14960 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 07:26:17 +00:00
Brian Gaeke
812c488f0a Do IMPLICIT_DEFs on incoming args' hard regs, to avoid confusing the regalloc.
Support single-fp incoming args.
Support single-fp outgoing args ('call' operands).
Support double-fp return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14880 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 10:31:25 +00:00
Brian Gaeke
3a0858957a Support setcc on fp values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14687 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 09:08:35 +00:00
Brian Gaeke
ccdd70a5c0 Fix bug involving bool arguments to binary operators.
Fix typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 08:08:10 +00:00
Brian Gaeke
2a9f539168 Fix bug in copying long constants to register pairs. We were getting
the top and bottom halves backwards...how embarrassing.
Support 'cast long to long' and other similar no-op casts to long.
Support 'ret long'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14683 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 07:52:13 +00:00
Brian Gaeke
f9a75460ee Support 'ret float'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14681 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 07:22:27 +00:00
Chris Lattner
38343f6cfe Add #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 17:19:21 +00:00