[PATCH] D61432: Non-8-bit bytes showcase

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 05:12:16 PDT 2019


JesperAntonsson marked 2 inline comments as done.
JesperAntonsson added inline comments.


================
Comment at: include/llvm/IR/DataLayout.h:421
   unsigned getPointerTypeSize(Type *Ty) const {
-    return getPointerTypeSizeInBits(Ty) / 8;
+    return getPointerTypeSizeInBits(Ty) / BitsPerByte;
   }
----------------
probinson wrote:
> riccibruno wrote:
> > That's an expensive division...
> Maybe derive a pointer-type-size-in-bytes calculated in the ctor.
> Or, as a more generic solution, derive shift/mask values from bits-per-byte, so the refactoring can replace multiply/divide with shifts.  Or maybe with bitsToBytes and bytesToBits helper methods.
Yes, or we could perhaps make this a static constant in DataLayout and, for now, leave it to downstream target to make it a variable.


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

https://reviews.llvm.org/D61432





More information about the llvm-commits mailing list