[PATCH] D70157: Align branches within 32-Byte boundary

Fedor Sergeev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 08:52:05 PST 2019


fedor.sergeev added a comment.

In D70157#1775016 <https://reviews.llvm.org/D70157#1775016>, @annita.zhang wrote:

> > The point is that we have explicit requirement at the start and we have a lowering into 16-byte sequence that we need to be preserved exactly as it is.
> >  Essentially what we need is  a "protection" for this sequence from any changes by machinery that generates the binary code.
> >  How can we protect a particular byte sequence from being changed by this branch aligner?
>
> No, in general we can't. The current solution is based on assembler to insert prefix or nop before the cross (or against) boundary branches. It can only ensure the explicit alignment specified by directive, but not any implicit alignment. I don't think any fixup based on assembler can do it. On the other hand, any code sequence after the alignment directive or even just in a function has some kind of implicit alignment. It's hard for assembler to tell which implicit alignment to preserve. The preferred way is to use explicit alignment directive to specify it.
>
> For your scenario, a NOP padding is more controllable. NOP padding will be inserted just before the branch instructions (or macro fusion branch instructions). So if there's no branches (or macro fusion branches) in your code sequence, there will be no NOP inserted.


What if I insert explicit align(8) right *after* the sequence?


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

https://reviews.llvm.org/D70157





More information about the cfe-commits mailing list