-
Notifications
You must be signed in to change notification settings - Fork 17
Home
tyfkda edited this page Aug 6, 2023
·
12 revisions
- SSA Bibliography
- Static Single Assignment Book [pdf] | Hacker News
- 静的単一代入形式を用いた最適化(導入編)、(発展編)
- 静的単一代入形式からの逆変換アルゴリズムの比較と評価, pdf
- mem2regを解説してみる - Qiita
- Linear Scan Register Allocation, MASSIMILIANO POLETTO and VIVEK SARKAR
-
System V ABI AMD64 Specification 3.5.7 Variable Argument Lists
-
%raxにxmmの個数を入れて渡す
-
Offset:
- %rdi 0
- %rsi 8
- %rdx 16
- %rcx 24
- %r8 32
- %r9 40
- %xmm0 48
- %xmm1 64
- . . .
- %xmm15 288
typedef struct {
unsigned int gp_offset;
unsigned int fp_offset;
void *overflow_arg_area;
void *reg_save_area;
} va_list[1];
movl l->gp_offset, %eax
cmpl $48, %eax ;; Is register available?
jae stack ;; If not, use stack
leal $8(%rax), %edx ;; Next available register
addq l->reg_save_area, %rax ;; Address of saved register
movl %edx, l->gp_offset ;; Update gp_offset
jmp fetch
stack: movq l->overflow_arg_area, %rax ;; Address of stack slot
leaq 8(%rax), %rdx ;; Next available stack slot
movq %rdx,l->overflow_arg_area ;; Update
fetch: movl (%rax), %eax ;; Load argument
//