forked from OSchip/llvm-project
misched prep: rename InsertPos to End.
ScheduleDAGInstrs knows nothing about how instructions will be moved or inserted. llvm-svn: 152256
This commit is contained in:
parent
52226d409b
commit
a316faabec
|
@ -226,7 +226,7 @@ void ScheduleTopDownLive::schedule() {
|
||||||
releaseNode(&(*I));
|
releaseNode(&(*I));
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertPos = Begin;
|
MachineBasicBlock::iterator InsertPos = Begin;
|
||||||
while (SUnit *SU = pickNode()) {
|
while (SUnit *SU = pickNode()) {
|
||||||
DEBUG(dbgs() << "*** Scheduling Instruction:\n"; SU->dump(this));
|
DEBUG(dbgs() << "*** Scheduling Instruction:\n"; SU->dump(this));
|
||||||
|
|
||||||
|
|
|
@ -365,8 +365,8 @@ void SchedulePostRATDList::schedule() {
|
||||||
|
|
||||||
if (AntiDepBreak != NULL) {
|
if (AntiDepBreak != NULL) {
|
||||||
unsigned Broken =
|
unsigned Broken =
|
||||||
AntiDepBreak->BreakAntiDependencies(SUnits, Begin, InsertPos,
|
AntiDepBreak->BreakAntiDependencies(SUnits, Begin, End, EndIndex,
|
||||||
InsertPosIndex, DbgValues);
|
DbgValues);
|
||||||
|
|
||||||
if (Broken != 0) {
|
if (Broken != 0) {
|
||||||
// We made changes. Update the dependency graph.
|
// We made changes. Update the dependency graph.
|
||||||
|
@ -396,7 +396,7 @@ void SchedulePostRATDList::schedule() {
|
||||||
///
|
///
|
||||||
void SchedulePostRATDList::Observe(MachineInstr *MI, unsigned Count) {
|
void SchedulePostRATDList::Observe(MachineInstr *MI, unsigned Count) {
|
||||||
if (AntiDepBreak != NULL)
|
if (AntiDepBreak != NULL)
|
||||||
AntiDepBreak->Observe(MI, Count, InsertPosIndex);
|
AntiDepBreak->Observe(MI, Count, EndIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FinishBlock - Clean up register live-range state.
|
/// FinishBlock - Clean up register live-range state.
|
||||||
|
@ -761,24 +761,24 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
||||||
|
|
||||||
// EmitSchedule - Emit the machine code in scheduled order.
|
// EmitSchedule - Emit the machine code in scheduled order.
|
||||||
void SchedulePostRATDList::EmitSchedule() {
|
void SchedulePostRATDList::EmitSchedule() {
|
||||||
Begin = InsertPos;
|
Begin = End;
|
||||||
|
|
||||||
// If first instruction was a DBG_VALUE then put it back.
|
// If first instruction was a DBG_VALUE then put it back.
|
||||||
if (FirstDbgValue)
|
if (FirstDbgValue)
|
||||||
BB->splice(InsertPos, BB, FirstDbgValue);
|
BB->splice(End, BB, FirstDbgValue);
|
||||||
|
|
||||||
// Then re-insert them according to the given schedule.
|
// Then re-insert them according to the given schedule.
|
||||||
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
|
for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
|
||||||
if (SUnit *SU = Sequence[i])
|
if (SUnit *SU = Sequence[i])
|
||||||
BB->splice(InsertPos, BB, SU->getInstr());
|
BB->splice(End, BB, SU->getInstr());
|
||||||
else
|
else
|
||||||
// Null SUnit* is a noop.
|
// Null SUnit* is a noop.
|
||||||
TII->insertNoop(*BB, InsertPos);
|
TII->insertNoop(*BB, End);
|
||||||
|
|
||||||
// Update the Begin iterator, as the first instruction in the block
|
// Update the Begin iterator, as the first instruction in the block
|
||||||
// may have been scheduled later.
|
// may have been scheduled later.
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
Begin = prior(InsertPos);
|
Begin = prior(End);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reinsert any remaining debug_values.
|
// Reinsert any remaining debug_values.
|
||||||
|
|
|
@ -160,8 +160,8 @@ void ScheduleDAGInstrs::enterRegion(MachineBasicBlock *bb,
|
||||||
unsigned endcount) {
|
unsigned endcount) {
|
||||||
BB = bb;
|
BB = bb;
|
||||||
Begin = begin;
|
Begin = begin;
|
||||||
InsertPos = end;
|
End = end;
|
||||||
InsertPosIndex = endcount;
|
EndIndex = endcount;
|
||||||
|
|
||||||
// Check to see if the scheduler cares about latencies.
|
// Check to see if the scheduler cares about latencies.
|
||||||
UnitLatencies = forceUnitLatencies();
|
UnitLatencies = forceUnitLatencies();
|
||||||
|
@ -184,7 +184,7 @@ void ScheduleDAGInstrs::exitRegion() {
|
||||||
/// are too high to be hidden by the branch or when the liveout registers
|
/// are too high to be hidden by the branch or when the liveout registers
|
||||||
/// used by instructions in the fallthrough block.
|
/// used by instructions in the fallthrough block.
|
||||||
void ScheduleDAGInstrs::addSchedBarrierDeps() {
|
void ScheduleDAGInstrs::addSchedBarrierDeps() {
|
||||||
MachineInstr *ExitMI = InsertPos != BB->end() ? &*InsertPos : 0;
|
MachineInstr *ExitMI = End != BB->end() ? &*End : 0;
|
||||||
ExitSU.setInstr(ExitMI);
|
ExitSU.setInstr(ExitMI);
|
||||||
bool AllDepKnown = ExitMI &&
|
bool AllDepKnown = ExitMI &&
|
||||||
(ExitMI->isCall() || ExitMI->isBarrier());
|
(ExitMI->isCall() || ExitMI->isBarrier());
|
||||||
|
@ -476,7 +476,7 @@ void ScheduleDAGInstrs::initSUnits() {
|
||||||
// which is contained within a basic block.
|
// which is contained within a basic block.
|
||||||
SUnits.reserve(BB->size());
|
SUnits.reserve(BB->size());
|
||||||
|
|
||||||
for (MachineBasicBlock::iterator I = Begin; I != InsertPos; ++I) {
|
for (MachineBasicBlock::iterator I = Begin; I != End; ++I) {
|
||||||
MachineInstr *MI = I;
|
MachineInstr *MI = I;
|
||||||
if (MI->isDebugValue())
|
if (MI->isDebugValue())
|
||||||
continue;
|
continue;
|
||||||
|
@ -534,7 +534,7 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA) {
|
||||||
|
|
||||||
// Walk the list of instructions, from bottom moving up.
|
// Walk the list of instructions, from bottom moving up.
|
||||||
MachineInstr *PrevMI = NULL;
|
MachineInstr *PrevMI = NULL;
|
||||||
for (MachineBasicBlock::iterator MII = InsertPos, MIE = Begin;
|
for (MachineBasicBlock::iterator MII = End, MIE = Begin;
|
||||||
MII != MIE; --MII) {
|
MII != MIE; --MII) {
|
||||||
MachineInstr *MI = prior(MII);
|
MachineInstr *MI = prior(MII);
|
||||||
if (MI && PrevMI) {
|
if (MI && PrevMI) {
|
||||||
|
|
|
@ -119,16 +119,14 @@ namespace llvm {
|
||||||
// The block in which to insert instructions
|
// The block in which to insert instructions
|
||||||
MachineBasicBlock *BB;
|
MachineBasicBlock *BB;
|
||||||
|
|
||||||
// The beginning of the range to
|
/// The beginning of the range to be scheduled.
|
||||||
// be scheduled. The range extends
|
|
||||||
// to InsertPos.
|
|
||||||
MachineBasicBlock::iterator Begin;
|
MachineBasicBlock::iterator Begin;
|
||||||
|
|
||||||
// The position to insert instructions
|
/// The end of the range to be scheduled.
|
||||||
MachineBasicBlock::iterator InsertPos;
|
MachineBasicBlock::iterator End;
|
||||||
|
|
||||||
// The index in BB of InsertPos.
|
/// The index in BB of End.
|
||||||
unsigned InsertPosIndex;
|
unsigned EndIndex;
|
||||||
|
|
||||||
/// After calling BuildSchedGraph, each machine instruction in the current
|
/// After calling BuildSchedGraph, each machine instruction in the current
|
||||||
/// scheduling region is mapped to an SUnit.
|
/// scheduling region is mapped to an SUnit.
|
||||||
|
@ -239,7 +237,7 @@ namespace llvm {
|
||||||
MachineBasicBlock::iterator begin() const { return Begin; }
|
MachineBasicBlock::iterator begin() const { return Begin; }
|
||||||
|
|
||||||
/// end - Return an iterator to the bottom of the current scheduling region.
|
/// end - Return an iterator to the bottom of the current scheduling region.
|
||||||
MachineBasicBlock::iterator end() const { return InsertPos; }
|
MachineBasicBlock::iterator end() const { return End; }
|
||||||
|
|
||||||
/// NewSUnit - Creates a new SUnit and return a ptr to it.
|
/// NewSUnit - Creates a new SUnit and return a ptr to it.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue