Introducing the x64 instruction set
This section provides a brief overview of the x64 instruction set. You are encouraged to consult Advanced Micro Devices (AMD) or Intel’s architecture programmer’s manuals for more information. 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 the 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 move (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...