[clang] [AArch64]: Refactor target parser to use BitVector. (PR #65423)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 11:22:49 PDT 2023


================
@@ -69,6 +70,24 @@ std::string FormatExtensionFlags(uint64_t Flags) {
   return llvm::join(Features, ", ");
 }
 
+std::string SerializeExtensionFlags(Bitset<AArch64::AEK_EXTENTIONS_MAX> Flags) {
+  std::string SerializedFlags;
+  int HexaValue = 0;
+  for(unsigned int i = 0; i < AArch64::AEK_EXTENTIONS_MAX; i ++) {
+    HexaValue <<= 1;
+    HexaValue |= (int)Flags[i];
+    if ((i+1)%4 == 0) {
----------------
topperc wrote:

This assumes AArch64::AEK_EXTENTIONS_MAX is a multiple of 4 so there is no remainder after the loop. Probably should static_assert that.

https://github.com/llvm/llvm-project/pull/65423


More information about the cfe-commits mailing list