LLVM 2.5
id:miura1729 さん経由。どんどんバージョンアップされている印象。
はたしてわたしのコンパイラのような何かはちゃんと追随できるだろうか。わたしは以下の FAQ の2番目、自分で LLVM IR を書く、というのを選択していて S式で書いているけど、現時点でわたしがよく分かっていない命令はまったくサポートしていないのだった。そもそも型としても i32 と i1 くらいしか使っていないし、invoke も使っていない。
I'd like to write a self-hosting LLVM compiler. How should I interface with the LLVM middle-end optimizers and back-end code generators?
Your compiler front-end will communicate with LLVM by creating a module in the LLVM intermediate representation (IR) format. Assuming you want to write your language's compiler in the language itself (rather than C++), there are 3 major ways to tackle generating LLVM IR from a front-end:
for: best tracks changes to the LLVM IR, .ll syntax, and .bc format
for: enables running LLVM optimization passes without a emit/parse overhead
for: adapts well to a JIT context
against: lots of ugly glue code to write
- Emit LLVM assembly from your compiler's native language.
for: very straightforward to get started
against: the .ll parser is slower than the bitcode reader when interfacing to the middle end
against: you'll have to re-engineer the LLVM IR object model and asm writer in your language
against: it may be harder to track changes to the IR
- Emit LLVM bitcode from your compiler's native language.
for: can use the more-efficient bitcode reader when interfacing to the middle end
http://www.llvm.org/docs/FAQ.html#langirgen
against: you'll have to re-engineer the LLVM IR object model and bitcode writer in your language
against: it may be harder to track changes to the IR
LLVM 勉強会までに勉強して、良い機会なのでいろいろ聞けるように準備しよう。宜しくお願いします>参加者各位。