[PATCH] D106351: [CostModel] Templatize EntryCost::Cost to allow custom cost metrics

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 04:41:08 PDT 2021


dmgreen added a comment.

Sounds useful. My C++ templates are not super strong (for someone who works on compilers) but could it use:

  template <typename CostType = unsigned> struct CostTblEntry

It looks like that might be a C++17 thing, to make it clean though.



================
Comment at: llvm/include/llvm/CodeGen/CostTable.h:36
+CostTableLookup(ArrayRef<CostTblEntryT<CostType>> Tbl, int ISD, MVT Ty) {
   auto I = find_if(Tbl, [=](const CostTblEntry &Entry) {
     return ISD == Entry.ISD && Ty == Entry.Type;
----------------
CostTblEntry  -> CostTblEntryT<CostType>?


================
Comment at: llvm/include/llvm/CodeGen/CostTable.h:47
+template <size_t N, class CostType>
+inline const CostTblEntry *
+CostTableLookup(const llvm::CostTblEntryT<CostType> (&Table)[N], int ISD,
----------------
CostTblEntry  -> CostTblEntryT<CostType>?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106351



More information about the llvm-commits mailing list