OSDN Git Service

Fixing truncate. Previously we were emitting truncate from r16 to r8 as
authorEvan Cheng <evan.cheng@apple.com>
Mon, 8 May 2006 08:01:26 +0000 (08:01 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 8 May 2006 08:01:26 +0000 (08:01 +0000)
commit403be7eafc8922c20d7e8253bc8d6d0abd0448cb
tree06d6dbee4979e60260288d696520de5ef7c2ea0b
parent023cfb6871c3a302387ea3e228dc000e45639b5b
Fixing truncate. Previously we were emitting truncate from r16 to r8 as
movw. That is we promote the destination operand to r16. So
        %CH = TRUNC_R16_R8 %BP
is emitted as
        movw %bp, %cx.

This is incorrect. If %cl is live, it would be clobbered.
Ideally we want to do the opposite, that is emitted it as
        movb ??, %ch
But this is not possible since %bp does not have a r8 sub-register.

We are now defining a new register class R16_ which is a subclass of R16
containing only those 16-bit registers that have r8 sub-registers (i.e.
AX - DX). We isel the truncate to two instructions, a MOV16to16_ to copy the
value to the R16_ class, followed by a TRUNC_R16_R8.

Due to bug 770, the register colaescer is not going to coalesce between R16 and
R16_. That will be fixed later so we can eliminate the MOV16to16_. Right now, it
can only be eliminated if we are lucky that source and destination registers are
the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28164 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ATTAsmPrinter.cpp
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86IntelAsmPrinter.cpp
lib/Target/X86/X86RegisterInfo.cpp
lib/Target/X86/X86RegisterInfo.td