mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
ScheduleDAG: record PhysReg dependencies represented by CopyFromReg nodes
x86's CMPXCHG -> EFLAGS consumer wasn't being recorded as a real EFLAGS dependency because it was represented by a pair of CopyFromReg(EFLAGS) -> CopyToReg(EFLAGS) nodes. ScheduleDAG was expecting the source to be an implicit-def on the instruction, where the result numbers in the DAG and the Uses list in TableGen matched up precisely. The Copy notation seems much more robust, so this patch extends ScheduleDAG rather than refactoring x86. Should fix PR20376. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220529 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -119,15 +119,20 @@ static void CheckForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
|
||||
return;
|
||||
|
||||
unsigned ResNo = User->getOperand(2).getResNo();
|
||||
if (Def->isMachineOpcode()) {
|
||||
if (Def->getOpcode() == ISD::CopyFromReg &&
|
||||
cast<RegisterSDNode>(Def->getOperand(1))->getReg() == Reg) {
|
||||
PhysReg = Reg;
|
||||
} else if (Def->isMachineOpcode()) {
|
||||
const MCInstrDesc &II = TII->get(Def->getMachineOpcode());
|
||||
if (ResNo >= II.getNumDefs() &&
|
||||
II.ImplicitDefs[ResNo - II.getNumDefs()] == Reg) {
|
||||
II.ImplicitDefs[ResNo - II.getNumDefs()] == Reg)
|
||||
PhysReg = Reg;
|
||||
const TargetRegisterClass *RC =
|
||||
}
|
||||
|
||||
if (PhysReg != 0) {
|
||||
const TargetRegisterClass *RC =
|
||||
TRI->getMinimalPhysRegClass(Reg, Def->getValueType(ResNo));
|
||||
Cost = RC->getCopyCost();
|
||||
}
|
||||
Cost = RC->getCopyCost();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user