4 ms·
Is it the case that you can implement just a new backend and produce good machine code for your processor, or really do you need to modify the frontend to get i
by chrisseaton 10y ago
Is it the case that you can implement just a new backend and produce good machine code for your processor, or really do you need to modify the frontend to get it to generate code IR from which you can generate good machine code, because otherwise useful information has been lost by time you get the IR from the frontend?
- trsohmers 10y agoWe have played around with having "hints" in the original source code that will be preserved through the IR, but the vast majority of the optimizations and scheduling decisions we need to do are happening once it has been converted into machine code by the backend. I may be slightly off (I'm the dumb CEO/hardware architect), but I'm fairly sure 85%-90% of our compiler work has been done on the backend... I just remember being told some tweaks were made to clang due to some weird issue.
- CalChris 10y agoIt's really three stages, not frontend and backend. The first stage is the LLVM front end, Clang and other language parsers. They generate IR. The middle stage is the LLVM optimizer, opt, which takes IR and runs a variety of optimization passes. Opt takes and gives IR. http://llvm.org/docs/Passes.html http://llvm.org/docs/Passes.html The third is the backend code generator. It lowers IR to the target ISA. There's a tablegen description, there's are MI scheduler models which abstract architectural information as well. http://llvm.org/docs/WritingAnLLVMBackend.html http://llvm.org/docs/WritingAnLLVMBackend.html I think you really meant can you write an optimizing pass specifically for your target? Yes. But I don't think that modifying the real front end Clang is going to get you much of anything. Intrinsics are different; that's the programmer inserting ISA specific instructions rather than Clang extracting ISA specific information. Really, modifying Clang isn't going to get you anything. Thomas, what were the 'small' Clang specific tweaks?