You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a certain code generator based on bunny-jit where I often have to make calls to external functions by address. I frequently find myself in the following situation:
This is part of the result of compiling some code that involves a function call with 4 arguments. The first thing that stands out is the pointless loading of the function address into r9 instead of just loading it directly into rax. This happens consistently, and it’s likely related to the fact that the frontend’s Proc::i/d/tcallp takes it as the first argument, and I use Proc::lcu before calling Proc::i/d/tcallp. Afterward, the frontend itself generates opcodes for loading the arguments. Thus, first comes the address, then the arguments, and then the call, which again requires the address.
A similar problem occurs with the arguments themselves: values are constantly being shuffled between registers instead of computations being performed directly in the desired registers to avoid unnecessary mov instructions.
Question
Where can I find the implementation code related to this, the optimization passes, etc.? I’d like to improve this and possibly implement some optimizations if it turns out to be feasible.
The text was updated successfully, but these errors were encountered:
Problem
I have a certain code generator based on
bunny-jit
where I often have to make calls to external functions by address. I frequently find myself in the following situation:This is part of the result of compiling some code that involves a function call with 4 arguments. The first thing that stands out is the pointless loading of the function address into
r9
instead of just loading it directly intorax
. This happens consistently, and it’s likely related to the fact that the frontend’sProc::i/d/tcallp
takes it as the first argument, and I useProc::lcu
before callingProc::i/d/tcallp
. Afterward, the frontend itself generates opcodes for loading the arguments. Thus, first comes the address, then the arguments, and then the call, which again requires the address.A similar problem occurs with the arguments themselves: values are constantly being shuffled between registers instead of computations being performed directly in the desired registers to avoid unnecessary
mov
instructions.Question
Where can I find the implementation code related to this, the optimization passes, etc.? I’d like to improve this and possibly implement some optimizations if it turns out to be feasible.
The text was updated successfully, but these errors were encountered: