

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for saving stack space for local variables and writing unoptimized sparc assembly instructions for assigning values to local variables in a c program. From quiz 3 of cse 30, a computer science course offered in spring 2002.
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


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;
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 */