SAYER Christian
2008-Sep-18 10:15 UTC
[LLVMdev] Beginner needs some glue between Kaleidoscope and other docs
Hi Folks, I am just starting to get familiar with the llvm framework, thank you at first for this nice tool which seems really powerful! I have studied so far the Kaleidoscope example and other docs at llvm.org and try to figure out which would be the "right" way (well I suppose there are many) to integrate the framework into my compiler project, but there is still quite a gap between the tutorial and the multitude of things that can be found in the docs... What I want to do: The source language could be considered as a basic subset of C, with some custom "instructions", and without expressions, only statements. I write instructions here because most of the statements map quite directly to the hardware. I would like llvm to do some optimizations like constant propagation, loop optimization etc. , and register allocation on the standard arithmetic/logic subset of instructions. Finally, it should emit a (specified, non standard) assembler code. What I think I'll have to do: -straight forward parse and pass to llvm IR. Actually I don't even see the need of an AST since there aren't any expressions to resolve. Additionally, the source typically generated code. At this point I think I'll have to extend the IRBuilder to support the custom instructions. -run standard optimization passes on the IR code. Add custom optimization passes to support custom instruction optimization. -add information and/or code about the target hardware (registers, ...) to llvm to make it able to allocate registers. add a backend to llvm to support my instruction set and assembler syntax. (i.e. write a lib/Target/MyProc) Please, could you comment on this approach? Given the fact that my source and target are way less complex than e.g. C/x86, llvm should have enough (if not too many : ) facilities to achieve this. Thank you, Christian
Apparently Analagous Threads
- [LLVMdev] [PATCH] docs/tutorial/ Kaleidoscope typos
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Function calls only being JIT'd once by Kaleidoscope with MCJIT?
- [LLVMdev] Mapping of class derivated and interfaces