[PATCH] D152843: Switch magic numbers to library functions in fixup

Daniel Hoekwater via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 18:04:03 PDT 2023


dhoekwater updated this revision to Diff 532343.
dhoekwater added a comment.

Fixed the `isShiftedUInt()` issue that changed behavior.

Replaced `alignTo<4>` stuff with `isAligned(Align{4}, x)`. That's a neat utility function I didn't know existed.

I also don't love how verbose `maskTrailingOnes<uint64_t>(n)` is. I do personally feel like anything that
directly indicates the number of bits we're taking is better than a magic number mask, but I also haven't
developed the trained eye that tells me "0x1FFFFF is 21 bits" at a glance. Is there a more terse helper
function to express "get the low n bits of this number"? Ideally, we'd have something that clearly communicates
the meaning of something like  `n & 0x3`, `(n & 0x1ffffc) >> 2`, or `(n & 0x1fffff000ULL) >> 12`. If not,
I'll just revert the masking changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152843

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152843.532343.patch
Type: text/x-patch
Size: 5777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230617/97465177/attachment-0001.bin>


More information about the llvm-commits mailing list