SlideShare a Scribd company logo
Min-Yih “Min” Hsu @ COSCUP 2021
LLVM Project:


The Good, The Bad, and The Ugly
“Min” Hsu
about:me
2
“Min” Hsu
• Computer Science PhD Candidate in
University of California, Irvine

• Advised by Prof. Michael Franz
about:me
2
“Min” Hsu
• Computer Science PhD Candidate in
University of California, Irvine

• Advised by Prof. Michael Franz
• LLVM contributor since 2015

• Code owner of M68k LLVM backend

• Author of book “LLVM Techniques,
Tips and Best Practices” (2021)
about:me
2
“Min” Hsu
• Computer Science PhD Candidate in
University of California, Irvine

• Advised by Prof. Michael Franz
• LLVM contributor since 2015

• Code owner of M68k LLVM backend

• Author of book “LLVM Techniques,
Tips and Best Practices” (2021)
• Motorcycle rider and co
ff
ee junkies
about:me
2
*Opinions Are My Own
3
What is this talk?
4
What is this talk?
4
What is this talk?
4
An Overview
5
An Overview
5
Technical Stu
f
An Overview
5
Technical Stu
f
Community
Outline
The Good
Design

Some new features

Community

The Bad
The Ugly
6
Design
8
Frontend Optimizer Backend
Traditional compiler design
9
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
Traditional compiler design
9
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A Single Compiler Executable
Traditional compiler design
9
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A Single Compiler Executable
Traditional compiler design
Example: GCC
Scenario
10
We’re adding C++ auto-complete feature
Scenario
10
We’re adding C++ auto-complete feature
Create a new from scratch
Scenario
10
We’re adding C++ auto-complete feature
Create a new from scratch
Re-use gcc’s
frontend
Scenario
10
We’re adding C++ auto-complete feature
Create a new from scratch
Re-use gcc’s
frontend Gimme a raise
Try to re-use gcc’s frontend
11
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A single compiler executable
Try to re-use gcc’s frontend
11
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A single compiler executable
Option 1:

Copy / Extract the frontend source code
Try to re-use gcc’s frontend
11
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A single compiler executable
Option 1:

Copy / Extract the frontend source code
Drawback: Time-consuming
Try to re-use gcc’s frontend
11
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A single compiler executable
Option 1:

Copy / Extract the frontend source code
Option 2:

> gcc -fsyntax-only code_snapshot.c
Drawback: Time-consuming
Try to re-use gcc’s frontend
11
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
A single compiler executable
Option 1:

Copy / Extract the frontend source code
Option 2:

> gcc -fsyntax-only code_snapshot.c
Drawback: Time-consuming
Drawbacks: 

1. Potentially low performance

2. Interface to the frontend is weak
Potential solution: Code sharing
12
Code
LLVM Project: A collection of compiler libraries
13
LLVM Project: A collection of compiler libraries
13
Clang libraries LLVM libraries
libclangParse libLLVMSupport
libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC
libLLVMX86Info
libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
14
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
Tools
opt
15
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
clang
Tools
opt
16
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
Tools
My auto-complete tool
clang
opt
17
P…Pa…
Pass plugin is not the only 

