[PATCH] D71693: [NFC][PowerPC] Add a function tryAndWithMask

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 09:40:06 PST 2020


nemanjai added a comment.

I think this refactoring doesn't really do anything to simplify the code or make it more readable. It just takes fairly complex logic and moves it into a separate function. Then subsequent patches will add even further complexity to this function. Overall, there isn't much of a gain from the refactoring.
What I think would make sense is to simplify the `tryAndWithMask()` to something conceptually similar to the following:

  tryAndWithMask(...) {
    if (canBeCodeGenedAsSingleRLWINM())
      return produceRLWINMSDNode();
    if (canBeCodeGenedAsSingleRLWIMI())
      return produceRLWIMISDNode();
    if (canBeCodeGenedAsSingleRLDICL())
      return produceRLDICLSDNode();
    if (canBeCodeGenedAsPairOfRLDICL())
      return produceRLDICLPairSDNode();
    ...
    return SDValue();

Then the top level function would call this function to create an `SDValue` and return it if it is non-empty or break out of the switch if it is empty.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71693/new/

https://reviews.llvm.org/D71693





More information about the llvm-commits mailing list