mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Teach legalize to promote copy(from|to)reg, instead of making the isel pass
do it. This results in better code on X86 for floats (because if strict precision is not required, we can elide some more expensive double -> float conversions like the old isel did), and allows other targets to emit CopyFromRegs that are not legal for arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19668 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -292,19 +292,7 @@ public:
|
||||
FuncInfo.ValueMap.find(V);
|
||||
assert(VMI != FuncInfo.ValueMap.end() && "Value not in map!");
|
||||
|
||||
MVT::ValueType RegVT = VT;
|
||||
if (TLI.getTypeAction(VT) == 1) // Must promote this value?
|
||||
RegVT = TLI.getTypeToTransformTo(VT);
|
||||
|
||||
N = DAG.getCopyFromReg(VMI->second, RegVT, DAG.getEntryNode());
|
||||
|
||||
if (RegVT != VT)
|
||||
if (MVT::isFloatingPoint(VT))
|
||||
N = DAG.getNode(ISD::FP_ROUND, VT, N);
|
||||
else
|
||||
N = DAG.getNode(ISD::TRUNCATE, VT, N);
|
||||
|
||||
return N;
|
||||
return N = DAG.getCopyFromReg(VMI->second, VT, DAG.getEntryNode());
|
||||
}
|
||||
|
||||
const SDOperand &setValue(const Value *V, SDOperand NewN) {
|
||||
@@ -843,14 +831,6 @@ CopyValueToVirtualRegister(SelectionDAGLowering &SDL, Value *V, unsigned Reg) {
|
||||
assert((Op.getOpcode() != ISD::CopyFromReg ||
|
||||
cast<RegSDNode>(Op)->getReg() != Reg) &&
|
||||
"Copy from a reg to the same reg!");
|
||||
MVT::ValueType VT = Op.getValueType();
|
||||
if (TLI.getTypeAction(VT) == 1) { // Must promote this value?
|
||||
if (MVT::isFloatingPoint(VT))
|
||||
Op = DAG.getNode(ISD::FP_EXTEND, TLI.getTypeToTransformTo(VT), Op);
|
||||
else
|
||||
Op = DAG.getNode(ISD::ZERO_EXTEND, TLI.getTypeToTransformTo(VT), Op);
|
||||
}
|
||||
|
||||
return DAG.getCopyToReg(SDL.getRoot(), Op, Reg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user