“modular way” to use LLVM
Some (Cool) New Features
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
Conventional “performance” measuring on compilers
19
Building Flow
Source Code Executable
LLVM’s improvement on building speeding
20
Building Flow
Source Code Executable
CodeGen Linking
LLVM’s improvement on building speeding
20
Building Flow
Source Code Executable
CodeGen Linking
GlobalISel
Instruction selection in LLVM: Running time
LLVM Passes that have the highest running time
21
Instruction selection in LLVM: Running time
LLVM Passes that have the highest running time
21
LLVM Passes
Running Time
0% 10% 20% 30% 40%
DAG->DAG Instruction Selection
Module Veri
fi
er
Live Variable Analysis
Greedy Register Allocator
Live Debug Value Analysis
Prologue / Epilogue Insertion
Instruction selection in LLVM: Workflow
22
LLVM IR (Linear)
Target Independent
Instruction selection in LLVM: Workflow
22
LLVM IR (Linear) SelectionDAG (DAG)
Target Independent
Instruction selection in LLVM: Workflow
22
LLVM IR (Linear) SelectionDAG (DAG) MachineInstr (Linear)
Target Independent Target Speci
fi
c
Instruction selection in LLVM: Workflow
22
LLVM IR (Linear) SelectionDAG (DAG) MachineInstr (Linear)
Target Independent Target Speci
fi
c
Global Instruction Selection (GlobalISel)
23
LLVM IR (Linear) gMIR (Linear) MachineInstr (Linear)
Target Independent Target Speci
fi
c
Global Instruction Selection (GlobalISel)
23
LLVM IR (Linear) gMIR (Linear) MachineInstr (Linear)
Target Independent Target Speci
fi
c
Hybrid
Global Instruction Selection (GlobalISel)
24
Credit: Ahmad Bougcha et al. @ LLVM Dev Meeting 2017
• Faster compilation
Global Instruction Selection (GlobalISel)
24
Credit: Ahmad Bougcha et al. @ LLVM Dev Meeting 2017
• Faster compilation
• Better codegen
quality
Global Instruction Selection (GlobalISel)
24
Credit: Ahmad Bougcha et al. @ LLVM Dev Meeting 2017
• Faster compilation
• Better codegen
quality
• Testing GlobalISel
is much easier.
25
Building Flow
Source Code Executable
CodeGen Linking
25
Building Flow
Source Code Executable
CodeGen Linking
LLD / ThinLTO
Linker 101
26
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.o B.o C.o
Linker
Executable
Linker 101
• Linking speed becomes the
bottleneck while building
large-scale projects.
• We barely can parallelize this
process.
26
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.o B.o C.o
Linker
Executable
Thread Thread Thread
LLD: A (much) faster linker
• Gold was the fastest linker, but
now LLD is (mostly) faster than
gold.
27
Credit: Rui Ueyama @ LLVM Dev Meeting 2017
LLD: A (much) faster linker
• Gold was the fastest linker, but
now LLD is (mostly) faster than
gold.
• Secret sauce
27
Credit: Rui Ueyama @ LLVM Dev Meeting 2017
LLD: A (much) faster linker
• Gold was the fastest linker, but
now LLD is (mostly) faster than
gold.
• Secret sauce
• Laziness
27
Credit: Rui Ueyama @ LLVM Dev Meeting 2017
LLD: A (much) faster linker
• Gold was the fastest linker, but
now LLD is (mostly) faster than
gold.
• Secret sauce
• Laziness
• Certain level of parallelization
• Use
fl
ag -fuse-ld=lld on
GCC and Clang to adopt LLD.
27
Credit: Rui Ueyama @ LLVM Dev Meeting 2017
Conventional Linker
28
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.o B.o C.o
Linker
Executable
WMO / LTO
29
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.ir B.ir C.ir
Linker
Executable
Whole Module / Link Time Optimization
WMO / LTO
29
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.ir B.ir C.ir
Linker
Executable
Whole Module / Link Time Optimization
• Perform more aggressive
whole program optimization
during link time.

• Because we can
fi
nally see
the entire program.
WMO / LTO
29
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
A.ir B.ir C.ir
Linker
Executable
Whole Module / Link Time Optimization
• Perform more aggressive
whole program optimization
during link time.

• Because we can
fi
nally see
the entire program.
• (Traditionally) It’s still hard to
parallelize WMO / LTO.
Thread Thread Thread
ThinLTO
30
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
Linker
Executable
Thread Thread Thread
A.o B.o C.o
Optimizer Optimizer Optimizer
ThinLTO
30
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
Linker
Executable
• Perform inter-procedural
optimizations by exchanging
function summary.

• “Seeing” other functions via
function summary.
Thread Thread Thread
A.o B.o C.o
Optimizer Optimizer Optimizer
ThinLTO
30
A.cpp B.cpp C.cpp
Compiler Compiler Compiler
Linker
Executable
• Perform inter-procedural
optimizations by exchanging
function summary.

• “Seeing” other functions via
function summary.
• ~3x speed up*†

• Using ~10x less memory*†
Thread Thread Thread
A.o B.o C.o
Optimizer Optimizer Optimizer
* Teresa Johnson et al. @ LLVM Dev Metting 2016

