[LLVMdev] Extending LLVM for high-level types

Alexandre Cossette alex.cossette at gmail.com
Wed Jan 12 12:42:05 PST 2011


Hi all,

I'm designing a programming language named C³ (or C3). I'm already using LLVM as a back-end for my prototype compiler and it's wonderful to use. Thanks for such a great system!

I now have more ambitious goals and I would like to use the LLVM IR as my internal C³ IR. C³ is designed to support what I call "value-oriented programming" and it fits naturally with the design of LLVM. The idea is to apply SSA-based optimizations on user-defined types.

I would like to know if you think this plan makes sense:
- Add a new derived type that is uniqued by name for C³ types
- Add new intrinsic functions for C³ expressions with special semantics
- Emit this "extended LLVM" from my abstract syntax tree
- Run the mem2reg pass as is for SSA construction
- Run optimization passes that can run as is with the new type (like GVN?)
- Run a new pass that lowers the extended LLVM to normal LLVM
- Run (or rerun) normal LLVM optimization passes
- Emit native code using normal LLVM
- Profit!

Alex





More information about the llvm-dev mailing list