CSCI 434T
Compiler Design
Home | Schedule and Assignments | Resources
Code Generation Material
hello.ic
,
hello.s
fib.ic
,
fib.s
objects.ic
,
objects.s
%rax
register (not on stack) %rax, %rcx, %rdx, %rdi, %rsi, %r8-%r11
%rbx, %rbp, %rsp %r12-%r15
AT&T | Intel | |
Order of operands | op a,b means b = a op b (second operand is destination) |
op a, b means a = a op b (first operand is destination) |
Memory addressing | disp(base, offset, scale) |
[base + offset*scale + disp] |
Size of memory operands | instruction suffixes (b,w,l,q) (e.g., movb, movw, movl,movq ) |
operand prefixes (e.g., byte ptr, word ptr, dword ptr, qword ptr ) |
Registers | %rax, %rbx, etc. |
rax, rbx, etc. |
Constants | $4, $foo, etc |
4, foo, etc |
To assemble and link the file "
file.s
" on our Linux lab computers, use:
gcc -m64 -g -o file.exe file.s libic64.a
The
-m64
flag turns on 64-bit mode. The-g
flag causes debugging info to be placed in the executable.The library file
libic64.a
is a collection of .o files bundled together, containing the code for all of the library functions defined in the language specification, along with run-time support for garbage collection.The IC library is also available for Intel Macs running FreeBSD:
libic64.osx.a
.