mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +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:
@ -433,13 +433,19 @@ void ScheduleDAGFast::InsertCopiesAndMoveSuccs(SUnit *SU, unsigned Reg,
|
||||
/// FIXME: Move to SelectionDAG?
|
||||
static EVT getPhysicalRegisterVT(SDNode *N, unsigned Reg,
|
||||
const TargetInstrInfo *TII) {
|
||||
const MCInstrDesc &MCID = TII->get(N->getMachineOpcode());
|
||||
assert(MCID.ImplicitDefs && "Physical reg def must be in implicit def list!");
|
||||
unsigned NumRes = MCID.getNumDefs();
|
||||
for (const uint16_t *ImpDef = MCID.getImplicitDefs(); *ImpDef; ++ImpDef) {
|
||||
if (Reg == *ImpDef)
|
||||
break;
|
||||
++NumRes;
|
||||
unsigned NumRes;
|
||||
if (N->getOpcode() == ISD::CopyFromReg) {
|
||||
// CopyFromReg has: "chain, Val, glue" so operand 1 gives the type.
|
||||
NumRes = 1;
|
||||
} else {
|
||||
const MCInstrDesc &MCID = TII->get(N->getMachineOpcode());
|
||||
assert(MCID.ImplicitDefs && "Physical reg def must be in implicit def list!");
|
||||
NumRes = MCID.getNumDefs();
|
||||
for (const uint16_t *ImpDef = MCID.getImplicitDefs(); *ImpDef; ++ImpDef) {
|
||||
if (Reg == *ImpDef)
|
||||
break;
|
||||
++NumRes;
|
||||
}
|
||||
}
|
||||
return N->getValueType(NumRes);
|
||||
}
|
||||
|
Reference in New Issue
Block a user