[llvm-dev] Modify how llvm backend aligned

郑晗 via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 10 03:36:50 PDT 2020


Hi:
    I'm trying to implement something similar to sandbox(Software fault isolation).I put the protect instruction 
and danger instruction(such as call) in a basicblock and use the MachineBasicBlock::setAlignment to align it 
to 32B.The results is the picture above.but i'm wondering if it's possible to insert the no-op before the call 
instruction like the picture below.
    0B                                                                              32B
    | some protect instruction  |  call instruction | no-ops |
    | some protect instruction  | no-ops  | call instruction |
    So is it possible to modify llvm's X86 backend to set the layout like this?(I guess google's native client achieve
this goal, but i can't find any document.) I know there is no pass in MC layer, i just want to know if i modify 
the source code, can i achieve this goal?
    The second question, does function EmitNops in 'llvm/lib/Target/X86/MCInstLower' insert all no-ops to the binary?
if not, which function does?
    Thanks for your help.
    Regards,
    zheng han
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200810/5888ab5e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alignment.png
Type: image/png
Size: 19450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200810/5888ab5e/attachment.png>


More information about the llvm-dev mailing list