[PATCH] [MC] bundle alignment: prevent padding instructions from crossing bundle boundaries
Eli Bendersky
eliben at google.com
Wed Jan 30 14:47:34 PST 2013
+ // If bundling is enabled, fragments will be < 4G
Moreover, fragment size is asserted to be smaller than bundle size
when laying out, so I don't think this comment is necessary.
+ unsigned TotalLength = static_cast<unsigned>(FragmentSize) + BundlePadding;
+ if (F.alignToBundleEnd() && TotalLength > Asm.getBundleAlignSize()) {
+ // If the padding itself crosses a bundle boundary, it must be emitted
+ // in 2 pieces, since even nop instructions must not cross boundaries.
+ unsigned DistanceToBoundary = TotalLength - Asm.getBundleAlignSize();
Are you sure it shouldn't be: Asm.getBundleAlignSize() - FragmentSize ?
+ if (!Asm.getBackend().writeNopData(DistanceToBoundary, OW))
+ report_fatal_error("unable to write NOP sequence of " +
+ Twine(DistanceToBoundary) + " bytes");
+ BundlePadding -= DistanceToBoundary;
+ }
On Wed, Jan 30, 2013 at 2:21 PM, Derek Schuff <dschuff at google.com> wrote:
> When bundle alignment is enabled, and a fragment is to be aligned to the end
> of a bundle and it is too large to fit in the current bundle, it must be
> pushed all the way to the end of the next bundle. However if a single long
> nop instruction is used, it cannot cross the bundle boundary itself. So, in
> this case, emit the padding in 2 pieces: one piece goes to the end of the
> current bundle, and the other piece goes from there to where the fragment
> starts.
>
>
More information about the llvm-commits
mailing list