Introducing the x64 instruction set
This section provides a brief overview of the x64 instruction set, but you are encouraged to consult Advanced Micro Devices (AMD) or Intel's architecture programmer's manuals. Douglas Thain's book Introduction to Compilers and Language Design, available at http://compilerbook.org, has helpful x64 material.
x64 is a complex instruction set with many backward-compatibility features. This chapter covers the subset of x64 that is used to build a basic Jzero code generator. We are using AT&T assembler syntax so that our generated output can be converted into binary object file format by the GNU assembler. This is for the sake of multiplatform portability.
x64 has hundreds of instructions with names such as ADD
for addition or MOV
to copy a value to a new location. When an instruction has two operands, at most one may be a reference to main memory. x64 instructions can have a suffix to indicate how many bytes are being read or...