forked from OSchip/llvm-project
				
			Clean the sub-reg index composition maps at emission.
Preserve the Composites map in the CodeGenSubRegIndex class so it can be used to determine which sub-register indices can actually be composed. llvm-svn: 163629
This commit is contained in:
		
							parent
							
								
									21e2f1c6e5
								
							
						
					
					
						commit
						dd40fda52d
					
				| 
						 | 
					@ -75,16 +75,6 @@ void CodeGenSubRegIndex::updateComponents(CodeGenRegBank &RegBank) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CodeGenSubRegIndex::cleanComposites() {
 | 
					 | 
				
			||||||
  // Clean out redundant mappings of the form this+X -> X.
 | 
					 | 
				
			||||||
  for (CompMap::iterator i = Composed.begin(), e = Composed.end(); i != e;) {
 | 
					 | 
				
			||||||
    CompMap::iterator j = i;
 | 
					 | 
				
			||||||
    ++i;
 | 
					 | 
				
			||||||
    if (j->first == j->second)
 | 
					 | 
				
			||||||
      Composed.erase(j);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
//                              CodeGenRegister
 | 
					//                              CodeGenRegister
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
| 
						 | 
					@ -1164,11 +1154,6 @@ void CodeGenRegBank::computeComposites() {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // We don't care about the difference between (Idx1, Idx2) -> Idx2 and invalid
 | 
					 | 
				
			||||||
  // compositions, so remove any mappings of that form.
 | 
					 | 
				
			||||||
  for (unsigned i = 0, e = SubRegIndices.size(); i != e; ++i)
 | 
					 | 
				
			||||||
    SubRegIndices[i]->cleanComposites();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,9 +80,6 @@ namespace llvm {
 | 
				
			||||||
    // Update the composite maps of components specified in 'ComposedOf'.
 | 
					    // Update the composite maps of components specified in 'ComposedOf'.
 | 
				
			||||||
    void updateComponents(CodeGenRegBank&);
 | 
					    void updateComponents(CodeGenRegBank&);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Clean out redundant composite mappings.
 | 
					 | 
				
			||||||
    void cleanComposites();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Return the map of composites.
 | 
					    // Return the map of composites.
 | 
				
			||||||
    const CompMap &getComposites() const { return Composed; }
 | 
					    const CompMap &getComposites() const { return Composed; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1055,8 +1055,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
 | 
				
			||||||
    for (unsigned i = 0, e = SubRegIndices.size(); i != e; ++i) {
 | 
					    for (unsigned i = 0, e = SubRegIndices.size(); i != e; ++i) {
 | 
				
			||||||
      bool Open = false;
 | 
					      bool Open = false;
 | 
				
			||||||
      for (unsigned j = 0; j != e; ++j) {
 | 
					      for (unsigned j = 0; j != e; ++j) {
 | 
				
			||||||
        if (CodeGenSubRegIndex *Comp =
 | 
					        CodeGenSubRegIndex *Comp = SubRegIndices[i]->compose(SubRegIndices[j]);
 | 
				
			||||||
            SubRegIndices[i]->compose(SubRegIndices[j])) {
 | 
					        if (Comp && Comp != SubRegIndices[j]) {
 | 
				
			||||||
          if (!Open) {
 | 
					          if (!Open) {
 | 
				
			||||||
            OS << "  case " << SubRegIndices[i]->getQualifiedName()
 | 
					            OS << "  case " << SubRegIndices[i]->getQualifiedName()
 | 
				
			||||||
              << ": switch(IdxB) {\n    default: return IdxB;\n";
 | 
					              << ": switch(IdxB) {\n    default: return IdxB;\n";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue