[PATCH] D50977: [TableGen] Prefer user-defined subregister compositions over inferred ones

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 26 12:28:02 PDT 2018


kparzysz added a comment.

Right at the beginning of CodeGenRegBank::computeComposites, I added

    // The map being the result of applying a subregister to registers.
    using SubRegApp = std::map<const CodeGenRegister*, const CodeGenRegister*>;
  
    std::map<const CodeGenSubRegIndex*, SubRegApp> SubRegImages;
    for (const CodeGenRegister &R : Registers) {
      const CodeGenRegister::SubRegMap &SM = R.getSubRegs();
      for (std::pair<const CodeGenSubRegIndex*, const CodeGenRegister*> P : SM)
        SubRegImages[P.first].insert({&R, P.second});
    }
  
    // The equivalence map of subregisters.
    std::map<SubRegApp, std::set<const CodeGenSubRegIndex*>> SubRegEq;
    for (std::pair<const CodeGenSubRegIndex*, const SubRegApp&> P : SubRegImages)
      SubRegEq[P.second].insert(P.first);
  
    for (auto &I : SubRegEq) {
  //    if (I.second.size() <= 1)
  //      continue;
  //    dbgs() << "Equivalent subregs:";
  //    for (const CodeGenSubRegIndex *S : I.second)
  //      dbgs() << ' ' << S->getName();
  //    dbgs() << "\n                  {";
  for (const CodeGenSubRegIndex *S : I.second) dbgs() << S->getName() << ": {";
      for (std::pair<const CodeGenRegister*, const CodeGenRegister*> P : I.first)
        dbgs() << ' ' << P.first->getName() << "->" << P.second->getName();
      dbgs() << " }\n";
    }

I was originally trying to calculate the sets of equivalent subregisters, but they all ended up unique (i.e. the sets all had only one element).


Repository:
  rL LLVM

https://reviews.llvm.org/D50977





More information about the llvm-commits mailing list