[PATCH] D86836: Support a list of CostPerUse values

Christudasan Devadasan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 03:12:31 PDT 2020


cdevadas added inline comments.


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:790
   // Try to evict interference from a cheaper alternative.
-  unsigned Cost = TRI->getCostPerUse(PhysReg);
+  unsigned Cost = RegCosts[PhysReg];
 
----------------
madhur13490 wrote:
> There is an implicit upcast happening here from `uint8_t` to `unsigned`. This may lead to unexpected behavior on different platform, I'd recommend to be consistent unless absolutely necessary to use `unsigned`.
Will change such instances to uint8_t.


================
Comment at: llvm/utils/TableGen/CodeGenRegisters.h:154
     unsigned EnumValue;
-    unsigned CostPerUse;
+    std::vector<int64_t> CostPerUse;
     bool CoveredBySubRegs;
----------------
madhur13490 wrote:
> Is there any specific reason to use `int64_t` type for `CostPerUse`?
`getValueAsListOfInts` works only with int64_t type.


================
Comment at: llvm/utils/TableGen/RegisterInfoEmitter.cpp:1460
+  std::vector<bool> InAllocClass;
+  RegCosts.insert(RegCosts.end(), NumRegCosts, 0);
+  InAllocClass.push_back(false);
----------------
madhur13490 wrote:
> What is the purpose of this extra block of 0s at the beginning?
 It is for NoRegister which is the first entry in the generated register list


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86836



More information about the llvm-commits mailing list