Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
//===----- ScheduleDAGFast.cpp - Fast poor list scheduler -----------------===// | //===----- ScheduleDAGFast.cpp - Fast poor list scheduler -----------------===// | ||||
// | // | ||||
// The LLVM Compiler Infrastructure | // The LLVM Compiler Infrastructure | ||||
// | // | ||||
// This file is distributed under the University of Illinois Open Source | // This file is distributed under the University of Illinois Open Source | ||||
// License. See LICENSE.TXT for details. | // License. See LICENSE.TXT for details. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// This implements a fast scheduler. | // This implements a fast scheduler. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "InstrEmitter.h" | #include "InstrEmitter.h" | ||||
#include "ScheduleDAGSDNodes.h" | #include "ScheduleDAGSDNodes.h" | ||||
#include "SDNodeDbgValue.h" | |||||
#include "llvm/ADT/STLExtras.h" | #include "llvm/ADT/STLExtras.h" | ||||
#include "llvm/ADT/SmallSet.h" | #include "llvm/ADT/SmallSet.h" | ||||
#include "llvm/ADT/Statistic.h" | #include "llvm/ADT/Statistic.h" | ||||
#include "llvm/CodeGen/SchedulerRegistry.h" | #include "llvm/CodeGen/SchedulerRegistry.h" | ||||
#include "llvm/CodeGen/SelectionDAGISel.h" | #include "llvm/CodeGen/SelectionDAGISel.h" | ||||
#include "llvm/CodeGen/TargetInstrInfo.h" | #include "llvm/CodeGen/TargetInstrInfo.h" | ||||
#include "llvm/CodeGen/TargetRegisterInfo.h" | #include "llvm/CodeGen/TargetRegisterInfo.h" | ||||
#include "llvm/IR/DataLayout.h" | #include "llvm/IR/DataLayout.h" | ||||
▲ Show 20 Lines • Show All 738 Lines • ▼ Show 20 Lines | |||||
ScheduleDAGLinearize::EmitSchedule(MachineBasicBlock::iterator &InsertPos) { | ScheduleDAGLinearize::EmitSchedule(MachineBasicBlock::iterator &InsertPos) { | ||||
InstrEmitter Emitter(BB, InsertPos); | InstrEmitter Emitter(BB, InsertPos); | ||||
DenseMap<SDValue, unsigned> VRBaseMap; | DenseMap<SDValue, unsigned> VRBaseMap; | ||||
DEBUG({ | DEBUG({ | ||||
dbgs() << "\n*** Final schedule ***\n"; | dbgs() << "\n*** Final schedule ***\n"; | ||||
}); | }); | ||||
// FIXME: Handle dbg_values. | |||||
unsigned NumNodes = Sequence.size(); | unsigned NumNodes = Sequence.size(); | ||||
MachineBasicBlock *BB = Emitter.getBlock(); | |||||
for (unsigned i = 0; i != NumNodes; ++i) { | for (unsigned i = 0; i != NumNodes; ++i) { | ||||
SDNode *N = Sequence[NumNodes-i-1]; | SDNode *N = Sequence[NumNodes-i-1]; | ||||
DEBUG(N->dump(DAG)); | DEBUG(N->dump(DAG)); | ||||
Emitter.EmitNode(N, false, false, VRBaseMap); | Emitter.EmitNode(N, false, false, VRBaseMap); | ||||
// Emit any debug values associated with the node. | |||||
if (N->getHasDebugValue()) { | |||||
MachineBasicBlock::iterator InsertPos = Emitter.getInsertPos(); | |||||
for (auto DV : DAG->GetDbgValues(N)) { | |||||
if (DV->isInvalidated()) | |||||
continue; | |||||
if (auto *DbgMI = Emitter.EmitDbgValue(DV, VRBaseMap)) | |||||
BB->insert(InsertPos, DbgMI); | |||||
DV->setIsInvalidated(); | |||||
} | |||||
} | |||||
} | } | ||||
DEBUG(dbgs() << '\n'); | DEBUG(dbgs() << '\n'); | ||||
InsertPos = Emitter.getInsertPos(); | InsertPos = Emitter.getInsertPos(); | ||||
return Emitter.getBlock(); | return Emitter.getBlock(); | ||||
} | } | ||||
Show All 13 Lines |