[PATCH] D58520: [Subtarget] Remove static global constructor call from the tablegened subtarget feature tables

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 15:29:18 PST 2019


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: utils/TableGen/SubtargetEmitter.cpp:179
+  OS << "{ { ";
+  for (unsigned i = 0; i != MAX_SUBTARGET_WORDS; ++i) {
+    OS << "0x";
----------------
Perhaps either use Mask.length() as the loop bound (or a range-based for loop) and/or change the parameter to be a reference to an array of MAX_SUBTARGET_WORDS length? (rather than having an implicit contract where you must pass this function an array of that length, but nothing checks that)] & would just walk off the end of the array otherwise)


================
Comment at: utils/TableGen/SubtargetEmitter.cpp:273-277
+    uint64_t FeatureMask[MAX_SUBTARGET_WORDS] = {};
+    for (unsigned j = 0, M = FeatureList.size(); j < M; ++j) {
+      unsigned Bit = FeatureMap.lookup(FeatureList[j]);
+      FeatureMask[Bit / 64] |= 1ULL << (Bit % 64);
     }
----------------
This code looks like the same code over ImpliesMask above? (except for ImpliesMask rather than FeatureList) - perhaps it could be folded into the printFeatureMask function?


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

https://reviews.llvm.org/D58520





More information about the llvm-commits mailing list