Name_______________ cs30x____ Score: Signature __________________ Student ID _________________ Quiz 3 CSE 30 Winter 2014 #1. a) Write the appropriate save instruction to allocate stack space for the following local variables and any padding. int char short unsigned short char char save a; b; c; d; e; f; _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate unoptimized SPARC assembly instructions using the above local variables. f = a; d = 0x2BEE; c = b; e = 'B'; (OVER) #2. a) Write the appropriate save instruction to allocate stack space for the following local variable declaration. 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[1]; ________________________ ________________________ a[0] = a[4]; ________________________ ________________________ short *ptr; ptr = &a[2]; /* ptr mapped to %l1 */ ________________________ ++ptr; /* ptr mapped to %l1 */ ________________________ short d = *ptr; /* d mapped to %l3; ptr to %l1 */ ________________________ *ptr = d; /* d mapped to %l3; ptr to %l1 */ ________________________ #3. Give the equivalent C array expression for the following pointer expression assuming fubar is defined as an array. For this answer it does not matter what type each array element is or how many elements are defined. *fubar is equivalent to _____________________________ (equivalent array expression using [ ] but no *). #4. Using the Right-Left rule, define a variable named scary that is a pointer to a function that takes a single argument of type pointer to double and returns a pointer to a short.
© Copyright 2025 ExpyDoc