Question: 8.Convert the following C++ function into assembly using stack frame convention(ARM V7) Also provide a diagram of what your stack frame looks like. Your stack
8.Convert the following C++ function into assembly using stack frame convention(ARM V7)
Also provide a diagram of what your stack frame looks like. Your stack frame should include space for all local variables upfront. Anything that involves working with a variable must read/write from the stack.Do NOT optimize... do a faithful line by line hand compilation of the existing code.and not assume you have something in a register just because a previous line was using that register.
int foo(int x, int y) {
int q = 5;
if(x == 0) {
q = q + 1;
} else {
int r = q * y + 1;
q = r;
}
return q;
}
If you want to test the function in the simulator, you will have to add a "main" to call it
8.
Document stack frame:
| Contents | Frame Pointer Relative Address |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Paste text version of code here:
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
