Hello, LLVM MC blog post <http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html> explains fairly well how the backend MC project is working. However, it's not clear to me how LLVM converts an assembly file (.s) to an object file. The driver --verbose option is not giving me much information as well. I want to know the flow. Like, What CodeGen phases does this file pass through? Is it converted to MachineFunction ever? Where does it hook into the backend infrastructure? Any documentation could also be helpful. Regards, Soham Sinha PhD Student, Department of Computer Science Boston University -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180510/e125c7cf/attachment.html>
Passing an assembly file to clang does not go through any CodeGen phases. It operates entirely in the MC layer. No MachineFunctions will be created. It just runs it through the MCAsmParser. Most of the setup for this is in clang's tools/driver/cc1as_main.cpp in the function ExecuteAssembler ~Craig On Thu, May 10, 2018 at 1:32 PM Soham Sinha via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > LLVM MC blog post > <http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html> explains > fairly well how the backend MC project is working. However, it's not clear > to me how LLVM converts an assembly file (.s) to an object file. The driver > --verbose option is not giving me much information as well. I want to know > the flow. Like, What CodeGen phases does this file pass through? Is it > converted to MachineFunction ever? Where does it hook into the backend > infrastructure? Any documentation could also be helpful. > > Regards, > Soham Sinha > PhD Student, Department of Computer Science > Boston University > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180510/10159868/attachment.html>
I think a key point to understand is the MCStreamer interface, which has two implementations: one for object-file generation, and one for .s file generation. CodeGen/AsmPrinter can attach to either of these implementations. MCAsmParser will generally attach to the object-file version of MCStreamer. --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Craig Topper via llvm-dev Sent: Thursday, May 10, 2018 4:47 PM To: soham1 at bu.edu Cc: llvm-dev Subject: Re: [llvm-dev] Assembly file compilation flow Passing an assembly file to clang does not go through any CodeGen phases. It operates entirely in the MC layer. No MachineFunctions will be created. It just runs it through the MCAsmParser. Most of the setup for this is in clang's tools/driver/cc1as_main.cpp in the function ExecuteAssembler ~Craig On Thu, May 10, 2018 at 1:32 PM Soham Sinha via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hello, LLVM MC blog post<http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html> explains fairly well how the backend MC project is working. However, it's not clear to me how LLVM converts an assembly file (.s) to an object file. The driver --verbose option is not giving me much information as well. I want to know the flow. Like, What CodeGen phases does this file pass through? Is it converted to MachineFunction ever? Where does it hook into the backend infrastructure? Any documentation could also be helpful. Regards, Soham Sinha PhD Student, Department of Computer Science Boston University _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180510/d62d3437/attachment-0001.html>