CSCI 434T

Compiler Design

Home | Schedule and Assignments | Resources

Code Generation Material

Example Programs

Calling conventions

x86_64 Instruction Set Architecture

Other Tools

AT&T versus Intel Syntax

  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


Assembling and linking commands

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.