llvm-6502/lib/CodeGen
Chris Lattner 0afa8e348e Implement a target independent optimization to codegen arguments only into
the basic block that uses them if possible.  This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).

For this (contrived to show the optimization) testcase:

int %argtest(int %A, int %B) {
        %X = sub int 12345, %A
        br label %L
L:
        %Y = add int %X, %B
        ret int %Y
}

we used to produce:

argtest:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, 12345
        sub %EAX, %ECX
        mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1:  # L
        add %EAX, %EDX
        ret


now we produce:

argtest:
        mov %EAX, 12345
        sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1:  # L
        add %EAX, DWORD PTR [%ESP + 8]
        ret

This also fixes the FIXME in the code.

BTW, this occurs in real code.  164.gzip shrinks from 8623 to 8608 lines of
.s file.  The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.

Take that alkis. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19639 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:55:19 +00:00
..
SelectionDAG Implement a target independent optimization to codegen arguments only into 2005-01-17 17:55:19 +00:00
AsmPrinter.cpp Silence VS warnings 2005-01-08 19:59:10 +00:00
BranchFolding.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
IntrinsicLowering.cpp Fix #includes of i*.h => Instructions.h as per PR403. 2004-07-29 17:30:56 +00:00
LiveInterval.cpp Prevent accessing past the end of the intervals vector, this fixes 2004-12-04 01:22:09 +00:00
LiveInterval.h Fix typeo 2004-11-18 04:31:10 +00:00
LiveIntervalAnalysis.cpp Silence warnings from VS 2005-01-08 19:55:00 +00:00
LiveIntervalAnalysis.h For PR387:\ 2004-12-07 04:03:45 +00:00
LiveVariables.cpp Do not use variable sized arrays in C++, they are non-portable. Patch 2004-10-25 18:44:14 +00:00
MachineBasicBlock.cpp Move method bodies that depend on <algorithm> from MBB.h to MBB.cpp 2004-10-26 15:43:42 +00:00
MachineCodeEmitter.cpp Fix the FIXME, nuke the JIT specific forceCompilationOf method. 2004-11-22 21:54:35 +00:00
MachineFunction.cpp Silence warnings from VS 2005-01-08 19:55:00 +00:00
MachineInstr.cpp Allow machine operands to represent global variables with offsets. This is 2004-10-15 04:38:41 +00:00
Makefile Change Library Names Not To Conflict With Others When Installed 2004-10-27 23:18:45 +00:00
Passes.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
PHIElimination.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
PhysRegTracker.h Improved PhysRegTracker interface. RegAlloc lazily allocates the register tracker using a std::auto_ptr 2004-02-23 06:10:13 +00:00
PrologEpilogInserter.cpp Put this change back in after testing from Reid proved its innocence. getSpillSize now returns value in bits 2004-08-29 22:00:24 +00:00
RegAllocIterativeScan.cpp Silence VS warnings 2005-01-08 19:53:50 +00:00
RegAllocLinearScan.cpp Silence VS warnings 2005-01-08 19:53:50 +00:00
RegAllocLocal.cpp Clean up the MachineBasicBlock.h file, percolating #includes into this file. 2004-10-26 15:35:58 +00:00
RegAllocSimple.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
TwoAddressInstructionPass.cpp Make the 2-address instruction lowering pass smarter in two ways: 2005-01-02 02:34:12 +00:00
UnreachableBlockElim.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
VirtRegMap.cpp Improve compatibility with acc 2005-01-14 15:54:24 +00:00
VirtRegMap.h When a virtual register is folded into an instruction, keep track of whether 2004-10-01 23:15:36 +00:00