mollusc icon indicating copy to clipboard operation
mollusc copied to clipboard

Insights from another project

Open darleybarreto opened this issue 3 years ago • 8 comments

Hi William, how are you?

First I want say thank you for the great and detailed writing of your series on LLVM internals. Second, this is an impressive work and I wish all the best here! Unfortunately this kind of stuff is waaay out of my capacity, but hopefully I can help in the near future somehow. Until that day comes (if at all), I thought on contributing on a discussion, are you familiar with vicis? The goal seems to be making a codegen similar to LLVM (at some extent), but a more practical one seems to be LLVM-IR manipulation too.

I sincerely don't know how both project could mutually help each other, but it seemed relevant to ask.

darleybarreto avatar Sep 18 '21 18:09 darleybarreto

Hi @darleybarreto!

This is incredible! I had no idea this existed, and it looks like the author(s) are aiming for a very similar goal. I might be misunderstanding, but the big difference seems to be that they're starting from the textual IR representation, while I'm starting from the binary ("bitcode") representation.

I'll reach out to them further to figure out whether there's a reasonable integration point between the projects, similarly to how #3 proposes that be integrate with llvm-ir.

woodruffw avatar Sep 20 '21 14:09 woodruffw

Great, hopefully there are things to share between the projects!

darleybarreto avatar Sep 21 '21 17:09 darleybarreto

Hello, I'm the author of vicis! I didn't know this project existed.

but the big difference seems to be that they're starting from the textual IR representation

Yes I'm currently focusing on the textual representation, but I was gonna implement bitcode parser. I'd like to say thank you to @woodruffw because mollusc is a perfect project to learn how the bitcode works. Also I'm very interested in contributing to mollusc!

maekawatoshiki avatar Jan 29 '22 08:01 maekawatoshiki

Awesome! More contributors are always welcome :slightly_smiling_face:

Let me know if there's any way I can help on vicis as well -- you seem to be much further along than I am, and you've done some incredibly impressive stuff with hooking the IR up to codegen. If you do decide to implement a bitcode parser as well, you may find the llvm-bitstream and llvm-bitcursor crates in mollusc helpful -- they provide the lowest level parser for the format.

woodruffw avatar Jan 29 '22 19:01 woodruffw

vicis's code is currently way more messy than mollusc since I was not so familiar with the entire structure of LLVM in the beginning. Let me know if you wrote some code using vicis and found clumsy interface :)

Besides, the mollusc README.md says that it's gonna implement a high-level interface. I'm interested in if you already planned what to implement. I could help the part.

maekawatoshiki avatar Jan 30 '22 04:01 maekawatoshiki

Yeah, the plan with the high-level interface was something similar to what you have with vicis: APIs for visiting each Function/BasicBlock/Instruction.

If you're interested in helping with that, I think that needs the most help is the llvm-mapper crate -- that's the component responsible for turning the bitstream into something resembling an llvm::Module, with all of the correct internal state. Right now it has support for a few basic components, but it badly needs support for FUNCTION_BLOCKs so that we can begin mapping the actual bodies of functions.

woodruffw avatar Jan 30 '22 04:01 woodruffw

I'll look into the llvm-mapper crate, and hopefully add support for FUNCTION_BLOCK. Thank you for providing useful information!

maekawatoshiki avatar Jan 30 '22 05:01 maekawatoshiki

No problem! Thanks a ton for looking into it.

woodruffw avatar Jan 30 '22 05:01 woodruffw