[llvm-dev] Basic block alignment

y liu via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 14 01:33:09 PDT 2020


Hi, I want to control the program to keep the basic block 32 bytes aligned.
So, I use "-align-all-blocks=5" option
>>>
>>>clang -o simple simple.c -mllvm -align-all-blocks=5
>>>
I checked the assembly code generated in the middle and found that a small
portion of the code was not aligned.

So, I want to do it myself. Specifically, the following requirements should
be met:

1) The program is aligned at the assembly layer in basic blocks of 32 bytes;
2) All control flow transfer instructions must be the end of a block.
3) For some reason, some instructions cannot be the beginning of a block,
so I have to insert some nops.

What should I do in the LLVM IR level in order for the program to meet the
above requirements in the assembly level?
Can you give me some advice on this?
Please help me!
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200414/42869d51/attachment.html>


More information about the llvm-dev mailing list