† Compare to conventional LTO
Community
A federated community
32
A federated community
32
A federated community
33
Code Owner
Code Owner
Code Owner
A federated community
33
Code Owner
Code Owner
Code Owner
M68k Backend
A federated community
33
Code Owner
Code Owner
Code Owner
M68k Backend
(LLVM Foundation) Board Members
“Linux style” contribution process
34
“Linux style” contribution process
34
Maintainer Maintainer
“Linux style” contribution process
34
Individual Branch


(e.g.
fi
lesystem)
Maintainer
Individual Branch


(e.g. network)
Maintainer
“Linux style” contribution process
34
Individual Branch


(e.g.
fi
lesystem)
Maintainer
Individual Branch


(e.g. network)
Maintainer
Patch Patch
“Linux style” contribution process
34
Individual Branch


(e.g.
fi
lesystem)
Maintainer
Individual Branch


(e.g. network)
Maintainer
Primary Tree
Patch Patch
“Linux style” contribution process
34
Individual Branch


(e.g.
fi
lesystem)
Maintainer
Individual Branch


(e.g. network)
Maintainer
Primary Tree
Pull Request
Pull Request
Patch Patch
LLVM’s contribution process
35
The main
branch
LLVM’s contribution process
35
The main
branch
Tip of Tree (ToT)
LLVM’s contribution process
35
The main
branch
Tip of Tree (ToT)
Author
Reviewer Reviewer
Author
LLVM’s contribution process
36
The main
branch
Tip of Tree (ToT)
Author
Reviewer Reviewer
Author
LLVM’s contribution process
36
The main
branch
Tip of Tree (ToT)
Author
Reviewer Reviewer
Author
Commit Commit
Outline
The Good
The Bad (things that LLVM probably should fix)
Code Review

Learning Resources for Beginners

The Ugly
37
Recap: A federated community
38
Code review with community members
39
Code Review
Code review with community members
40
Code Review
New Contributor
Code review with community members
40
Code Review
New Contributor
?
Code review with community members
41
Code Review
New Contributor
?
Why?
Code review with community members
41
Code Review
New Contributor
?
• New member does not have
enough “review currency” yet.
Why?
Code review with community members
41
Code Review
New Contributor
?
• New member does not have
enough “review currency” yet.
• Patches are less visible.
Why?
Code review with community members
41
Code Review
New Contributor
?
• New member does not have
enough “review currency” yet.
• Patches are less visible.
• Most of the core contributors are
busy.
Why?
Code review with community members
41
Code Review
New Contributor
?
• New member does not have
enough “review currency” yet.
• Patches are less visible.
• Most of the core contributors are
busy.
• Nearly all of them are working on
LLVM as their day jobs!
Why?
Code review with community members
41
Code Review
New Contributor
?
• New member does not have
enough “review currency” yet.
• Patches are less visible.
• Most of the core contributors are
busy.
• Nearly all of them are working on
LLVM as their day jobs!
• Code owners are obligate to review
the patch…but they’re also busy.
Why?
Some attempts…
42
http://llvmweekly.org/reviewcorner
Some attempts…
43
Subscribe to (patch) topics that you’re interested in
Learning Resources
For Beginners
45
LLVM
is hard
LLVM is Flexible
46
LLVM is Flexible
47
“Where should I start?”
48
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
clang
Tools
opt My auto-complete tool
48
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
clang
Tools
opt My auto-complete tool
48
Clang libraries LLVM libraries
libclangParse libLLVMSupport libLLVMCore
libLLVMTransformsUtils libLLVMScalarOpts
libLLVMLLParser
libLLVMMC libLLVMX86Info libLLVMX86CodeGen
libclangAST
libclangSema
libclangCodeGen
clang
Tools
opt My auto-complete tool
49
49
What do you think?
50
What do you think?
50
• What’s your story?
• Project-oriented tutorial

v.s.

