Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LLVMやっていってる
Search
giginet
PRO
January 29, 2019
Programming
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LLVMやっていってる
giginet
PRO
January 29, 2019
More Decks by giginet
See All by giginet
🀄️ on swiftc
giginet
PRO
0
530
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
410
Claude Codeログ基盤の構築
giginet
PRO
7
4.5k
Inside of Swift Export
giginet
PRO
1
3k
Swiftビルド弾丸ツアー - Swift Buildが作る新しいエコシステム
giginet
PRO
0
2.8k
SwiftでMCPサーバーを作ろう!
giginet
PRO
3
450
Creating Intuitive Developer Tool in Swift
giginet
PRO
0
1.6k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.2k
5分でわかるExplicitly Built Modules
giginet
PRO
2
1.9k
Other Decks in Programming
See All in Programming
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
130
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
370
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
280
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
360
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
340
えっ!!コードを読まずに開発を!?
hananouchi
0
220
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.6k
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
530
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
670
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
110
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
200
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
ラッコキーワード サービス紹介資料
rakko
1
4M
The Cult of Friendly URLs
andyhume
79
7k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
650
A Modern Web Designer's Workflow
chriscoyier
698
190k
Optimizing for Happiness
mojombo
378
71k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
470
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Transcript
୭ • @giginet(Twi+er/GitHub) • ւಓവؗࢢग़ • 2009/4 ւಓେֶֶ෦ • 2013/4
ւಓେֶେֶӃɹใՊֶݚڀՊ • 2015/4 ΫοΫύουגࣜձࣾ৽ଔೖࣾ • ϞόΠϧج൫෦ͰiOSͷج൫։ൃ͍ͯ͠·͢ • झຯήʔϜ։ൃͰ͢ • ֶੜ࣌ͷࢥ͍ग़ɿνϟʔɺδϯύɺ࣌ؗ 1
OSSϝϯςφͬͯΔ • fastlane • Carthage ࡞ͬͨͭ • giginet/xcprofiler • giginet/Crossroad
• cookpad/Puree-Swi9 2
࠷ۙڵຯͷ͋Δٕज़ 3
LLVM 4
LLVMͱ • ίϯύΠϥج൫ • ݱࡏͷίϯύΠϥશͯΛ࣮͢Δʹෳࡶ͗͢ΔͷͰɺػց ޠͷੜ࠷దԽͳͲΛڞ௨Խͯ͠࡞ΕΔΑ͏ʹͨ͠Έ • ݱࡏɺଟ͘ͷݴޠͷίϯύΠϥLLVM্Ͱߏங͞Ε͍ͯΔ 5
Θ͍Θ͍swi$c 6
1. ιʔείʔυΛύʔεͯ͠ߏจ(AST)ʹม 2. AST͔ΒLLVM IRΛੜ 3. Ṗͷٕज़ʹΑΓόΠφϦ͕ੜ͞ΕΔ 7
LLVM IR • LLVM Intermediate Representa2on(தؒදݱ) • ࠷ऴతʹ͜ͷܗࣜʹग़ྗ͢Δ͜ͱͰɺLLVMΛ༻͍ͯόΠφϦ͕ੜͰ͖Δ • ଟ͘ͷݴޠͷίϯύΠϥ͕LLVM
IRΛੜ͢ΔLLVM Frontendͱ࣮ͯ͠͞Ε͍ͯΔ 8
#include <stdio.h> int main(void) { printf("Hello World"); return 0; }
$ clang -S -emit-llvm hello.c 9
; ModuleID = 'hello.c' source_filename = "hello.c" target datalayout =
"e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.14.0" @.str = private unnamed_addr constant [12 x i8] c"Hello World\00", align 1 ; Function Attrs: noinline nounwind optnone ssp uwtable define i32 @main() #0 { %1 = alloca i32, align 4 store i32 0, i32* %1, align 4 %2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0)) ret i32 0 } declare i32 @printf(i8*, ...) #1 !llvm.module.flags = !{!0, !1} !llvm.ident = !{!2} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 7, !"PIC Level", i32 2} !2 = !{!"Apple LLVM version 10.0.0 (clang-1000.11.45.5)"} 10
LLVMͷษڧ๏ • LLVM Tutorial • h/ps:/ /llvm.org/docs/tutorial/ • C++ͰՍۭͷؔܕݴޠͷίϯύΠϥΛ࣮͢Δ 11
Kaleidoscope def test(x) 1+2+x; 12
define double @test(double %x) { entry: %addtmp = fadd double
2.000000e+00, 1.000000e+00 %addtmp1 = fadd double %addtmp, %x ret double %addtmp1 } 13
ࢀߟॻ੶ • ͖ͭͶ͞ΜͰΘ͔ΔLLVM • LLVM Cookbook 14
Swi$ίϯύΠϥΠϯλʔϯΓ·͢ʂʂʂ • 3/28 @ ΫοΫύου • Ԡืडதʂʂʂ h"ps:/ /internship.cookpad.com/2019/spring/ 15
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ @giginet 16