Where We Are
1
Where We Are Source code Lexical, Syntax, and if (b == 0) a = b; - - PowerPoint PPT Presentation
Where We Are Source code Lexical, Syntax, and if (b == 0) a = b; Semantic Analysis IR Generation Low-level IR code Optimizations Optimized Low-level IR code Assembly code Assembly code generation cmp $0,%rcx cmovz %rax,%rdx 1 Low IR
1
2
3
4
accumulate counter data base source index destination index
5
7
8
9
16
17
18
19
20
21
22
.rodata ... .align 8 .quad 13 strlit3: .ascii "Hello, World!" ... .text ... # t4 = "Hello, World!" # Works on both LLVM/Mac OS X and GCC/Linux: leaq strlit3(%rip), %rax # GCC only: movq $strlit3, %rax movq %rax, 8(%rsp) # Library.println(t4); movq 8(%rsp), %rax movq %rax, -8(%rsp) subq 8, %rsp callq __LIB_println
23
24
25
26
27
28
29
(compare i to 0)
(test lower bound)
(load v into %ecx)
(load array length into %ecx)
(compare i to array length)
(test upper bound)
30
31
32
33
34
35
36
37
38
39
40
41
... movq $20, %rdi call __LIB_random movq %rax, -32(%rbp)
42
43