CSCI 434T

Compiler Design

Home | Schedule and Assignments | Resources

Code Generation Material

Example Programs

Calling conventions

Pentium 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)
(e.g., movb, movw, movl)
operand prefixes
(e.g., byte ptr, word ptr, dword ptr)
Registers %eax, %ebx, etc. eax, ebx, etc.
Constants $4, $foo, etc 4, foo, etc


Assembling and linking commands

To assemble and link the file "file.s", use:

gcc -g -o file.exe file.s libic.a

The library file libic.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 -g flag enables you to use gdb to step through your program.

The IC library is also available for Intel Macs running FreeBSD: libic.osx.a.