Page MenuHomePhabricator

[Alignment][NFC] Deprecate getMaxAlignment

Authored by gchatelet on Mar 18 2020, 2:51 AM.



This is patch is part of a series to introduce an Alignment type.
See this thread for context:
See this patch for the introduction of the type:

Diff Detail

Event Timeline

gchatelet created this revision.Mar 18 2020, 2:51 AM
courbet added inline comments.Mar 18 2020, 5:50 AM

why Log2 ?



gchatelet marked 3 inline comments as done.Mar 18 2020, 6:26 AM
gchatelet added inline comments.
  • isInt<N> from documentation Checks if an integer fits into the given bit width.
  • MFI.getMaxAlign() is an Align which by definition is 2^N

So testing if a power of two fits into 16 bits is equivalent to testing if its log2 is less than 16 (the maximum power of 2 fitting in 16 bits is 0b1000000000000000, its log2 is 15)

This is also faster as .value() (in MachineFrameInfo) will generate the value from a shift, where Log2 is a noop.

courbet accepted this revision.Mar 18 2020, 6:43 AM
This revision is now accepted and ready to land.Mar 18 2020, 6:43 AM
This revision was automatically updated to reflect the committed changes.
gchatelet marked an inline comment as done.