mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	Make BreakAntiDependencies' SUnits argument const, and make the Begin
and End arguments by-value rather than by-reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -281,9 +281,9 @@ void AggressiveAntiDepBreaker::GetPassthruRegs(MachineInstr *MI,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// AntiDepEdges - Return in Edges the anti- and output- dependencies
 | 
					/// AntiDepEdges - Return in Edges the anti- and output- dependencies
 | 
				
			||||||
/// in SU that we want to consider for breaking.
 | 
					/// in SU that we want to consider for breaking.
 | 
				
			||||||
static void AntiDepEdges(SUnit *SU, std::vector<SDep*>& Edges) {
 | 
					static void AntiDepEdges(const SUnit *SU, std::vector<const SDep*>& Edges) {
 | 
				
			||||||
  SmallSet<unsigned, 4> RegSet;
 | 
					  SmallSet<unsigned, 4> RegSet;
 | 
				
			||||||
  for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
					  for (SUnit::const_pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
				
			||||||
       P != PE; ++P) {
 | 
					       P != PE; ++P) {
 | 
				
			||||||
    if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
 | 
					    if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
 | 
				
			||||||
      unsigned Reg = P->getReg();
 | 
					      unsigned Reg = P->getReg();
 | 
				
			||||||
@@ -297,14 +297,14 @@ static void AntiDepEdges(SUnit *SU, std::vector<SDep*>& Edges) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
 | 
					/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
 | 
				
			||||||
/// critical path.
 | 
					/// critical path.
 | 
				
			||||||
static SUnit *CriticalPathStep(SUnit *SU) {
 | 
					static const SUnit *CriticalPathStep(const SUnit *SU) {
 | 
				
			||||||
  SDep *Next = 0;
 | 
					  const SDep *Next = 0;
 | 
				
			||||||
  unsigned NextDepth = 0;
 | 
					  unsigned NextDepth = 0;
 | 
				
			||||||
  // Find the predecessor edge with the greatest depth.
 | 
					  // Find the predecessor edge with the greatest depth.
 | 
				
			||||||
  if (SU != 0) {
 | 
					  if (SU != 0) {
 | 
				
			||||||
    for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
					    for (SUnit::const_pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
				
			||||||
         P != PE; ++P) {
 | 
					         P != PE; ++P) {
 | 
				
			||||||
      SUnit *PredSU = P->getSUnit();
 | 
					      const SUnit *PredSU = P->getSUnit();
 | 
				
			||||||
      unsigned PredLatency = P->getLatency();
 | 
					      unsigned PredLatency = P->getLatency();
 | 
				
			||||||
      unsigned PredTotalLatency = PredSU->getDepth() + PredLatency;
 | 
					      unsigned PredTotalLatency = PredSU->getDepth() + PredLatency;
 | 
				
			||||||
      // In the case of a latency tie, prefer an anti-dependency edge over
 | 
					      // In the case of a latency tie, prefer an anti-dependency edge over
 | 
				
			||||||
@@ -703,9 +703,9 @@ bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters(
 | 
				
			|||||||
/// ScheduleDAG and break them by renaming registers.
 | 
					/// ScheduleDAG and break them by renaming registers.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
					unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			||||||
                              std::vector<SUnit>& SUnits,
 | 
					                              const std::vector<SUnit>& SUnits,
 | 
				
			||||||
                              MachineBasicBlock::iterator& Begin,
 | 
					                              MachineBasicBlock::iterator Begin,
 | 
				
			||||||
                              MachineBasicBlock::iterator& End,
 | 
					                              MachineBasicBlock::iterator End,
 | 
				
			||||||
                              unsigned InsertPosIndex) {
 | 
					                              unsigned InsertPosIndex) {
 | 
				
			||||||
  unsigned *KillIndices = State->GetKillIndices();
 | 
					  unsigned *KillIndices = State->GetKillIndices();
 | 
				
			||||||
  unsigned *DefIndices = State->GetDefIndices();
 | 
					  unsigned *DefIndices = State->GetDefIndices();
 | 
				
			||||||
@@ -720,20 +720,21 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			|||||||
  RenameOrderType RenameOrder;
 | 
					  RenameOrderType RenameOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // ...need a map from MI to SUnit.
 | 
					  // ...need a map from MI to SUnit.
 | 
				
			||||||
  std::map<MachineInstr *, SUnit *> MISUnitMap;
 | 
					  std::map<MachineInstr *, const SUnit *> MISUnitMap;
 | 
				
			||||||
  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
					  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
				
			||||||
    SUnit *SU = &SUnits[i];
 | 
					    const SUnit *SU = &SUnits[i];
 | 
				
			||||||
    MISUnitMap.insert(std::pair<MachineInstr *, SUnit *>(SU->getInstr(), SU));
 | 
					    MISUnitMap.insert(std::pair<MachineInstr *, const SUnit *>(SU->getInstr(),
 | 
				
			||||||
 | 
					                                                               SU));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Track progress along the critical path through the SUnit graph as
 | 
					  // Track progress along the critical path through the SUnit graph as
 | 
				
			||||||
  // we walk the instructions. This is needed for regclasses that only
 | 
					  // we walk the instructions. This is needed for regclasses that only
 | 
				
			||||||
  // break critical-path anti-dependencies.
 | 
					  // break critical-path anti-dependencies.
 | 
				
			||||||
  SUnit *CriticalPathSU = 0;
 | 
					  const SUnit *CriticalPathSU = 0;
 | 
				
			||||||
  MachineInstr *CriticalPathMI = 0;
 | 
					  MachineInstr *CriticalPathMI = 0;
 | 
				
			||||||
  if (CriticalPathSet.any()) {
 | 
					  if (CriticalPathSet.any()) {
 | 
				
			||||||
    for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
					    for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
				
			||||||
      SUnit *SU = &SUnits[i];
 | 
					      const SUnit *SU = &SUnits[i];
 | 
				
			||||||
      if (!CriticalPathSU ||
 | 
					      if (!CriticalPathSU ||
 | 
				
			||||||
          ((SU->getDepth() + SU->Latency) >
 | 
					          ((SU->getDepth() + SU->Latency) >
 | 
				
			||||||
           (CriticalPathSU->getDepth() + CriticalPathSU->Latency))) {
 | 
					           (CriticalPathSU->getDepth() + CriticalPathSU->Latency))) {
 | 
				
			||||||
@@ -774,8 +775,8 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // The dependence edges that represent anti- and output-
 | 
					    // The dependence edges that represent anti- and output-
 | 
				
			||||||
    // dependencies that are candidates for breaking.
 | 
					    // dependencies that are candidates for breaking.
 | 
				
			||||||
    std::vector<SDep*> Edges;
 | 
					    std::vector<const SDep *> Edges;
 | 
				
			||||||
    SUnit *PathSU = MISUnitMap[MI];
 | 
					    const SUnit *PathSU = MISUnitMap[MI];
 | 
				
			||||||
    AntiDepEdges(PathSU, Edges);
 | 
					    AntiDepEdges(PathSU, Edges);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // If MI is not on the critical path, then we don't rename
 | 
					    // If MI is not on the critical path, then we don't rename
 | 
				
			||||||
@@ -793,7 +794,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			|||||||
    if (!MI->isKill()) {
 | 
					    if (!MI->isKill()) {
 | 
				
			||||||
      // Attempt to break each anti-dependency...
 | 
					      // Attempt to break each anti-dependency...
 | 
				
			||||||
      for (unsigned i = 0, e = Edges.size(); i != e; ++i) {
 | 
					      for (unsigned i = 0, e = Edges.size(); i != e; ++i) {
 | 
				
			||||||
        SDep *Edge = Edges[i];
 | 
					        const SDep *Edge = Edges[i];
 | 
				
			||||||
        SUnit *NextSU = Edge->getSUnit();
 | 
					        SUnit *NextSU = Edge->getSUnit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((Edge->getKind() != SDep::Anti) &&
 | 
					        if ((Edge->getKind() != SDep::Anti) &&
 | 
				
			||||||
@@ -837,7 +838,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			|||||||
          // Also, if there are dependencies on other SUnits with the
 | 
					          // Also, if there are dependencies on other SUnits with the
 | 
				
			||||||
          // same register as the anti-dependency, don't attempt to
 | 
					          // same register as the anti-dependency, don't attempt to
 | 
				
			||||||
          // break it.
 | 
					          // break it.
 | 
				
			||||||
          for (SUnit::pred_iterator P = PathSU->Preds.begin(),
 | 
					          for (SUnit::const_pred_iterator P = PathSU->Preds.begin(),
 | 
				
			||||||
                 PE = PathSU->Preds.end(); P != PE; ++P) {
 | 
					                 PE = PathSU->Preds.end(); P != PE; ++P) {
 | 
				
			||||||
            if (P->getSUnit() == NextSU ?
 | 
					            if (P->getSUnit() == NextSU ?
 | 
				
			||||||
                (P->getKind() != SDep::Anti || P->getReg() != AntiDepReg) :
 | 
					                (P->getKind() != SDep::Anti || P->getReg() != AntiDepReg) :
 | 
				
			||||||
@@ -846,7 +847,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
 | 
				
			|||||||
              break;
 | 
					              break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          for (SUnit::pred_iterator P = PathSU->Preds.begin(),
 | 
					          for (SUnit::const_pred_iterator P = PathSU->Preds.begin(),
 | 
				
			||||||
                 PE = PathSU->Preds.end(); P != PE; ++P) {
 | 
					                 PE = PathSU->Preds.end(); P != PE; ++P) {
 | 
				
			||||||
            if ((P->getSUnit() == NextSU) && (P->getKind() != SDep::Anti) &&
 | 
					            if ((P->getSUnit() == NextSU) && (P->getKind() != SDep::Anti) &&
 | 
				
			||||||
                (P->getKind() != SDep::Output)) {
 | 
					                (P->getKind() != SDep::Output)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,9 +142,9 @@ namespace llvm {
 | 
				
			|||||||
    /// path
 | 
					    /// path
 | 
				
			||||||
    /// of the ScheduleDAG and break them by renaming registers.
 | 
					    /// of the ScheduleDAG and break them by renaming registers.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
					    unsigned BreakAntiDependencies(const std::vector<SUnit>& SUnits,
 | 
				
			||||||
                                   MachineBasicBlock::iterator& Begin,
 | 
					                                   MachineBasicBlock::iterator Begin,
 | 
				
			||||||
                                   MachineBasicBlock::iterator& End,
 | 
					                                   MachineBasicBlock::iterator End,
 | 
				
			||||||
                                   unsigned InsertPosIndex);
 | 
					                                   unsigned InsertPosIndex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Observe - Update liveness information to account for the current
 | 
					    /// Observe - Update liveness information to account for the current
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,9 +39,9 @@ public:
 | 
				
			|||||||
  /// basic-block region and break them by renaming registers. Return
 | 
					  /// basic-block region and break them by renaming registers. Return
 | 
				
			||||||
  /// the number of anti-dependencies broken.
 | 
					  /// the number of anti-dependencies broken.
 | 
				
			||||||
  ///
 | 
					  ///
 | 
				
			||||||
  virtual unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
					  virtual unsigned BreakAntiDependencies(const std::vector<SUnit>& SUnits,
 | 
				
			||||||
                                MachineBasicBlock::iterator& Begin,
 | 
					                                MachineBasicBlock::iterator Begin,
 | 
				
			||||||
                                MachineBasicBlock::iterator& End,
 | 
					                                MachineBasicBlock::iterator End,
 | 
				
			||||||
                                unsigned InsertPosIndex) =0;
 | 
					                                unsigned InsertPosIndex) =0;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  /// Observe - Update liveness information to account for the current
 | 
					  /// Observe - Update liveness information to account for the current
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -143,13 +143,13 @@ void CriticalAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
 | 
					/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
 | 
				
			||||||
/// critical path.
 | 
					/// critical path.
 | 
				
			||||||
static SDep *CriticalPathStep(SUnit *SU) {
 | 
					static const SDep *CriticalPathStep(const SUnit *SU) {
 | 
				
			||||||
  SDep *Next = 0;
 | 
					  const SDep *Next = 0;
 | 
				
			||||||
  unsigned NextDepth = 0;
 | 
					  unsigned NextDepth = 0;
 | 
				
			||||||
  // Find the predecessor edge with the greatest depth.
 | 
					  // Find the predecessor edge with the greatest depth.
 | 
				
			||||||
  for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
					  for (SUnit::const_pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
 | 
				
			||||||
       P != PE; ++P) {
 | 
					       P != PE; ++P) {
 | 
				
			||||||
    SUnit *PredSU = P->getSUnit();
 | 
					    const SUnit *PredSU = P->getSUnit();
 | 
				
			||||||
    unsigned PredLatency = P->getLatency();
 | 
					    unsigned PredLatency = P->getLatency();
 | 
				
			||||||
    unsigned PredTotalLatency = PredSU->getDepth() + PredLatency;
 | 
					    unsigned PredTotalLatency = PredSU->getDepth() + PredLatency;
 | 
				
			||||||
    // In the case of a latency tie, prefer an anti-dependency edge over
 | 
					    // In the case of a latency tie, prefer an anti-dependency edge over
 | 
				
			||||||
@@ -326,18 +326,18 @@ CriticalAntiDepBreaker::findSuitableFreeRegister(MachineInstr *MI,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned CriticalAntiDepBreaker::
 | 
					unsigned CriticalAntiDepBreaker::
 | 
				
			||||||
BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
					BreakAntiDependencies(const std::vector<SUnit>& SUnits,
 | 
				
			||||||
                      MachineBasicBlock::iterator& Begin,
 | 
					                      MachineBasicBlock::iterator Begin,
 | 
				
			||||||
                      MachineBasicBlock::iterator& End,
 | 
					                      MachineBasicBlock::iterator End,
 | 
				
			||||||
                      unsigned InsertPosIndex) {
 | 
					                      unsigned InsertPosIndex) {
 | 
				
			||||||
  // The code below assumes that there is at least one instruction,
 | 
					  // The code below assumes that there is at least one instruction,
 | 
				
			||||||
  // so just duck out immediately if the block is empty.
 | 
					  // so just duck out immediately if the block is empty.
 | 
				
			||||||
  if (SUnits.empty()) return 0;
 | 
					  if (SUnits.empty()) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Find the node at the bottom of the critical path.
 | 
					  // Find the node at the bottom of the critical path.
 | 
				
			||||||
  SUnit *Max = 0;
 | 
					  const SUnit *Max = 0;
 | 
				
			||||||
  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
					  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
 | 
				
			||||||
    SUnit *SU = &SUnits[i];
 | 
					    const SUnit *SU = &SUnits[i];
 | 
				
			||||||
    if (!Max || SU->getDepth() + SU->Latency > Max->getDepth() + Max->Latency)
 | 
					    if (!Max || SU->getDepth() + SU->Latency > Max->getDepth() + Max->Latency)
 | 
				
			||||||
      Max = SU;
 | 
					      Max = SU;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -357,7 +357,7 @@ BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Track progress along the critical path through the SUnit graph as we walk
 | 
					  // Track progress along the critical path through the SUnit graph as we walk
 | 
				
			||||||
  // the instructions.
 | 
					  // the instructions.
 | 
				
			||||||
  SUnit *CriticalPathSU = Max;
 | 
					  const SUnit *CriticalPathSU = Max;
 | 
				
			||||||
  MachineInstr *CriticalPathMI = CriticalPathSU->getInstr();
 | 
					  MachineInstr *CriticalPathMI = CriticalPathSU->getInstr();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Consider this pattern:
 | 
					  // Consider this pattern:
 | 
				
			||||||
@@ -429,8 +429,8 @@ BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
				
			|||||||
    // the anti-dependencies in an instruction in order to be effective.
 | 
					    // the anti-dependencies in an instruction in order to be effective.
 | 
				
			||||||
    unsigned AntiDepReg = 0;
 | 
					    unsigned AntiDepReg = 0;
 | 
				
			||||||
    if (MI == CriticalPathMI) {
 | 
					    if (MI == CriticalPathMI) {
 | 
				
			||||||
      if (SDep *Edge = CriticalPathStep(CriticalPathSU)) {
 | 
					      if (const SDep *Edge = CriticalPathStep(CriticalPathSU)) {
 | 
				
			||||||
        SUnit *NextSU = Edge->getSUnit();
 | 
					        const SUnit *NextSU = Edge->getSUnit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Only consider anti-dependence edges.
 | 
					        // Only consider anti-dependence edges.
 | 
				
			||||||
        if (Edge->getKind() == SDep::Anti) {
 | 
					        if (Edge->getKind() == SDep::Anti) {
 | 
				
			||||||
@@ -452,7 +452,7 @@ BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
				
			|||||||
            // Also, if there are dependencies on other SUnits with the
 | 
					            // Also, if there are dependencies on other SUnits with the
 | 
				
			||||||
            // same register as the anti-dependency, don't attempt to
 | 
					            // same register as the anti-dependency, don't attempt to
 | 
				
			||||||
            // break it.
 | 
					            // break it.
 | 
				
			||||||
            for (SUnit::pred_iterator P = CriticalPathSU->Preds.begin(),
 | 
					            for (SUnit::const_pred_iterator P = CriticalPathSU->Preds.begin(),
 | 
				
			||||||
                 PE = CriticalPathSU->Preds.end(); P != PE; ++P)
 | 
					                 PE = CriticalPathSU->Preds.end(); P != PE; ++P)
 | 
				
			||||||
              if (P->getSUnit() == NextSU ?
 | 
					              if (P->getSUnit() == NextSU ?
 | 
				
			||||||
                    (P->getKind() != SDep::Anti || P->getReg() != AntiDepReg) :
 | 
					                    (P->getKind() != SDep::Anti || P->getReg() != AntiDepReg) :
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,9 +72,9 @@ namespace llvm {
 | 
				
			|||||||
    /// path
 | 
					    /// path
 | 
				
			||||||
    /// of the ScheduleDAG and break them by renaming registers.
 | 
					    /// of the ScheduleDAG and break them by renaming registers.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
 | 
					    unsigned BreakAntiDependencies(const std::vector<SUnit>& SUnits,
 | 
				
			||||||
                                   MachineBasicBlock::iterator& Begin,
 | 
					                                   MachineBasicBlock::iterator Begin,
 | 
				
			||||||
                                   MachineBasicBlock::iterator& End,
 | 
					                                   MachineBasicBlock::iterator End,
 | 
				
			||||||
                                   unsigned InsertPosIndex);
 | 
					                                   unsigned InsertPosIndex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Observe - Update liveness information to account for the current
 | 
					    /// Observe - Update liveness information to account for the current
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user