Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
EN
Uploaded by
hydai
PDF, PPTX
2,746 views
COSCUP2016 - LLVM框架、由淺入淺
AI-enhanced description
文档介绍了LLVM框架及其编译流程,包括前端、后端和优化阶段的设计架构。提到不同编程语言的编译实现以及RAISE和SSA等重要概念。还包含LLVM相关资料和开发资源的链接。
Engineering
◦
Read more
10
Save
Share
Embed
Embed presentation
Download
Download as PDF, PPTX
1
/ 62
2
/ 62
3
/ 62
4
/ 62
5
/ 62
6
/ 62
7
/ 62
8
/ 62
9
/ 62
10
/ 62
11
/ 62
12
/ 62
13
/ 62
14
/ 62
15
/ 62
16
/ 62
17
/ 62
18
/ 62
19
/ 62
20
/ 62
21
/ 62
22
/ 62
23
/ 62
24
/ 62
25
/ 62
26
/ 62
27
/ 62
28
/ 62
29
/ 62
30
/ 62
31
/ 62
32
/ 62
33
/ 62
34
/ 62
35
/ 62
36
/ 62
37
/ 62
38
/ 62
39
/ 62
40
/ 62
41
/ 62
42
/ 62
43
/ 62
44
/ 62
45
/ 62
46
/ 62
47
/ 62
48
/ 62
49
/ 62
50
/ 62
51
/ 62
52
/ 62
53
/ 62
54
/ 62
55
/ 62
56
/ 62
57
/ 62
58
/ 62
59
/ 62
60
/ 62
61
/ 62
62
/ 62
More Related Content
PPTX
LLVM Instruction Selection
by
Shiva Chen
PDF
淺談探索 Linux 系統設計之道
by
National Cheng Kung University
PDF
VLANs in the Linux Kernel
by
Kernel TLV
PDF
Improve Android System Component Performance
by
National Cheng Kung University
PDF
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
by
National Cheng Kung University
PDF
OpenMP Tutorial for Beginners
by
Dhanashree Prasad
PDF
Attacking Windows NDIS Drivers
by
Kique Nissim
PDF
GDB Rocks!
by
Kent Chen
LLVM Instruction Selection
by
Shiva Chen
淺談探索 Linux 系統設計之道
by
National Cheng Kung University
VLANs in the Linux Kernel
by
Kernel TLV
Improve Android System Component Performance
by
National Cheng Kung University
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
by
National Cheng Kung University
OpenMP Tutorial for Beginners
by
Dhanashree Prasad
Attacking Windows NDIS Drivers
by
Kique Nissim
GDB Rocks!
by
Kent Chen
What's hot
PPTX
eBPF Basics
by
Michael Kehoe
PDF
Making Linux do Hard Real-time
by
National Cheng Kung University
PDF
[232] 성능어디까지쥐어짜봤니 송태웅
by
NAVER D2
PDF
Run Qt on Linux embedded systems using Yocto
by
Marco Cavallini
PDF
BPF / XDP 8월 세미나 KossLab
by
Taeung Song
PDF
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
by
The Linux Foundation
PDF
Linux Preempt-RT Internals
by
哲豪 康哲豪
PDF
The Linux Block Layer - Built for Fast Storage
by
Kernel TLV
PDF
ACPI Debugging from Linux Kernel
by
SUSE Labs Taipei
PDF
Construct an Efficient and Secure Microkernel for IoT
by
National Cheng Kung University
PDF
Symbolic Debugging with DWARF
by
Samy Bahra
PDF
Q4.11: ARM Architecture
by
Linaro
PPTX
[TGDF 2019] Mali GPU Architecture and Mobile Studio
by
Owen Wu
PPTX
Broken Linux Performance Tools 2016
by
Brendan Gregg
PDF
eBPF - Rethinking the Linux Kernel
by
Thomas Graf
PPTX
Memory model
by
Yi-Hsiu Hsu
PDF
Handling inline assembly in Clang and LLVM
by
Min-Yih Hsu
PPTX
Understanding DPDK algorithmics
by
Denys Haryachyy
PDF
Hacking QNX
by
ricardomcm
PDF
XPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM Systems
by
The Linux Foundation
eBPF Basics
by
Michael Kehoe
Making Linux do Hard Real-time
by
National Cheng Kung University
[232] 성능어디까지쥐어짜봤니 송태웅
by
NAVER D2
Run Qt on Linux embedded systems using Yocto
by
Marco Cavallini
BPF / XDP 8월 세미나 KossLab
by
Taeung Song
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
by
The Linux Foundation
Linux Preempt-RT Internals
by
哲豪 康哲豪
The Linux Block Layer - Built for Fast Storage
by
Kernel TLV
ACPI Debugging from Linux Kernel
by
SUSE Labs Taipei
Construct an Efficient and Secure Microkernel for IoT
by
National Cheng Kung University
Symbolic Debugging with DWARF
by
Samy Bahra
Q4.11: ARM Architecture
by
Linaro
[TGDF 2019] Mali GPU Architecture and Mobile Studio
by
Owen Wu
Broken Linux Performance Tools 2016
by
Brendan Gregg
eBPF - Rethinking the Linux Kernel
by
Thomas Graf
Memory model
by
Yi-Hsiu Hsu
Handling inline assembly in Clang and LLVM
by
Min-Yih Hsu
Understanding DPDK algorithmics
by
Denys Haryachyy
Hacking QNX
by
ricardomcm
XPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM Systems
by
The Linux Foundation
Similar to COSCUP2016 - LLVM框架、由淺入淺
PDF
LLVM introduction
by
National Cheng Kung University
PDF
Accelerating or Complicating PHP execution by LLVM Compiler Infrastructure
by
National Cheng Kung University
PPTX
Hcsm lect-20120913
by
lusecheng
PDF
[嵌入式系統] 嵌入式系統進階
by
Simen Li
PDF
Linux binary Exploitation - Basic knowledge
by
Angel Boy
PDF
Compiler for Dummy 一點都不深入的了解 Compiler, Interpreter 和 VM
by
Li Hsuan Hung
DOCX
系統程式 -- 第 9 章 虛擬機器
by
鍾誠 陳鍾誠
PDF
from Source to Binary: How GNU Toolchain Works
by
National Cheng Kung University
PDF
Binary exploitation - AIS3
by
Angel Boy
PDF
Example my hdl
by
sean chen
PDF
程式設計師的自我修養 Chapter 1
by
Shu-Yu Fu
LLVM introduction
by
National Cheng Kung University
Accelerating or Complicating PHP execution by LLVM Compiler Infrastructure
by
National Cheng Kung University
Hcsm lect-20120913
by
lusecheng
[嵌入式系統] 嵌入式系統進階
by
Simen Li
Linux binary Exploitation - Basic knowledge
by
Angel Boy
Compiler for Dummy 一點都不深入的了解 Compiler, Interpreter 和 VM
by
Li Hsuan Hung
系統程式 -- 第 9 章 虛擬機器
by
鍾誠 陳鍾誠
from Source to Binary: How GNU Toolchain Works
by
National Cheng Kung University
Binary exploitation - AIS3
by
Angel Boy
Example my hdl
by
sean chen
程式設計師的自我修養 Chapter 1
by
Shu-Yu Fu
More from hydai
PDF
Introduction to Ewasm - crosslink taipei 2019
by
hydai
PDF
Introduction to ewasm
by
hydai
PDF
Lity - 讓你更安全的 Smart Contract Language
by
hydai
PDF
連哈秋都懂的Git教學
by
hydai
PDF
Vim 由淺入淺
by
hydai
PDF
Slack&typora
by
hydai
Introduction to Ewasm - crosslink taipei 2019
by
hydai
Introduction to ewasm
by
hydai
Lity - 讓你更安全的 Smart Contract Language
by
hydai
連哈秋都懂的Git教學
by
hydai
Vim 由淺入淺
by
hydai
Slack&typora
by
hydai
COSCUP2016 - LLVM框架、由淺入淺
1.
LLVM框架、由淺⼊入淺 浪打、Hydai
2.
Speakers $ whoami
3.
楊宗凡 — 浪打 ‣
成功⼤大學電機系四年級 ‣ sonic.tw.tp (at) gmail.com 戴宏穎 — Hydai ‣ 清華⼤大學資⼯工碩⼀一年級 ‣ z54981220 (at) gmail.com
4.
Github Repos: https://github.com/sonicyang/ws-frontend https://github.com/sonicyang/llvm-z80
5.
Code to Executable $
gcc helloworld.c
6.
#include <stdio.h> int main(int
argc, char* argv[]){ puts(“Hello World!”); return 0; } In C Hello World! print “Hello World!” In Python Hello World! 魔法 我想學魔法!
7.
The Magic 原始碼 組合語⾔言
機械碼 AssemblerCompiler print “!@#$” mov d, msg$ mov c, 9 call 5 110100…. >./hw 機械碼 110100…. Hello World!
8.
Compiler 原始碼 組合語⾔言 Lex Parse Token Stream 轉譯AST
9.
bdos equ 0005H start:
mvi c,9 lxi d,msg$ call bdos ret msg$:db 'Hello, world!$' end start Intel 8080 Assembler MSG: .ASCIIZ "Hello, world!" LDX #0 LDA MSG,X @LP: JSR $FFD2 INX LDA MSG,X BNE @LP RTS MOS 6502 8080 Assemble 6502 Assemble 110110.. 010111.. CP/M Apple Dos
10.
Perl Python Java C Ruby Javascript 他們都造⾃自⼰己的輪⼦子 對應不同的機器 IA-32 AMD64 IA-64 Arch32 AArch64 Sun
Sparc
11.
Compiler 原始碼 組合語⾔言 Lex Parse Token Stream 轉譯AST
12.
Modern Compiler $ export
CFLAGS = “-O3”
13.
Modern Wheel 原始碼 組合語⾔言 Lex Yacc AST 演算法 中介語⾔言 轉譯
14.
三階段編譯流程 原始碼 Backend 組合語⾔言 OptimizerFrontend
15.
Copy Propagation
16.
Constant Propagation
17.
Constant Folding
18.
Dead Code Elimination(1)
19.
Dead Code Elimination(2)
20.
三階段編譯流程 原始碼 Backend 組合語⾔言 OptimizerFrontend
21.
Python的故事 Python 組合語⾔言 Interpreter C Code GCC
22.
LLVM Framework $ git
clone http://llvm.org/git/llvm.git
23.
三階段編譯流程 原始碼 Backend 組合語⾔言 OptimizerFrontend
24.
IR LLVM Framework - Front
End 原始碼 Backend 組合語⾔言Frontend IRPass IR Pass … Pass IR Pass
25.
IR LLVM Framework - Optimizer 原始碼
Backend 組合語⾔言Frontend IRPass IR Pass … Pass IR Pass
26.
IR LLVM Framework - Back
End 原始碼 Backend 組合語⾔言Frontend IRPass IR Pass … Pass IR Pass
27.
模組化的開發 原始碼 Backend 組合語⾔言 OptimizerFrontend LLVM IR
28.
Front End $ clang
-S -emit-llvm main.c
29.
以下使⽤用 Whitespace 語⾔言
30.
Hello, world!
31.
Hello, world(syntax hl)
32.
Whitespace 簡介 • 只有三種
Tokens: • Space 空⽩白(' ') • Tabs 制表符(t) • New lines 換⾏行(n) • 其餘的字元全部都被當成註解
33.
Front End to
IR 程式碼 LLVM IR
34.
Front End to
IR 程式碼 LLVM IRParser LLVM API • Module • IRBuilder • Function • BasicBlock • Instruction
35.
LLVM IR $ cat
main.ll
36.
LLVM IR • RISC-style
(Reduced Instruction Set Computing) • ⼈人類可讀的 • 具備 SSA form (Static Single Assignment) • 無限多的虛擬暫存器 • 任意位元⼤大⼩小 • 不改變⾏行為下 Transform IR ,來做最佳化。
37.
C to IR
39.
int a =
1;
40.
int c =
a+b;
41.
Optimizer • LLVM 使⽤用
opt 做最佳化 • 每⼀一種類的分析跟轉換的 pass 都是 opt 的參數 • opt 會照順序幫你⼀一個⼀一個⾛走過這些 pass • 每個 pass 會⾃自⼰己決定要不要做事
42.
opt 剛才的 C
Code
43.
Backend $ llc -march=z80
main.ll
44.
Basic Ideas LLVM IR
組合語⾔言
45.
Basic Ideas SelectionDAGLLVM IR
組合語⾔言 •Combining •Legalizing •Scheduling •Register Allocation
46.
What’s a DAG?
47.
llvm::SelectionDAGISel LLVM IR 組合語⾔言 Original
DAG Combined DAG Legalized DAG Target Legalizing DAG Combiner Instruction Selection TableGe n
48.
llvm::SelectionDAGISel LLVM IR 組合語⾔言 Original
DAG Combined DAG Legalized DAG Target Legalizing DAG Combiner Instruction Selection TableGe n
49.
TableGen 組譯器 反組譯器 編譯器 除錯器 Target CPU 暫存器 指令格式 指令 代表A 代表B 代表C 代表D
50.
TableGen 組譯器 反組譯器 編譯器 除錯器 Target CPU Table Gen 暫存器 指令格式 指令
51.
Legalizing LOAD LD 8bit 加法 除法 32bit 加法 ⼀一堆 減法 Legal Promote Custom
52.
Instruction Selecting 組合語⾔言 Legalized DAG Instruction Selection TableGe n
53.
Register Allocation SSA 虛擬暫存器 CPU暫存器 分配 最佳化 Instruction Scheduling 原先指令順序
CPU 更適合的順續 順序 最佳化
54.
llvm::SelectionDAGISel LLVM IR 組合語⾔言 Original
DAG Combined DAG Legalized DAG Target Legalizing DAG Combiner Instruction Selection TableGe n
55.
Demo A 40 years
portal by LLVM, Linking 1976 and 2016
56.
Demo A 40 years
portal by LLVM, Linking 1976 and 2016 WhiteSpace LLVM IR 組合語⾔言 CP/M LLVM Zilog Z80
57.
模組化的LLVM 原始碼 Backend 組合語⾔言 OptimizerFrontend
58.
Reference $ uname -a
59.
1. Architecture for
Next Generation GCC ftp://gcc.gnu.org/pub/gcc/summit/2003/Architecture%20for%20a%20Next-Generation %20GCC.pdf 2. Life of an Instruction in LLVM http://eli.thegreenplace.net/2012/11/24/life-of-an-instruction-in-llvm 3. A deeper look into the LLVM code generator http://eli.thegreenplace.net/2013/02/25/a-deeper-look-into-the-llvm-code-generator- part-1 4. LLVM TableGen Documentation http://llvm.org/docs/TableGen/index.html 5. LLVM TableGen Introduction http://llvm.org/docs/TableGen/LangIntro.html 6. Independent Code Generator http://llvm.org/docs/CodeGenerator.html 7. The Relationship between selectiondag and selectiondagisel http://stackoverflow.com/questions/26814062/the-relationship-between-selectiondag- and-selectiondagisel 8. How TableGen’s DAGISel Backend Works https://github.com/draperlaboratory/fracture/wiki/How-TableGen's-DAGISel-Backend- Works 9. ZASM - Z80 Assembler http://k1.spdns.de/Develop/Projects/zasm/Documentation/ 10. LLVM Z80 Backend https://github.com/mostlyuseful/llvm-z80/network 11. Whitespace LLVM https://github.com/Subv/Whitespace-LLVM
60.
Q & A $
man man
Download