blog 文章

2017/01/12

產生 (9+10) + ((1+2+3)+ (5+6+7)) x86 組合語言

(9+10) + ((1+2+3)+ (5+6+7));

op
 1                  root
 2                   |
 3                  prog
 4            _______|________
 5            |              |
 6 main |int |func |global  main
 7            |
 8        func_body
 9            |
10            +
11        ____|_____
12        |        |
13        +        +
14       _|__   ___|___
15       |  |   |     |
16       9  10  +     +
17             _|__  _|__
18             |  |  |  |
19             +  3  +  7
20            _|__  _|__
21            |  |  |  |
22            1  2  5  6
23 cg: root : ROOT
24 do nothing
25 cg: prog : PROG
26 do nothing
27 cg: main : FUNC_NAME
28   enter func: main
29 cg: func_body : FUNC_BODY
30 cg: + : ADD
31 handle add +
32 movl $9, %eax
33 ADD $10, %eax
34 pushl %eax
35 handle add +
36 handle add +
37 handle add +
38 movl $1, %eax
39 ADD $2, %eax
40 pushl %eax
41 22 movl $3, %ebx
42 popl %eax
43 merge left ADD %ebx, %eax
44 merge left pushl %eax
45 handle add +
46 handle add +
47 movl $5, %eax
48 ADD $6, %eax
49 pushl %eax
50 22 movl $7, %ebx
51 popl %eax
52 merge left ADD %eax, %ebx
53 merge left pushl %ebx
54 popl  %ebx
55 popl  %eax
56 xx left/right ADD %eax, %ebx
57 pushl %ebx
58 popl  %ebx
59 popl  %eax
60 mm left/right ADD %ebx, %eax
61 add complete
62   exit func: main
63 cg: main : FUNC_CALL
64 do nothing
65   exit func: main

沒有留言:

張貼留言