<div dir="ltr"><br>
</div><div dir="ltr">Hello,<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">I want to make some changes to RISCV64’s frame, especially when accessing stack objects, due to a hardware issue. But I need help.<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">For example, the following C code<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">void foo(int a, int b, int num) {<br>
</div><div dir="ltr"> int arr0[8] = {…}; // This is a fixed size array on RISCV64 stack<br>
</div><div dir="ltr"> int arr1[num]; // This is a variable size array on RISCV64 stack<br>
</div><div dir="ltr"> arr0[a] = b;<br>
</div><div dir="ltr"> arr1[a] = b;<br>
</div><div dir="ltr"> ……<br>
</div><div dir="ltr">}<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">For both ` arr0[a] = b` and `arr1[a] = b`, two SW instructions are generated. And I would like to insert an ADDI (via BuildMI) before each SW, due to a HW issue !!!<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">Actually I have found solution for the fixed size array, that is writing a BuildMI() inside RISCVRegisterInfo::eliminateFrameIndex() of RISCVRegisterInfo.cpp,<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">However I do not know how the insert the ADDI for the variable size array. Where should I insert the BuildMI (ADDI)?<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">It seems the SW for the variable size array does not run into RISCVRegisterInfo::eliminateFrameIndex()<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">I really appreciate if anybody help me. Thanks.<br>
</div><div dir="ltr"> <br>
</div><div dir="ltr">Ben Shi<br>
</div>