mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Two sets of changes. Sorry they are intermingled.
1. Fix pre-ra scheduler so it doesn't try to push instructions above calls to "optimize for latency". Call instructions don't have the right latency and this is more likely to use introduce spills. 2. Fix if-converter cost function. For ARM, it should use instruction latencies, not # of micro-ops since multi-latency instructions is completely executed even when the predicate is false. Also, some instruction will be "slower" when they are predicated due to the register def becoming implicit input. rdar://8598427 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -72,6 +72,7 @@ SUnit *ScheduleDAGSDNodes::Clone(SUnit *Old) {
|
||||
SUnit *SU = NewSUnit(Old->getNode());
|
||||
SU->OrigNode = Old->OrigNode;
|
||||
SU->Latency = Old->Latency;
|
||||
SU->isCall = Old->isCall;
|
||||
SU->isTwoAddress = Old->isTwoAddress;
|
||||
SU->isCommutable = Old->isCommutable;
|
||||
SU->hasPhysRegDefs = Old->hasPhysRegDefs;
|
||||
@@ -300,6 +301,8 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
|
||||
N = N->getOperand(N->getNumOperands()-1).getNode();
|
||||
assert(N->getNodeId() == -1 && "Node already inserted!");
|
||||
N->setNodeId(NodeSUnit->NodeNum);
|
||||
if (N->isMachineOpcode() && TII->get(N->getMachineOpcode()).isCall())
|
||||
NodeSUnit->isCall = true;
|
||||
}
|
||||
|
||||
// Scan down to find any flagged succs.
|
||||
@@ -316,6 +319,8 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
|
||||
assert(N->getNodeId() == -1 && "Node already inserted!");
|
||||
N->setNodeId(NodeSUnit->NodeNum);
|
||||
N = *UI;
|
||||
if (N->isMachineOpcode() && TII->get(N->getMachineOpcode()).isCall())
|
||||
NodeSUnit->isCall = true;
|
||||
break;
|
||||
}
|
||||
if (!HasFlagUse) break;
|
||||
@@ -438,10 +443,8 @@ void ScheduleDAGSDNodes::ComputeLatency(SUnit *SU) {
|
||||
// all nodes flagged together into this SUnit.
|
||||
SU->Latency = 0;
|
||||
for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
|
||||
if (N->isMachineOpcode()) {
|
||||
SU->Latency += InstrItins->
|
||||
getStageLatency(TII->get(N->getMachineOpcode()).getSchedClass());
|
||||
}
|
||||
if (N->isMachineOpcode())
|
||||
SU->Latency += TII->getInstrLatency(InstrItins, N);
|
||||
}
|
||||
|
||||
void ScheduleDAGSDNodes::ComputeOperandLatency(SDNode *Def, SDNode *Use,
|
||||
|
||||
Reference in New Issue
Block a user