llvm-6502/lib/CodeGen/SelectionDAG
Chris Lattner 6656dd1a78 Handle physreg input/outputs. We now compile this:
int %test_cpuid(int %op) {
        %B = alloca int
        %C = alloca int
        %D = alloca int
        %A = call int asm "cpuid", "=eax,==ebx,==ecx,==edx,eax"(int* %B, int* %C, int* %D, int %op)
        %Bv = load int* %B
        %Cv = load int* %C
        %Dv = load int* %D
        %x = add int %A, %Bv
        %y = add int %x, %Cv
        %z = add int %y, %Dv
        ret int %z
}

to this:

_test_cpuid:
        sub %ESP, 16
        mov DWORD PTR [%ESP], %EBX
        mov %EAX, DWORD PTR [%ESP + 20]
        cpuid
        mov DWORD PTR [%ESP + 8], %ECX
        mov DWORD PTR [%ESP + 12], %EBX
        mov DWORD PTR [%ESP + 4], %EDX
        mov %ECX, DWORD PTR [%ESP + 12]
        add %EAX, %ECX
        mov %ECX, DWORD PTR [%ESP + 8]
        add %EAX, %ECX
        mov %ECX, DWORD PTR [%ESP + 4]
        add %EAX, %ECX
        mov %EBX, DWORD PTR [%ESP]
        add %ESP, 16
        ret

... note the proper register allocation.  :)

it is unclear to me why the loads aren't folded into the adds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25827 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-31 02:03:41 +00:00
..
DAGCombiner.cpp Move MaskedValueIsZero from the DAGCombiner to the TargetLowering interface,making isMaskedValueZeroForTargetNode simpler, and useable from other partsof the compiler. 2006-01-30 04:09:27 +00:00
LegalizeDAG.cpp Fix a bug in my legalizer reworking that caused the X86 backend to not get 2006-01-30 22:43:50 +00:00
Makefile Change Library Names Not To Conflict With Others When Installed 2004-10-27 23:18:45 +00:00
ScheduleDAG.cpp Handle physreg input/outputs. We now compile this: 2006-01-31 02:03:41 +00:00
ScheduleDAGList.cpp Clean up some code; improve efficiency; and fixed a potential bug involving 2006-01-26 00:30:29 +00:00
ScheduleDAGSimple.cpp Fix VC++ compilation error. 2006-01-24 04:43:17 +00:00
SelectionDAG.cpp Remove some special case hacks for CALLSEQ_*, using UpdateNodeOperands 2006-01-29 07:58:15 +00:00
SelectionDAGISel.cpp Handle physreg input/outputs. We now compile this: 2006-01-31 02:03:41 +00:00
SelectionDAGPrinter.cpp Added an index field to GlobalAddressSDNode so it can represent X+12, etc. 2005-11-30 02:04:11 +00:00
TargetLowering.cpp Move MaskedValueIsZero from the DAGCombiner to the TargetLowering interface,making isMaskedValueZeroForTargetNode simpler, and useable from other partsof the compiler. 2006-01-30 04:09:27 +00:00