A broad overview
• Online forum / mailing list
experiences (for newbie questions)?
• Wiki(-style) book?
Outline
The Good
The Bad
The Ugly (things that are difficult to solve)
API & ABI stability
51
API & ABI Stability
API stability in a nutshell
53
lib.h
int foo(int x, int y);
MySrc.cpp
int main() {


return foo(94, 87);


}
Version 0.1
API stability in a nutshell
54
lib.h
int foo(Point point);
MySrc.cpp
int main() {


return foo(94, 87);


}
Version 0.5
API stability in a nutshell
54
lib.h
int foo(Point point);
MySrc.cpp
int main() {


return foo(94, 87);


}
Version 0.5
Compile Error
LLVM API stability for downstream users
Some common LLVM downstream use cases
55
LLVM API stability for downstream users
Some common LLVM downstream use cases
55
My C++ auto-complete plugin
libclangSema libclangParse
LLVM API stability for downstream users
Some common LLVM downstream use cases
55
My C++ auto-complete plugin
libclangSema libclangParse
My Toy compiler
LLVM IR
Optimizer
LLVM X86
Backend
LLVM API stability for downstream users
56
LLVM
C++ API
Stability
Policy
LLVM API stability for downstream users
56
LLVM
C++ API
Stability
Policy
NONE
LLVM API stability for downstream users
56
LLVM
C++ API
Stability
Policy
NONE
• A pain in the a** for downstream users.

• Behaviors of APIs might also
change!
LLVM API stability for downstream users
56
LLVM
C++ API
Stability
Policy
NONE
• A pain in the a** for downstream users.

• Behaviors of APIs might also
change!
• The C API is (mostly) stable…

• …But the provided features are lag
(way) behind.
LLVM API stability for downstream users
56
LLVM
C++ API
Stability
Policy
NONE
• A pain in the a** for downstream users.

• Behaviors of APIs might also
change!
• The C API is (mostly) stable…

• …But the provided features are lag
(way) behind.
• A design decision made since day 1.

• Trade stability for faster feature
delivery.
ABI stability in a nutshell
57
MyExecutable
int foo(Point point);
int main() {


return foo(Point{94, 87});


}
libFoo.so
Version 0.1
ABI stability in a nutshell
57
MyExecutable
int foo(Point point);
int main() {


return foo(Point{94, 87});


}
libFoo.so
Version 0.1
Shared Library
ABI stability in a nutshell
57
MyExecutable
int foo(Point point);
int main() {


return foo(Point{94, 87});


}
libFoo.so
Version 0.1
Shared Library
Plugin
ABI stability in a nutshell
58
MyExecutable
int foo(Point point);
int main() {


return foo(Point{94, 87});


}
libFoo.so
Version 0.5
?
Shared Library
Plugin
ABI stability in a nutshell
Name mangling
59
MyExecutable
int foo(Point point); libFoo.so
Version 0.5
?
Old: _Z3foo5Point
ABI stability in a nutshell
Name mangling
59
MyExecutable
int foo(Point point); libFoo.so
Version 0.5
?
Old: _Z3foo5Point
New: ?foo@@YAHUPoint@@@Z
ABI stability in a nutshell
Type layout
60
MyExecutable
int foo(Point point) {


return point.X + point.Y;


}
libFoo.so
Version 0.5
?
struct Point {


int X;


int Y;


};
Old
ABI stability in a nutshell
Type layout
60
MyExecutable
int foo(Point point) {


return point.X + point.Y;


}
libFoo.so
Version 0.5
?
struct Point {


int X;


int Y;


};
Old
struct Point {


int X;


int LMAO;


int Y;


};
New
LLVM ABI stability for plugins
All available plugin options in Clang & LLVM
61
Clang LLVM
Preprocessor: Pragma plugin
Sema: Attribute plugin
AST: AST plugin
LLVM IR: Pass plugin (old / new)
LLVM ABI stability for plugins
If LLVM Pass plugin has a stable ABI…
62
opt -my-pass
LLVM version X.Y
MyPassPlugin.so
LLVM ABI stability for plugins
If LLVM Pass plugin has a stable ABI…
62
opt -my-pass
LLVM version X.Y
MyPassPlugin.so
LLVM ABI stability for plugins
If LLVM Pass plugin has a stable ABI…
62
opt -my-pass
LLVM version X.Y
opt -my-pass
LLVM version Y.Z
MyPassPlugin.so
LLVM ABI stability for plugins
63
LLVM Plugin
LLVM Plugin
“You have stable

ABI, right?”
“…right?…”
LLVM ABI stability for plugins
63
LLVM Plugin
LLVM Plugin
“You have stable

ABI, right?”
“…right?…”
• Again, trading stability for
fl
exibility
• LLVM plugins are pretty powerful.
LLVM ABI stability for plugins
63
LLVM Plugin
LLVM Plugin
“You have stable

