Machine-Level Representation of Programs(程序的机器级表示)
The Compilation System
Memory Hierarchy
Register
63 |
|
|
|
31 |
|
|
15 |
|
7 |
0 |
|
%rax |
|
|
|
%eax |
|
|
%ax |
|
%al |
|
返回值 |
%rbx |
|
|
|
%ebx |
|
|
%bx |
|
%bl |
|
被调用者保存 |
%rcx |
|
|
|
%ecx |
|
|
%cx |
|
%cl |
|
第4个参数 |
%rdx |
|
|
|
%edx |
|
|
%dx |
|
%dl |
|
第3个参数 |
%rsi |
|
|
|
%esi |
|
|
%si |
|
%sil |
|
第2个参数 |
%rdi |
|
|
|
%edi |
|
|
%di |
|
%dil |
|
第1个参数 |
%rbp |
|
|
|
%ebp |
|
|
%bp |
|
%dpl |
|
被调用者保存 |
%rsp |
|
|
|
%esp |
|
|
%sp |
|
%spl |
|
栈指针 |
%r8 |
|
|
|
%r8d |
|
|
%r8w |
|
%r8b |
|
第5个参数 |
%r9 |
|
|
|
%r9d |
|
|
%r9w |
|
%r9b |
|
第6个参数 |
%r10 |
|
|
|
%r10d |
|
|
%r10w |
|
%r10b |
|
调用者保护 |
%r11 |
|
|
|
%r11d |
|
|
%r11w |
|
%r11b |
|
调用者保护 |
%r12 |
|
|
|
%r12d |
|
|
%r12w |
|
%r12b |
|
被调用者保护 |
%r13 |
|
|
|
%r13d |
|
|
%r13w |
|
%r13b |
|
被调用者保护 |
%r14 |
|
|
|
%r14d |
|
|
%r14w |
|
%r14b |
|
被调用者保护 |
%r15 |
|
|
|
%r15d |
|
|
%r15w |
|
%r15b |
|
被调用者保护 |
Instruction
Operation code(操作码) |
Operands(操作数) |
|
movq |
|
|
addq |
|
|
subq |
|
|
xorq |
|
|
ret |
|
|
Memory Reference
$$
Imm(r_b,r_i,s) => Imm + R[r_b]+R[r_i]{\cdot}s
$$
|
|
|
Imm |
Immediate |
立即数 |
$r_b$ |
Base Redgister |
基址寄存器 |
$r_i$ |
Index Redgister |
变址寄存器 |
$s$ |
Scale Factor |
比例因子 |
Sign-extending
Instruction |
Effect |
Description |
MOVES S R |
R <- SignExtend(S) |
Move with sign exension |
movsbw |
|
Move Sign-extended byte to word |
movsbl |
|
Move Sign-extended byte to Double word |
movswl |
|
Move Sign-extended word to Double word |
movsbq |
|
Move Sign-extended byte to Quad word |
movswq |
|
Move Sign-extended word to Quad word |
movslq |
|
Move Sign-extended Double word to Quad word |
cltq |
movslq %eax %rax |
|
资料由 九曲阑干
视频提供,如有侵权,联系 sliver_horn@qq.com
删!