Rob bor78 via llvm-dev
2018-Jul-05 14:25 UTC
[llvm-dev] Where is the code that is called when clang calls the job which generates IR?
Where is the source code that is called when the clang binary executable
calls the command/job which compiles C code to IR?
I am using Clang as a library (basically a simplified version of the main
function in /tools/clang/tools/driver/driver.cpp).
My program creates an instance of clang::driver::Driver. I pass arguments
to TheDriver.BuildCompilation(args)). And then call ExecuteCompilation.
Everything works.
When I call TheDriver.PrintActions(*C) the output is
0: input, "testcode.cpp", c++
1: preprocessor, {0}, c++-cpp-output
2: compiler, {1}, ir
3: backend, {2}, assembler
4: assembler, {3}, object
5: linker, {4}, image
And when I loop over the jobs inside the Compilation object I see that the
clang binary executable is called 4 times (using execve) and finally ld.lld
is called.
I'm interested in the call to clang for "2: compiler, {1}, ir".
Is /tools/clang/tools/driver/driver.cpp called again? It seems that the
main function in driver.cpp eventually calls itself again. If not what is
called, and where is the source code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180705/91463ed3/attachment.html>
via llvm-dev
2018-Jul-09 13:33 UTC
[llvm-dev] Where is the code that is called when clang calls the job which generates IR?
(Remembering to add llvm-dev this timeā¦)
If you look at the argc/argv for the "2: compiler" case, the first
option should be "-cc1" which will cause the driver to dispatch to
cc1_main(), which is in cc1_main.cpp.
--paulr
From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Rob
bor78 via llvm-dev
Sent: Thursday, July 05, 2018 10:25 AM
To: llvm-dev at lists.llvm.org
Subject: [llvm-dev] Where is the code that is called when clang calls the job
which generates IR?
Where is the source code that is called when the clang binary executable calls
the command/job which compiles C code to IR?
I am using Clang as a library (basically a simplified version of the main
function in /tools/clang/tools/driver/driver.cpp).
My program creates an instance of clang::driver::Driver. I pass arguments to
TheDriver.BuildCompilation(args)). And then call ExecuteCompilation. Everything
works.
When I call TheDriver.PrintActions(*C) the output is
0: input, "testcode.cpp", c++
1: preprocessor, {0}, c++-cpp-output
2: compiler, {1}, ir
3: backend, {2}, assembler
4: assembler, {3}, object
5: linker, {4}, image
And when I loop over the jobs inside the Compilation object I see that the clang
binary executable is called 4 times (using execve) and finally ld.lld is called.
I'm interested in the call to clang for "2: compiler, {1}, ir".
Is /tools/clang/tools/driver/driver.cpp called again? It seems that the main
function in driver.cpp eventually calls itself again. If not what is called, and
where is the source code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180709/3ef59d20/attachment.html>
Jatin Bhateja via llvm-dev
2018-Jul-09 18:08 UTC
[llvm-dev] Where is the code that is called when clang calls the job which generates IR?
Look for code in clang/lib/CodeGen/ Easy starting point could be void CodeGenFunction::EmitFunctionBody; Cheers On Thu, Jul 5, 2018 at 7:55 PM, Rob bor78 via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Where is the source code that is called when the clang binary executable > calls the command/job which compiles C code to IR? > > I am using Clang as a library (basically a simplified version of the main > function in /tools/clang/tools/driver/driver.cpp). > > My program creates an instance of clang::driver::Driver. I pass arguments > to TheDriver.BuildCompilation(args)). And then call ExecuteCompilation. > Everything works. > > When I call TheDriver.PrintActions(*C) the output is > > 0: input, "testcode.cpp", c++ > 1: preprocessor, {0}, c++-cpp-output > 2: compiler, {1}, ir > 3: backend, {2}, assembler > 4: assembler, {3}, object > 5: linker, {4}, image > > And when I loop over the jobs inside the Compilation object I see that the > clang binary executable is called 4 times (using execve) and finally ld.lld > is called. > > I'm interested in the call to clang for "2: compiler, {1}, ir". > > Is /tools/clang/tools/driver/driver.cpp called again? It seems that the > main function in driver.cpp eventually calls itself again. If not what is > called, and where is the source code? > > _______________________________________________ > 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/20180709/f1ef021f/attachment.html>