ABI, right?”
“…right?…”
• Again, trading stability for
fl
exibility
• LLVM plugins are pretty powerful.
• Real world use case: Chromium
LLVM ABI stability for plugins
63
LLVM Plugin
LLVM Plugin
“You have stable

ABI, right?”
“…right?…”
• Again, trading stability for
fl
exibility
• LLVM plugins are pretty powerful.
• Real world use case: Chromium
• Using custom clang plugin to enforce
coding styles inside Chromium’s code
base.
• E.g. Catching bad C++ dtor
LLVM ABI stability for plugins
63
LLVM Plugin
LLVM Plugin
“You have stable

ABI, right?”
“…right?…”
• Again, trading stability for
fl
exibility
• LLVM plugins are pretty powerful.
• Real world use case: Chromium
• Using custom clang plugin to enforce
coding styles inside Chromium’s code
base.
• E.g. Catching bad C++ dtor
• “Don’t write a clang plugin” @ Chromium
Docs - https://bit.ly/3rIUg0f
Thank You!
Questions?
65
Email: minyihh@uci.edu 

Github: mshockwave
Appendix
67
67
> ./greeting -say “World”


Hello, World
67
#include “llvm/Support/CommandLine.h”


#include <iostream>


#include <string>


using namespace llvm;


static cl::opt<std::string>


GreetingText(“say”, cl::desc(“What to say?”));


int main(int argc, char **argv) {


cl::ParseCommandLineOptions(argc, argv);


std::cout << “Hello, ” << GreetingText << “n”


return 0;


}
> ./greeting -say “World”


Hello, World
68
#include “llvm/Support/CommandLine.h”


#include <iostream>


#include <string>


using namespace llvm;


static cl::opt<std::string>


GreetingText(“say”, cl::desc(“What to say?”));


int main(int argc, char **argv) {


cl::ParseCommandLineOptions(argc, argv);


std::cout << “Hello, ” << GreetingText << “n”


return 0;


}
> c++ file.cc … -I<LLVM include dir> 


-L<LLVM library path> 


-o greeting -lLLVMSupport
Scenario: Adding a new target (backend)
69
…

Assembly syntax

Instruction encoding

…
70
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
Compiler
Assembler
Assembler
Source Files
70
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
Compiler
Assembler
Assembler
Source Files
Know how to 

print assembly
70
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
Compiler
Assembler
Assembler
Source Files
Know how to 

print assembly
Know how to 

parse assembly
70
Frontend


Source Files
Optimizer


Source Files
Backend


Source Files
Compiler
Assembler
Assembler
Source Files
Know how to 

print assembly
Know how to 

parse assembly
Di
ff
erent Codebases!
71
Frontend
Optimizer
Backend
Assembler
LLVM Solution: Sharing target description library
71
Frontend
Optimizer
Backend
Assembler
Target Description Library


(e.g. libLLVMX86Desc)
LLVM Solution: Sharing target description library
71
Frontend
Optimizer
Backend
Assembler
Target Description Library


(e.g. libLLVMX86Desc)
Assembly Printer
LLVM Solution: Sharing target description library
71
Frontend
Optimizer
Backend
Assembler
Target Description Library


