blog 文章

2017/02/08

relational op

產生 < 的組合語言。
add_1.c
 1 int main()
 2 {
 3   int i;
 4   int j;
 5   i=8;
 6   j=3;
 7 
 9 
10   i<j;
11 
94 }
-----------------------------------------
r.S
 1 .text
 2 .globl main
 3 .type main, @function
 4 main:
 5 pushl %ebp
 6 movl %esp, %ebp
 7 subl $4, %esp # reserve temp object size
 8 subl $8, %esp # reserve local variable
 9 mov $8 ,%eax
10 movl %eax, (%ebp)
11 mov $3 ,%eax
12 movl %eax, -4(%ebp)
13 # gen code: i < j
14 movl (%ebp), %eax # variable: i
15 cmpl -4(%ebp), %eax # variable: j
16 setl %al
17 movzbl %al, %eax
18 pushl %eax
19 popl %eax
20 leave
21 ret

沒有留言:

張貼留言