Docsity

CS30 Quiz 3: SPARC Assembly Instructions and Local Variable Allocation - Prof. Richard Ord, Quizzes of Computer Science

Toggle sidebar
bg1
Name:
cs30x____
Score:
Quiz 3
CSE 30
Spring 2002
#1.
a) Write the appropriate save instruction to allocate stack space for the following local variables and any
padding.
char a;
unsigned short b;
char c;
short d;
int e;
save _________ , ______________________________ , _________
(Use the formula, not an absolute value)
b) Write the appropriate unoptimized SPARC assembly instructions using the above local variables.
c = โ€™Aโ€™;
d = -9876;
e = b;
c = a;
(OVER)
pf2

Partial preview of the text

Download CS30 Quiz 3: SPARC Assembly Instructions and Local Variable Allocation - Prof. Richard Ord and more Quizzes Computer Science in PDF only on Docsity!

Name:

cs30x____

Score:

Quiz 3

CSE 30

Spring 2002

a) Write the appropriate save instruction to allocate stack space for the following local variables and any padding. char a; unsigned short b; char c; short d; int e; save _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate unoptimized SPARC assembly instructions using the above local variables. c = โ€™Aโ€™;

d = -9876;

e = b;

c = a;

(OVER)

a) Write the appropriate save instruction to allocate stack space for the following local variable declara- tion. short a[6]; save _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate instructions to perform the following assignment statements. a[5] = a[3];



a[2] = a[1];



short ptr; / ptr mapped to %l1 */ ptr = &a[0];


ptr++; /* ptr mapped to %l1 */


i = ptr; / i mapped to %l0; ptr to %l1 */


ptr = i; / i mapped to %l0; ptr to %l1 */