(e.g. libLLVMX86Desc)
Assembly Printer
Assembly Parser
LLVM Solution: Sharing target description library
LLVM’s binary tooling ecosystem
72
Target Description Library
LLVM’s binary tooling ecosystem
72
Target Description Library
MC Layer
Binary Format Library
LLVM’s binary tooling ecosystem
72
Target Description Library
MC Layer
Assembler
Disassembler
Binary Format Library
} llvm-mc
LLVM’s binary tooling ecosystem
72
Target Description Library
MC Layer
Assembler
Disassembler
Binary Format Library
llvm-objdump
llvm-nm
} llvm-mc
LLVM’s binary tooling ecosystem
72
Target Description Library
MC Layer
Assembler
Disassembler
Binary Format Library
llvm-objdump
llvm-nm
LLD (Linker)
} llvm-mc
LLVM’s binary tooling ecosystem
73
Target Description Library
MC Layer
Assembler
Disassembler
llvm-objdump
Binary Format Library
llvm-nm
LLD (Linker)
Why?
LLVM’s binary tooling ecosystem
73
Target Description Library
MC Layer
Assembler
Disassembler
llvm-objdump
Binary Format Library
llvm-nm
LLD (Linker)
Why?
• Binary tools (e.g. binutils) are
essential for many compilation
fl
ows.
LLVM’s binary tooling ecosystem
73
Target Description Library
MC Layer
Assembler
Disassembler
llvm-objdump
Binary Format Library
llvm-nm
LLD (Linker)
Why?
• Binary tools (e.g. binutils) are
essential for many compilation
fl
ows.
• Faster feature updates.
LLVM’s binary tooling ecosystem
73
Target Description Library
MC Layer
Assembler
Disassembler
llvm-objdump
Binary Format Library
llvm-nm
LLD (Linker)
Why?
• Binary tools (e.g. binutils) are
essential for many compilation
fl
ows.
• Faster feature updates.
• Avoid version mismatch.
LLVM’s binary tooling ecosystem
74
Target Description Library
MC Layer
Assembler
Disassembler
llvm-objdump
Binary Format Library
llvm-nm
LLD (Linker)
75
Frontend
Optimizer
Backend
Assembler
Target Description Library


(e.g. libLLVMX86Desc)
Recap: Sharing target information
76
Frontend
Optimizer
Backend
Compiler Process
Assembler Process
Assembler
Linker Process
Linker
Recap: Traditional compilation pipeline
76
Frontend
Optimizer
Backend
Compiler Process
Assembler Process
Assembler
Linker Process
Linker
Recap: Traditional compilation pipeline
.s
fi
le .o
fi
le
77
Frontend
Optimizer
Backend
Compiler + Assembler Process
Assembler
Linker Process
Linker
?
77
Frontend
Optimizer
Backend
Compiler + Assembler Process
Assembler
Linker Process
Linker
?
• An assembly
fi
le always comes

from a single source
fi
le
77
Frontend
Optimizer
Backend
Compiler + Assembler Process
Assembler
Linker Process
Linker
?
• An assembly
fi
le always comes

from a single source
fi
le
• Avoid round-trip (i.e. read/write 

assembly
fi
le) to disk
78
Frontend
Optimizer
Backend
A clang that uses integrated assembler
Assembler
Clang’s integrated assembler
In-memory LLVM IR
In-memory LLVM IR
Textual assembly code
In-memory MCInst objects

More Related Content

PDF
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
PDF
Глеб Смирнов: Что нового в FreeBSD 10.0
PDF
Next Stop, Android
PDF
Identifying Hotspots in Software Build Processes
PDF
Kernel Recipes 2015: Anatomy of an atomic KMS driver
PDF
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
PDF
P2P Container Image Distribution on IPFS With containerd and nerdctl
PDF
Startup Containers in Lightning Speed with Lazy Image Distribution
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
Глеб Смирнов: Что нового в FreeBSD 10.0
Next Stop, Android
Identifying Hotspots in Software Build Processes
Kernel Recipes 2015: Anatomy of an atomic KMS driver
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
P2P Container Image Distribution on IPFS With containerd and nerdctl
Startup Containers in Lightning Speed with Lazy Image Distribution

What's hot (20)

PDF
containerdの概要と最近の機能
PDF
Digging for Android Kernel Bugs
PDF
Staying Afloat with Buoy: A High-Performance HTTP Client (0.1.1)
PPTX
How to implement a simple dalvik virtual machine
PDF
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
PDF
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
KEY
ICSE2011_SRC
PDF
DockerとKubernetesをかけめぐる
PDF
Android Native Development Kit
PDF
Starting up Containers Super Fast With Lazy Pulling of Images
PDF
Staying Afloat with Buoy: A High-Performance HTTP Client
PDF
BuildKitでLazy Pullを有効にしてビルドを早くする話
PDF
Build and Run Containers With Lazy Pulling - Adoption status of containerd St...
PPTX
PDF
eStargzイメージとlazy pullingによる高速なコンテナ起動
PPTX
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
PDF
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
PDF
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
KEY
Improving code quality with continuous integration (PHPBenelux Conference 2011)
PDF
Linux: the first second
containerdの概要と最近の機能
Digging for Android Kernel Bugs
Staying Afloat with Buoy: A High-Performance HTTP Client (0.1.1)
How to implement a simple dalvik virtual machine
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
ICSE2011_SRC
DockerとKubernetesをかけめぐる
Android Native Development Kit
Starting up Containers Super Fast With Lazy Pulling of Images
Staying Afloat with Buoy: A High-Performance HTTP Client
BuildKitでLazy Pullを有効にしてビルドを早くする話
Build and Run Containers With Lazy Pulling - Adoption status of containerd St...
eStargzイメージとlazy pullingによる高速なコンテナ起動
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
Improving code quality with continuous integration (PHPBenelux Conference 2011)
Linux: the first second
Ad

