Commit Graph

360 Commits

Author SHA1 Message Date
Evan Cheng
ae6421935b X86-64 VACOPY needs custom expansion. va_list is a struct { i32, i32, i8*, i8* }.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:16:35 +00:00
Anton Korobeynikov
f7dcfa81c5 Simplify things
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34849 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 21:50:27 +00:00
Chris Lattner
82932a5e4a argument lowering should copy from the vreg shadows of live-in arguments
passed in registers, not directly from the pregs themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34838 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 05:12:29 +00:00
Anton Korobeynikov
9dd9abd87f Ensure that fastcall'ed function is correctly mangled & stack is
properly aligned


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34788 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 16:29:22 +00:00
Chris Lattner
eac6607d7c remove dead option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 18:39:53 +00:00
Chris Lattner
e32bbf61c0 use high-level functions in CCState
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34739 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 07:09:55 +00:00
Chris Lattner
638402b253 make use of helper functions in CCState for analyzing formals and calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 07:00:42 +00:00
Chris Lattner
f5d280a0a6 switch LowerFastCCCallTo over to using the new fastcall description.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 06:26:33 +00:00
Chris Lattner
fc664c1bc0 switch LowerFastCCArguments over to using the autogenerated Fastcall description.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 06:21:19 +00:00
Chris Lattner
fcf1a3de7a rearrange code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34731 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 06:10:12 +00:00
Chris Lattner
2db39b865e remove fastcc (not fastcall) support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 06:05:16 +00:00
Chris Lattner
f39f771b02 switch LowerCCCArguments over to using autogenerated CC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34729 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 05:46:49 +00:00
Chris Lattner
c0bdf3460c simplify sret handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 05:39:26 +00:00
Chris Lattner
423c5f44f8 switch LowerCCCCallTo over to using an autogenerated callingconv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 05:31:48 +00:00
Chris Lattner
59ed56b9ee switch return value passing and the x86-64 calling convention information
over to being autogenerated from the X86CallingConv.td file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34722 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 04:55:35 +00:00
Chris Lattner
9774c915f1 switch x86-64 return value lowering over to using same mechanism as argument
lowering uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:28:59 +00:00
Chris Lattner
13513b7a50 Minor refactoring of CC Lowering interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:13:54 +00:00
Chris Lattner
362e98a5f5 move CC Lowering stuff to its own public interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 04:43:02 +00:00
Chris Lattner
9c71ab77cd refactor x86-64 argument lowering yet again, this time eliminating templates,
'clients', etc, and adding CCValAssign instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34654 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 04:18:15 +00:00
Chris Lattner
6e50f8cfe9 switch to smallvector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:59:53 +00:00
Chris Lattner
14dd4c9735 initial hack at splitting the x86-64 calling convention info out from the
mechanics that process it.  I'm still not happy with this, but it's a step
in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34631 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:50:02 +00:00
Chris Lattner
cc7b07a0ff the truncate must always be done, it's only the assert that is conditional.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34628 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 05:21:05 +00:00
Chris Lattner
df5cdb5288 in X86-64 CCC, i8/i16 arguments are already properly zext/sext'd on input.
Capture this so that downstream zext/sext's are optimized out.  This
compiles:
  int test(short X) { return (int)X; }

to:

_test:
        movl %edi, %eax
        ret

instead of:

_test:
        movswl %di, %eax
        ret


GCC produces this bizarre code:

_test:
        movw    %di, -12(%rsp)
        movswl  -12(%rsp),%eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34623 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 03:18:56 +00:00
Chris Lattner
c30654cc96 Fix an X86-64 abi bug. We now compile:
void foo(short);
void bar(unsigned short A) {
  foo(A);
}

into:

_bar:
        subq $8, %rsp
        movswl %di, %edi
        call _foo
        addq $8, %rsp
        ret

instead of:

_bar:
        subq $8, %rsp
        call _foo
        addq $8, %rsp
        ret

