diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2006-05-08 08:01:26 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2006-05-08 08:01:26 +0000 |
| commit | 9733bde74c61d7ea5989ce979480de85cef74224 (patch) | |
| tree | 0e20dc3b2d8456ce0f787aae18e90a8d3b4aadb3 /llvm/lib/Target/X86/X86RegisterInfo.cpp | |
| parent | ea10657c08a321529b75b6499e469617b0addd8f (diff) | |
| download | bcm5719-llvm-9733bde74c61d7ea5989ce979480de85cef74224.tar.gz bcm5719-llvm-9733bde74c61d7ea5989ce979480de85cef74224.zip | |
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.
llvm-svn: 28164
Diffstat (limited to 'llvm/lib/Target/X86/X86RegisterInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index dac71a02f12..57e6b17e6ae 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -52,10 +52,14 @@ void X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB, unsigned Opc; if (RC == &X86::R32RegClass) { Opc = X86::MOV32mr; - } else if (RC == &X86::R8RegClass) { - Opc = X86::MOV8mr; } else if (RC == &X86::R16RegClass) { Opc = X86::MOV16mr; + } else if (RC == &X86::R8RegClass) { + Opc = X86::MOV8mr; + } else if (RC == &X86::R32_RegClass) { + Opc = X86::MOV32_mr; + } else if (RC == &X86::R16_RegClass) { + Opc = X86::MOV16_mr; } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpST64m; } else if (RC == &X86::FR32RegClass) { @@ -78,10 +82,14 @@ void X86RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, unsigned Opc; if (RC == &X86::R32RegClass) { Opc = X86::MOV32rm; - } else if (RC == &X86::R8RegClass) { - Opc = X86::MOV8rm; } else if (RC == &X86::R16RegClass) { Opc = X86::MOV16rm; + } else if (RC == &X86::R8RegClass) { + Opc = X86::MOV8rm; + } else if (RC == &X86::R32_RegClass) { + Opc = X86::MOV32_rm; + } else if (RC == &X86::R16_RegClass) { + Opc = X86::MOV16_rm; } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpLD64m; } else if (RC == &X86::FR32RegClass) { @@ -104,10 +112,14 @@ void X86RegisterInfo::copyRegToReg(MachineBasicBlock &MBB, unsigned Opc; if (RC == &X86::R32RegClass) { Opc = X86::MOV32rr; - } else if (RC == &X86::R8RegClass) { - Opc = X86::MOV8rr; } else if (RC == &X86::R16RegClass) { Opc = X86::MOV16rr; + } else if (RC == &X86::R8RegClass) { + Opc = X86::MOV8rr; + } else if (RC == &X86::R32_RegClass) { + Opc = X86::MOV32_rr; + } else if (RC == &X86::R16_RegClass) { + Opc = X86::MOV16_rr; } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpMOV; } else if (RC == &X86::FR32RegClass) { |

