[PATCH] D156967: [PoC][SelectionDAG] Upgrade the MatcherTable type from unsigned char to unsigned short

Zixuan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 00:09:00 PDT 2023


zixuan-wu created this revision.
zixuan-wu added reviewers: bogner, craig.topper, kparzysz, Paul-C-Anagnostopoulos.
Herald added subscribers: ctetreau, luismarques, s.egerton, PkmX, simoncook, hiraditya, arichardson.
Herald added a project: All.
zixuan-wu requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

As the pattern predicate number is growing such as following in RISCVGenDAGISel.inc, SelectionDAG MatcherTable type of char is too small to hold num larger than 255 in soon. So upgrade the type from char to short.

Following generated CheckPatternPredicate condition in lib/Target/RISCV/RISCVGenDAGISel.inc

  #ifdef GET_DAGISEL_DECL
  bool CheckPatternPredicate(unsigned PredNo) const override;
  #endif
  #if defined(GET_DAGISEL_BODY) || DAGISEL_INLINE
  bool DAGISEL_CLASS_COLONCOLON CheckPatternPredicate(unsigned PredNo) const
  #if DAGISEL_INLINE
    override
  #endif
  {
    switch (PredNo) {
    default: llvm_unreachable("Invalid predicate in table?");
    case 0: return (Subtarget->hasVendorXSfvcp()) && (Subtarget->is64Bit());
    case 1: return (Subtarget->hasVendorXSfvcp()) && !((Subtarget->is64Bit()));
    case 2: return (Subtarget->is64Bit()) && (Subtarget->is64Bit());
    case 3: return (Subtarget->is64Bit()) && !((Subtarget->is64Bit()));
    case 4: return (Subtarget->hasStdExtZbkb()) && (Subtarget->is64Bit());
    case 5: return (Subtarget->hasStdExtZbkb()) && !((Subtarget->is64Bit()));
  
    case 216: return (Subtarget->hasStdExtD()) && (Subtarget->hasStdExtZfhOrZfhmin());
    case 217: return (Subtarget->hasStdExtZdinx()) && (Subtarget->hasStdExtZhinx() || Subtarget->hasStdExtZhinxmin()) && (!Subtarget->is64Bit());
    case 218: return (Subtarget->hasStdExtZfa());
    case 219: return (Subtarget->hasStdExtD()) && (Subtarget->hasStdExtZfa());
    case 220: return (Subtarget->hasStdExtZfa()) && (Subtarget->hasStdExtZfh());
    case 221: return (Subtarget->hasStdExtD()) && (Subtarget->hasStdExtZfa()) && (!Subtarget->is64Bit()) && (Subtarget->is64Bit());
    case 222: return (Subtarget->hasStdExtD()) && (Subtarget->hasStdExtZfa()) && (!Subtarget->is64Bit()) && !((Subtarget->is64Bit()));
    }
  }
  #endif // GET_DAGISEL_BODY




Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156967

Files:
  llvm/include/llvm/CodeGen/SelectionDAGISel.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  llvm/utils/TableGen/DAGISelMatcherEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156967.546716.patch
Type: text/x-patch
Size: 8119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230803/b5c59784/attachment.bin>


More information about the llvm-commits mailing list