c
#include <stdio.h>
// mainブロック
int main(void) {
int age;
age = 20;
printf("私は%d歳です\n", age);
return 0;
}
assembler
|main| PROC
|$LN3|
stp fp,lr,[sp,#-0x20]!
mov fp,sp
mov w8,#0x14
str w8,[sp,#0x10]
ldr w1,[sp,#0x10]
adrp x8,|$SG4981|
add x0,x8,|$SG4981|
bl printf
mov w0,#0
ldp fp,lr,[sp],#0x20
ret
str
ストア命令 (STR) はレジスタに格納されている値をメモリに書き込み
ageをdoubleにするとこうなる
ラベルでldrしている
|$LN4|
stp fp,lr,[sp,#-0x20]!
mov fp,sp
ldr d16,|$LN3@main|
str d16,[sp,#0x10]
ldr x1,[sp,#0x10]
adrp x8,|$SG4981|
add x0,x8,|$SG4981|
bl printf
mov w0,#0
ldp fp,lr,[sp],#0x20
ret
nop
|$LN3@main|
DCFD 20.5
DCFD and DCFDU: The DCFD directive allocates memory for word-aligned double-precision floating-point numbers, and defines the initial runtime contents of the memory. DCFDU is the same, except that the memory alignment is arbitrary.
https://developer.arm.com/documentation/dui0801/l/Directives-Reference
型によってassemblerのオペランドが異なっていることがわかる