cse 425: target machine architecture target machine details many architectures can be similar in...

3
SE 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

Upload: silvia-todd

Post on 04-Jan-2016

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: CSE 425: Target Machine Architecture Target Machine Details Many architectures can be similar in overall structure –E.g., Von Neumann with CISC instruction

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

Page 2: CSE 425: Target Machine Architecture Target Machine Details Many architectures can be similar in overall structure –E.g., Von Neumann with CISC instruction

CSE 425: Target Machine Architecture

Example Data Size Rules (from C++)• Rules governing data sizes [from Stroustrup 4th 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 5th 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

Page 3: CSE 425: Target Machine Architecture Target Machine Details Many architectures can be similar in overall structure –E.g., Von Neumann with CISC instruction

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 email with “Target Machine Studio” in the subject line to the [email protected] course account