llvm-6502/lib/CodeGen/SelectionDAG
Chris Lattner e33544ce55 Enhance the truncstore optimization code to handle shifted
values and propagate demanded bits through them in simple cases.

This allows this code:
void foo(char *P) {
   strcpy(P, "abc");
}
to compile to:

_foo:
        ldrb r3, [r1]
        ldrb r2, [r1, #+1]
        ldrb r12, [r1, #+2]!
        ldrb r1, [r1, #+1]
        strb r1, [r0, #+3]
        strb r2, [r0, #+1]
        strb r12, [r0, #+2]
        strb r3, [r0]
        bx lr

instead of:

_foo:
        ldrb r3, [r1, #+3]
        ldrb r2, [r1, #+2]
        orr r3, r2, r3, lsl #8
        ldrb r2, [r1, #+1]
        ldrb r1, [r1]
        orr r2, r1, r2, lsl #8
        orr r3, r2, r3, lsl #16
        strb r3, [r0]
        mov r2, r3, lsr #24
        strb r2, [r0, #+3]
        mov r2, r3, lsr #16
        strb r2, [r0, #+2]
        mov r3, r3, lsr #8
        strb r3, [r0, #+1]
        bx lr

testcase here: test/CodeGen/ARM/truncstore-dag-combine.ll

This also helps occasionally for X86 and other cases not involving 
unaligned load/stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 06:58:48 +00:00
..
CallingConvLower.cpp propagate struct size and alignment of byval arguments to the DAG 2007-08-10 14:44:42 +00:00
DAGCombiner.cpp Enhance the truncstore optimization code to handle shifted 2007-10-13 06:58:48 +00:00
LegalizeDAG.cpp Add a simple optimization to simplify the input to 2007-10-13 06:35:54 +00:00
Makefile For PR780: 2006-07-26 16:18:00 +00:00
ScheduleDAG.cpp EXTRACT_SUBREG coalescing support. The coalescer now treats EXTRACT_SUBREG like 2007-10-12 08:50:34 +00:00
ScheduleDAGList.cpp Trim some unneeded fields. 2007-09-28 19:24:24 +00:00
ScheduleDAGRRList.cpp EXTRACT_SUBREG coalescing support. The coalescer now treats EXTRACT_SUBREG like 2007-10-12 08:50:34 +00:00
SelectionDAG.cpp Add an ISD::FPOW node type. 2007-10-11 23:06:37 +00:00
SelectionDAGISel.cpp Corrected many typing errors. And removed 'nest' parameter handling 2007-10-12 21:30:57 +00:00
SelectionDAGPrinter.cpp Added major new capabilities to scheduler (only BURR for now) to support physical register dependency. The BURR scheduler can now backtrace and duplicate instructions in order to avoid "expensive / impossible to copy" values (e.g. status flag EFLAGS for x86) from being clobbered. 2007-09-25 01:54:36 +00:00
TargetLowering.cpp Add runtime library names for pow. 2007-10-11 23:09:10 +00:00