CSE 425: Target Machine Architecture Target Machine Details Many architectures can be similar in overall structure –E.g., Von Neumann with CISC instruction sets is common –RISC architectures also have been used and still are For programming languages, architecture of the target machine also imposes a number of details to consider –Especially to retarget a compiler to another machine –Especially to write software that’s portable across machines –E.g., sizes, other details of memory locations and addresses Programming language details often based on them –Sizes and layouts of data types, aliases, objects, etc. –Addresses, how incremented/decremented pointers move, relative to other variables address space (local, array, heap) –Directions stack and heap grow in memory address space
CSE 425: Target Machine Architecture Example Data Size Rules (from C++) Rules governing data sizes [from Stroustrup 4 th Ed] –R1: 1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long) –R2: 1 <= sizeof(bool) <= sizeof(long) –R3: sizeof(char) <= sizeof(wchar_t) <= sizeof(long) –R4: sizeof(float) <= sizeof(double) <= sizeof(long double) –R5: sizeof(N) == sizeof(signed N) == sizeof(unsigned N) where N is char, short, int, long, or long long (integral types) Minimum data sizes for some types [from LLM 5 th Ed] –R6: char must be at least 1 byte (8 bits) –R7: wchar_t, char16_t, short, int must be at least 2 bytes –R8: char32_t and long must be at least 4 bytes –R9: long long must be at least 8 bytes
CSE 425: Target Machine Architecture Today’s Studio Exercises We’ll look at some target machine details today –Data sizes, pointer addresses, etc. Today’s exercises are again in C++ –Please take advantage of the on-line reference manual pages that are linked on the course web site –As always, please ask us for help as needed When done, send with “Target Machine Studio” in the subject line to the course account