Similar to [COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly (20)

PDF
Introduction to the LLVM Compiler System
PPT
PDF
Os Lattner
PPTX
07 140430-ipp-languages used in llvm during compilation
PDF
BUD17-302: LLVM Internals #2
PPTX
Reames-FalconKeynote java falcon about jit.pptx
PPTX
LLVM Compiler
PDF
LCU14 209- LLVM Linux
PDF
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
PDF
An Overview of LLVM Link Time Optimization
PPTX
OptView2 - C++ on Sea 2022
PDF
LLVM Compiler - Link Time Optimization
PDF
Part II: LLVM Intermediate Representation
PPTX
LLVM-Based-Compiler-for-a-Custom-Language (2).pptx
PDF
The compilation process
PPT
Introduction to llvm
PDF
Boosting Developer Productivity with Clang
PDF
不深不淺,帶你認識 LLVM (Found LLVM in your life)
ODP
Advanced Linux Game Programming
PDF
Clang: More than just a C/C++ Compiler
Introduction to the LLVM Compiler System
Os Lattner
07 140430-ipp-languages used in llvm during compilation
BUD17-302: LLVM Internals #2
Reames-FalconKeynote java falcon about jit.pptx
LLVM Compiler
LCU14 209- LLVM Linux
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
An Overview of LLVM Link Time Optimization
OptView2 - C++ on Sea 2022
LLVM Compiler - Link Time Optimization
Part II: LLVM Intermediate Representation
LLVM-Based-Compiler-for-a-Custom-Language (2).pptx
The compilation process
Introduction to llvm
Boosting Developer Productivity with Clang
不深不淺,帶你認識 LLVM (Found LLVM in your life)
Advanced Linux Game Programming
Clang: More than just a C/C++ Compiler
Ad

More from Min-Yih Hsu (14)

PDF
Debug Information And Where They Come From
PDF
MCA Daemon: Hybrid Throughput Analysis Beyond Basic Blocks
PDF
Handling inline assembly in Clang and LLVM
PDF
How to write a TableGen backend
PDF
[TGSA Academic Friday] How To Train Your Dragon - Intro to Modern Compiler Te...
PDF
Paper Study - Demand-Driven Computation of Interprocedural Data Flow
PDF
Paper Study - Incremental Data-Flow Analysis Algorithms by Ryder et al
PDF
Souper-Charging Peepholes with Target Machine Info
PDF
From V8 to Modern Compilers
PDF
Introduction to Khronos SYCL
PDF
Trace Scheduling
PDF
Polymer Start-Up (SITCON 2016)
PDF
War of Native Speed on Web (SITCON2016)
PDF
From Android NDK To AOSP
Debug Information And Where They Come From
MCA Daemon: Hybrid Throughput Analysis Beyond Basic Blocks
Handling inline assembly in Clang and LLVM
How to write a TableGen backend
[TGSA Academic Friday] How To Train Your Dragon - Intro to Modern Compiler Te...
Paper Study - Demand-Driven Computation of Interprocedural Data Flow
Paper Study - Incremental Data-Flow Analysis Algorithms by Ryder et al
Souper-Charging Peepholes with Target Machine Info
From V8 to Modern Compilers
Introduction to Khronos SYCL
Trace Scheduling
Polymer Start-Up (SITCON 2016)
War of Native Speed on Web (SITCON2016)
From Android NDK To AOSP

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
A Presentation on Artificial Intelligence
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Electronic commerce courselecture one. Pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
A Presentation on Artificial Intelligence
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The AUB Centre for AI in Media Proposal.docx
Encapsulation_ Review paper, used for researhc scholars
Electronic commerce courselecture one. Pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf

[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly