Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
TableGenと和解せよ / make peace with TableGen
Search
Arata
August 23, 2023
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TableGenと和解せよ / make peace with TableGen
Arata
August 23, 2023
More Decks by Arata
See All by Arata
Black Hat USA 2026の面白かった発表を紹介
arata_nvm
1
28
Operating Systems: Three Easy Pieces, Chapter 49 / Sun's Network File System (NFS)
arata_nvm
0
27
デコンパイラ研究調査
arata_nvm
1
53
コンパイラ基盤を支える言語たち
arata_nvm
1
130
LLVMのDSL”TableGen”向け言語サーバーの開発
arata_nvm
0
48
5分でわかるPage-Fault Weird Machine
arata_nvm
2
470
eBPFを用いたAndroid向けデバッガ「eDBG」のx86_64 Linuxへの移植
arata_nvm
0
30
Pythonのcopy-and-patch JITの実装を読む
arata_nvm
0
210
eBPFを使った動的解析手法
arata_nvm
1
850
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2.2k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
540
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
590
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
530
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
530
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
790
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
Transcript
TableGenと和解せよ 2023/08/21 Ando Shin / @Arata
TableGenとは • コンパイラ基盤LLVMの内部で使用されているDSL • レジスタや命令など、ターゲットマシン固有の情報を 記述するために用いられることが多い • 一般にはC++のコードに変換される 2
https://github.com/llvm/llvm-project/blob/1c822e1e8278ebefdb7701249bdfe51f1ed03d7d/llvm/lib/Target/X86/X86RegisterInfo.td#L163-L184 例: TableGenでX86のレジスタを記述 3
TableGen嫌われがち問題 4
• エディタの支援を受けられない • 情報がまとまっていない • C++と組み合わせてのビルドに手間がかかる なぜTableGenは嫌われているのか 5
• エディタの支援を受けられない • 情報がまとまっていない • C++と組み合わせてのビルドに手間がかかる なぜTableGenは嫌われているのか 6
2022年5月から言語サーバーが実装され始める 今日までに実装された機能: • シンタックスハイライト • エラー表示 • 定義へ移動 • 参照へ移動
• ホバー表示 エディタ支援の現状 7
2022年5月から言語サーバーが実装され始める 今日までに実装された機能: • シンタックスハイライト • エラー表示 • 定義へ移動 • 参照へ移動
• ホバー表示 コードの入力補完が実装されていない エディタ支援の現状 8
入力補完を実装した 9
• 言語サーバーの応答性が悪い • 一部のコードで支援機能を提供できない • 内部実装が言語サーバー向きではない 現状の言語サーバーの問題点 10
エラー表示・補完候補が更新されるまで時間がかかる様子 問題点1: 言語サーバーの応答性が悪い 11
考えられる原因: • 言語サーバーがシングルスレッドで動いている • パースと同時に評価を行っている ◦ コードが変更されるたびにすべてのシンボルの解決処理が走る 問題点1: 言語サーバーの応答性が悪い 12
• これはコード側に原因がある • includeが適切に行われないためシンボルを解決できない 問題点2: 一部のコードで支援機能を提供できない 13 A.td B.td ※Registerはllvm/Target/Target.tdで定義
コードの構造を保持するための方法にASTとCSTがある • AST: Abstract Syntax Tree (rustcで使われる) • CST: Concrete
Syntax Tree (rust-analyzerで使われる) TableGenではASTが使われているため、以下の問題がある • トークンの場所やコメントなどの情報が失われてしまう • 構文エラーがあった場所でパースが止まってしまう 問題点3: 内部実装が言語サーバー向きではない 14
RustでTableGenの新たな言語サーバーを実装しています 目指すところ: • キャッシュを使った処理の高速化 • エラーからの回復機能を持つパーサーの実装 • 一般的な支援機能の実装 • (TableGenのパーサーを提供して誰かがTableGen2.0を
作ってくれることを期待) 今していること 15