Testcase here: test/CodeGen/X86/x86-64-shortint.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34615 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 23:10:46 +00:00
Chris Lattner
7e22977c0f fix CodeGen/X86/2007-02-25-FastCCStack.ll, a regression from my patch last
night:  fastcc returns should only go in XMM0 if we have SSE2 or above.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34613 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 22:23:46 +00:00
Chris Lattner
5e265b29ea fastcc functions that return double values now return them in xmm0 on x86-32.
This implements CodeGen/X86/fp-stack-ret.ll:test[23]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34592 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 09:31:16 +00:00
Chris Lattner
4dfccf4b48 allow vectors to be passed to stdcall/fastcall functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34590 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 09:14:25 +00:00
Chris Lattner
2a9bdd74f2 move LowerRET into the 'Return Value Calling Convention Implementation'
section of the file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 09:12:39 +00:00
Chris Lattner
339b439d47 make all Lower*CallTo implementations use LowerCallResult to handle their
result value stuff.  This eliminates a bunch of duplicated code and now
GetRetValueLocs is the sole place that decides where a value is returned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34588 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 09:10:05 +00:00
Chris Lattner
09c75a4372 pass the calling convention into Lower*CallTo, instead of using ad-hoc flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 09:06:15 +00:00
Chris Lattner
3085e15117 factor a bunch of code out of LowerCCCCallTo into a new LowerCallResult
function.  This function now uses GetRetValueLocs to determine *where*
the result values are located and concerns itself with *how* to pull the
values out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34586 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 08:59:22 +00:00
Chris Lattner
2b02a4409f move some code around, pass in calling conv, even though it is unused
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34585 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 08:29:00 +00:00
Chris Lattner
cb18656734 simplify result value lowering by splitting the selection of *where* to return
registers out from the logic of *how* to return them.

This changes X86-64 to mark EAX live out when returning a 32-bit value,
where before it marked RAX liveout.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 08:15:11 +00:00
Chris Lattner
7d53a1c45e make void-return not a special case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34579 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 07:18:38 +00:00
Chris Lattner
5a88b837f2 eliminate a bunch more temporary vectors from X86 lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34578 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 07:10:00 +00:00
Chris Lattner
d96d072332 eliminate temporary vectors created during X86 lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 06:40:16 +00:00
Chris Lattner
9cb9626abf remove std::vector's in RET lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 06:21:57 +00:00
Jim Laskey
2ad9f17fee Simplify lowering and selection of exception ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34488 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-22 14:56:36 +00:00
Jim Laskey
62819f3144 Support to provide exception and selector registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34482 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 22:54:50 +00:00
Evan Cheng
f46847172a ELF / PIC requires GOT be in the EBX register during calls via PLT GOT pointer.
Add implicit uses of EBX to calls to ensure liveintervalanalysis does not treat
the GOT in EBX move as dead upon definition.
This should fix PR1207.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 21:18:14 +00:00
Anton Korobeynikov
b25fe82671 Fixed uninitialized stuff inside LegalizeDAG. Fortunately, the only
affected part is codegen of "memove" inside x86 backend. This fixes
PR1144


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33752 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 08:39:52 +00:00
Nate Begeman
bcc5f36765 Finish off bug 680, allowing targets to custom lower frame and return
address nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33636 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:58:52 +00:00
Nick Lewycky
5310897884 Fix compile error "jump to case label crosses initialization".
What compiler are people using that accepts this code?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33603 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-28 15:39:16 +00:00
Anton Korobeynikov
b10308e440 Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-28 13:31:35 +00:00
Jim Laskey
1ee2925742 Make LABEL a builtin opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 14:34:52 +00:00
Evan Cheng
706535db86 Linux GOT indirect reference is only necessary in PIC mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-22 21:34:25 +00:00
Anton Korobeynikov
7f70559bc4 * PIC codegen for X86/Linux has been implemented
* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33136 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 19:20:47 +00:00
Evan Cheng
73d6cf12ad - FCOPYSIGN custom lowering bug. Clear the sign bit of operand 0 first before
or'ing in the sign bit of operand 1.
- Tweaking: rather than left shift the sign bit, fp_extend operand 1 first
  before taking its sign bit if its type is smaller than that of operand 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 21:37:56 +00:00
Evan Cheng
1722eeeaa4 Typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32902 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 08:32:24 +00:00
Evan Cheng
68c47cba35 With SSE2, expand FCOPYSIGN to a series of SSE bitwise operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32900 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 07:55:56 +00:00