Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Show First 20 Lines • Show All 1,288 Lines • ▼ Show 20 Lines | for (const MCPhysReg *ImpDef = MCID.getImplicitDefs(); *ImpDef; ++ImpDef) { | ||||
++NumRes; | ++NumRes; | ||||
} | } | ||||
} | } | ||||
return N->getSimpleValueType(NumRes); | return N->getSimpleValueType(NumRes); | ||||
} | } | ||||
/// CheckForLiveRegDef - Return true and update live register vector if the | /// CheckForLiveRegDef - Return true and update live register vector if the | ||||
/// specified register def of the specified SUnit clobbers any "live" registers. | /// specified register def of the specified SUnit clobbers any "live" registers. | ||||
static void CheckForLiveRegDef(SUnit *SU, unsigned Reg, | static void CheckForLiveRegDef(SUnit *SU, unsigned Reg, SUnit **LiveRegDefs, | ||||
SUnit **LiveRegDefs, | |||||
SmallSet<unsigned, 4> &RegAdded, | SmallSet<unsigned, 4> &RegAdded, | ||||
SmallVectorImpl<unsigned> &LRegs, | SmallVectorImpl<unsigned> &LRegs, | ||||
const TargetRegisterInfo *TRI) { | const TargetRegisterInfo *TRI, | ||||
const SDNode *Node = nullptr) { | |||||
for (MCRegAliasIterator AliasI(Reg, TRI, true); AliasI.isValid(); ++AliasI) { | for (MCRegAliasIterator AliasI(Reg, TRI, true); AliasI.isValid(); ++AliasI) { | ||||
// Check if Ref is live. | // Check if Ref is live. | ||||
if (!LiveRegDefs[*AliasI]) continue; | if (!LiveRegDefs[*AliasI]) continue; | ||||
// Allow multiple uses of the same def. | // Allow multiple uses of the same def. | ||||
if (LiveRegDefs[*AliasI] == SU) continue; | if (LiveRegDefs[*AliasI] == SU) continue; | ||||
// Allow multiple uses of same def | |||||
if (Node && LiveRegDefs[*AliasI]->getNode() == Node) | |||||
rampitec: Do you really want to insert it if Node is nullptr? | |||||
Hey Stas -- thanks for comments. The are two theoretical ways Node will be nullptr. 1. We are using default value, 2. The SDNode we passed is actually a nullptr. Neither way creates a problem for this condition.
jrbyrnes: Hey Stas -- thanks for comments.
The are two theoretical ways `Node` will be `nullptr`. 1. We… | |||||
continue; | |||||
// Add Reg to the set of interfering live regs. | // Add Reg to the set of interfering live regs. | ||||
if (RegAdded.insert(*AliasI).second) { | if (RegAdded.insert(*AliasI).second) { | ||||
LRegs.push_back(*AliasI); | LRegs.push_back(*AliasI); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/// CheckForLiveRegDefMasked - Check for any live physregs that are clobbered | /// CheckForLiveRegDefMasked - Check for any live physregs that are clobbered | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if (Node->getOpcode() == ISD::INLINEASM || | ||||
CheckForLiveRegDef(SU, Reg, LiveRegDefs.get(), RegAdded, LRegs, TRI); | CheckForLiveRegDef(SU, Reg, LiveRegDefs.get(), RegAdded, LRegs, TRI); | ||||
} | } | ||||
} else | } else | ||||
i += NumVals; | i += NumVals; | ||||
} | } | ||||
continue; | continue; | ||||
} | } | ||||
if (Node->getOpcode() == ISD::CopyToReg) { | |||||
Register Reg = cast<RegisterSDNode>(Node->getOperand(1))->getReg(); | |||||
if (Reg.isPhysical()) { | |||||
SDNode *SrcNode = Node->getOperand(2).getNode(); | |||||
CheckForLiveRegDef(SU, Reg, LiveRegDefs.get(), RegAdded, LRegs, TRI, | |||||
SrcNode); | |||||
} | |||||
} | |||||
if (!Node->isMachineOpcode()) | if (!Node->isMachineOpcode()) | ||||
continue; | continue; | ||||
// If we're in the middle of scheduling a call, don't begin scheduling | // If we're in the middle of scheduling a call, don't begin scheduling | ||||
// another call. Also, don't allow any physical registers to be live across | // another call. Also, don't allow any physical registers to be live across | ||||
// the call. | // the call. | ||||
if (Node->getMachineOpcode() == TII->getCallFrameDestroyOpcode()) { | if (Node->getMachineOpcode() == TII->getCallFrameDestroyOpcode()) { | ||||
// Check the special calling-sequence resource. | // Check the special calling-sequence resource. | ||||
unsigned CallResource = TRI->getNumRegs(); | unsigned CallResource = TRI->getNumRegs(); | ||||
▲ Show 20 Lines • Show All 1,794 Lines • Show Last 20 Lines |
Do you really want to insert it if Node is nullptr?