Emit 4-byte-displacement jump instructions instead of short one-byte-displacement jump instructions, when generating machine code, under x86_64

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Emit 4-byte-displacement jump instructions instead of short one-byte-displacement jump instructions, when generating machine code, under x86_64

Yue Chen-2
Dear all,

We are working on a research project based on LLVM. I wonder if there is any easy way to make LLVM 
NOT emit short jump instructions with 1-byte-displacement, like "75 30    JNE +30", "eb 1a   JMP +1a", etc; 
instead only emit 4-byte-displacement jump instructions with 3-byte zero paddings, like 
"0f 85 30 00 00 00   JNE +30", "e9 1a 00 00 00    JMPQ +1a", etc., under the x86_64 architecture.
Apparently, this would increase the code size.

Best regards and thanks,
Yue

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Emit 4-byte-displacement jump instructions instead of short one-byte-displacement jump instructions, when generating machine code, under x86_64

Craig Topper
There is an -mc-relax-all command line flag that should do this. It will also use longer forms of some adds, subs, etc. Not sure how to set it from clang, but hopefully this helps point you in the right direction.

On Fri, Mar 13, 2015 at 1:42 PM, Yue Chen <[hidden email]> wrote:
Dear all,

We are working on a research project based on LLVM. I wonder if there is any easy way to make LLVM 
NOT emit short jump instructions with 1-byte-displacement, like "75 30    JNE +30", "eb 1a   JMP +1a", etc; 
instead only emit 4-byte-displacement jump instructions with 3-byte zero paddings, like 
"0f 85 30 00 00 00   JNE +30", "e9 1a 00 00 00    JMPQ +1a", etc., under the x86_64 architecture.
Apparently, this would increase the code size.

Best regards and thanks,
Yue

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




--
~Craig

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev