[PATCH] D117114: [llvm][ADT] Implement `BitVector(std::initializer_list)`

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 13:34:14 PST 2022


dexonsmith added a reviewer: dblaikie.
dexonsmith added a subscriber: dblaikie.
dexonsmith added a comment.

It might be awkward to add this new ambiguity. I wonder if we really want to copy that from `std::vector<bool>`, which doesn't have a great API for bitsets anyway. @dblaikie, any thoughts?

I'm curious which current users of `std::vector<bool>` (if any) need this. An alternative would be to add a static function with a good name:

  class BitVector {
    static BitVector getBits(std::initializer_list<bool> Values);
  };
  // later:
  BitVector BV = BitVector::getBits({false, true});

Or maybe `getFromInitializerList()` would be more clear.



================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h:419-422
+  SmallBitVector TypeIdxsCovered = SmallBitVector(
+      MCOI::OPERAND_LAST_GENERIC - MCOI::OPERAND_FIRST_GENERIC + 2);
+  SmallBitVector ImmIdxsCovered = SmallBitVector(
+      MCOI::OPERAND_LAST_GENERIC_IMM - MCOI::OPERAND_FIRST_GENERIC_IMM + 2);
----------------
I assume this (and other changes here) are because there's a new constructor ambiguity?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117114



More information about the llvm-commits mailing list