mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	[PBQP] Improve the assert for conservatively allocatables.
Remember if the node ever was in this state instead of checking just the final state. Reviewed by Arnaud de Grandmaison. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -190,7 +190,7 @@ namespace PBQP {
 | 
				
			|||||||
      // Although a conservatively allocatable node can be allocated to a register,
 | 
					      // Although a conservatively allocatable node can be allocated to a register,
 | 
				
			||||||
      // spilling it may provide a lower cost solution. Assert here that spilling
 | 
					      // spilling it may provide a lower cost solution. Assert here that spilling
 | 
				
			||||||
      // is done by choice, not because there were no register available.
 | 
					      // is done by choice, not because there were no register available.
 | 
				
			||||||
      if (G.getNodeMetadata(NId).isConservativelyAllocatable())
 | 
					      if (G.getNodeMetadata(NId).wasConservativelyAllocatable())
 | 
				
			||||||
        assert(hasRegisterOptions(v) && "A conservatively allocatable node "
 | 
					        assert(hasRegisterOptions(v) && "A conservatively allocatable node "
 | 
				
			||||||
                                        "must have available register options");
 | 
					                                        "must have available register options");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -192,7 +192,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  NodeMetadata()
 | 
					  NodeMetadata()
 | 
				
			||||||
    : RS(Unprocessed), NumOpts(0), DeniedOpts(0), OptUnsafeEdges(nullptr),
 | 
					    : RS(Unprocessed), NumOpts(0), DeniedOpts(0), OptUnsafeEdges(nullptr),
 | 
				
			||||||
      VReg(0) {}
 | 
					      VReg(0), everConservativelyAllocatable(false) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // FIXME: Re-implementing default behavior to work around MSVC. Remove once
 | 
					  // FIXME: Re-implementing default behavior to work around MSVC. Remove once
 | 
				
			||||||
  // MSVC synthesizes move constructors properly.
 | 
					  // MSVC synthesizes move constructors properly.
 | 
				
			||||||
@@ -256,8 +256,14 @@ public:
 | 
				
			|||||||
  void setReductionState(ReductionState RS) {
 | 
					  void setReductionState(ReductionState RS) {
 | 
				
			||||||
    assert(RS >= this->RS && "A node's reduction state can not be downgraded");
 | 
					    assert(RS >= this->RS && "A node's reduction state can not be downgraded");
 | 
				
			||||||
    this->RS = RS;
 | 
					    this->RS = RS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Remember this state to assert later that a non-infinite register
 | 
				
			||||||
 | 
					    // option was available.
 | 
				
			||||||
 | 
					    if (RS == ConservativelyAllocatable)
 | 
				
			||||||
 | 
					      everConservativelyAllocatable = true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void handleAddEdge(const MatrixMetadata& MD, bool Transpose) {
 | 
					  void handleAddEdge(const MatrixMetadata& MD, bool Transpose) {
 | 
				
			||||||
    DeniedOpts += Transpose ? MD.getWorstRow() : MD.getWorstCol();
 | 
					    DeniedOpts += Transpose ? MD.getWorstRow() : MD.getWorstCol();
 | 
				
			||||||
    const bool* UnsafeOpts =
 | 
					    const bool* UnsafeOpts =
 | 
				
			||||||
@@ -280,6 +286,10 @@ public:
 | 
				
			|||||||
       &OptUnsafeEdges[NumOpts]);
 | 
					       &OptUnsafeEdges[NumOpts]);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bool wasConservativelyAllocatable() const {
 | 
				
			||||||
 | 
					    return everConservativelyAllocatable;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  ReductionState RS;
 | 
					  ReductionState RS;
 | 
				
			||||||
  unsigned NumOpts;
 | 
					  unsigned NumOpts;
 | 
				
			||||||
@@ -287,6 +297,7 @@ private:
 | 
				
			|||||||
  std::unique_ptr<unsigned[]> OptUnsafeEdges;
 | 
					  std::unique_ptr<unsigned[]> OptUnsafeEdges;
 | 
				
			||||||
  unsigned VReg;
 | 
					  unsigned VReg;
 | 
				
			||||||
  GraphMetadata::AllowedRegVecRef AllowedRegs;
 | 
					  GraphMetadata::AllowedRegVecRef AllowedRegs;
 | 
				
			||||||
 | 
					  bool everConservativelyAllocatable;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RegAllocSolverImpl {
 | 
					class RegAllocSolverImpl {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user