<div dir="ltr"><div class="gmail_quote"><span dir="ltr"></span><br><div dir="ltr"><div><div>Hello!<br><br></div>Im trying to build a backend for a 'C' Frontend.<br><br></div>I have a doubt about Stack allocation for variables. Let me explain with the same example <br><br><div style="font-size:18.121px;font-family:monospace">%p = alloca i32, align 4</div><div style="font-size:18.121px;font-family:monospace">store i32 2, i32* %p</div><div style="font-size:18.121px;font-family:monospace">%b = load i32* %p, align 4</div><div style="font-size:18.121px;font-family:monospace">%c = add nsw i32 %a, %b<br> <br></div><div style="font-size:18.121px;font-family:monospace"><font><font face="arial,helvetica,sans-serif">will emit following Machine code<br><br></font></font><br><div style="font-size:13.2833px;font-family:monospace">%SP<def> = SUBri %SP, 4     ; Prologue</div><div style="font-size:13.2833px;font-family:monospace">%R1<def> = MOVLOi16 2</div><div style="font-size:13.2833px;font-family:monospace">STR %R1<kill>, %SP, 0; mem:ST4[%p]</div><div style="font-size:13.2833px;font-family:monospace">%R0<def> = ADDri %R0<kill>, 2</div><div style="font-size:13.2833px;font-family:monospace">%SP<def> = ADDri %SP, 4     ; Epilogue<br><br></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif"> <br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif">Here, "p" is allocated on a STACK (represented by SP) <br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif"><br>My Backend architecture</font> <font face="arial,helvetica,sans-serif">doesnt have a STACK. So,i need to store the variables in general purpose registers. But all the targets i have seen implement a STACK..,and i tried modifying the code in FRAMELOWERING.cpp but there were many errors i cant even keep track of.  <br><br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif">My Question is if it is possible to totally eliminate the Stack? Because it seems that FRAMELOWERING.cpp has all methods defined using a stack.<br><br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif">If it is Possible,Please suggest me how. It would be really helpful if you can send some sample codes too.<br><br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif">Thank you,<br></font></div><div style="font-size:13.2833px;font-family:monospace"><font face="arial,helvetica,sans-serif">Avinash<br></font></div></div><div style="font-size:18.121px;font-family:monospace"><br></div></div>
</div><br></div>