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

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

2010/2011

Uploaded on 06/07/2011

koofers-user-40u
koofers-user-40u 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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