Implement RISC-V ASM-to-JSON conversion#506
Implement RISC-V ASM-to-JSON conversion#506anishathalye wants to merge 2 commits intoAbsInt:masterfrom
Conversation
|
I'm neither an expert in CompCert or in OCaml, so any feedback on this PR would be appreciated 🙂 I needed this functionality for a research project I'm working on, so I went ahead and implemented it, but I thought I might as well try contributing upstream in case anyone else could benefit from this. |
|
Thanks for the code! Maybe @bschommer or @m-schmidt could review it, as they wrote the ASM-to-JSON converters for the other platforms, and know this code better than me. |
|
Thanks for the code from us too. The ASM-to-JSON converters are
Can you already tell for which research project you will us this? |
This is used by the Valex tool, right? Anything else? I wouldn't mind if this functionality were changed in the future in a backward-incompatible way, I will pin a version of CompCert, and I can also update my code if there are breaking changes in CompCert.
Sure! I'm working on a follow-up project to Knox (paper, code). I want to dump CompCert's RISC-V Asm AST (before running the Asmexpand stage, so pseudo-instructions like Reusing this AsmToJSON machinery seemed like the easiest way to do it. In my version, I actually need to remove the Asmexpand stage that runs before AsmToJSON. Right now, this is hard-coded, but I was considering adding a flag for that and submitting a PR, so one could do e.g., |
Yes, it used only by Valex atm.
Okay, sounds interesting. Unfortunately for our use cases it's quite the opposite, we want to have less pseudo-instructions in the dumped assembly output, so I would say that we are not that interested in having a switch |
CompCert implements ASM-to-JSON conversion for the ARM and PowerPC architectures, but this functionality is missing for RISC-V. This patch implements this functionality. The implementation is based on the existing ARM/PowerPC
AsmToJSON.mlimplementations.