[PATCH] D128182: [NFC] Switch FloatModeKind enum class to use bitmask enums

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 12:44:49 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM again, this time for real.



================
Comment at: clang/include/clang/Basic/TargetInfo.h:225-226
   unsigned HasAlignMac68kSupport : 1;
-  unsigned RealTypeUsesObjCFPRetMask : (int)FloatModeKind::Last + 1;
+  unsigned RealTypeUsesObjCFPRetMask
+      : (int)FloatModeKind::LLVM_BITMASK_LARGEST_ENUMERATOR;
   unsigned ComplexLongDoubleUsesFP2Ret : 1;
----------------
jolanta.jensen wrote:
> aaron.ballman wrote:
> > Whoops, I missed this (thanks @shafik for asking me about it in private)!
> > 
> > I believe the original code was setting the field width to be `1 << 5` bits wide instead of specifying it as being 6 bits wide.
> Oh dear, I was to replace log2 with bitWidth and I only did half the job. Thanks for spotting!
Yeah, it was a great catch -- the code would have worked, but been space inefficient, which likely would have been a head scratcher for somebody later wondering why the code was written that way. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128182



More information about the cfe-commits mailing list