[llvm-dev] Can I dump LLVM IR after each pass in Clang BackendUtil.cpp

596 views
Skip to first unread message

Zhengyang Liu via llvm-dev

unread,
Jun 12, 2016, 8:38:40 AM6/12/16
to llvm...@lists.llvm.org
Dear llvm-dev,

I am trying to debug some passes , these passes are added to
legacy::PassManager(MPM) in Clang's lib/CodeGen/BackendUtil.cpp :


//******
void EmitAssemblyHelper::CreatePasses() {
//******
if (CodeGenOpts.MemSafety) {
//
// Add passes that record information about run-time checks.
//
MPM->add (createCommonMSCInfoPass());
MPM->add (createSAFECodeMSCInfoPass());
//******

Could I dump the output LLVM IR after each pass in PassManager MPM?

Best regards,
Zhengyang.
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Zhengyang Liu via llvm-dev

unread,
Jun 12, 2016, 9:11:28 AM6/12/16
to martin....@movidius.com, llvm...@lists.llvm.org

It solved my question, thank you.


Best regards,

Zhengyang.




From: Martin J. O'Riordan <martin....@movidius.com>
Sent: Sunday, June 12, 2016 9:01 PM
To: 'Zhengyang Liu'
Subject: RE: [llvm-dev] Can I dump LLVM IR after each pass in Clang BackendUtil.cpp
 
I think that:

   -mllvm -print-after-all

does that you need.  It is "very" verbose though and you might prefer to use:

   -mllvm -print-after=<selected-passes>

Use '-mllvm -help' or '-mllvm --help-hidden' to see all the options.

        MartinO

John Criswell via llvm-dev

unread,
Jun 12, 2016, 1:09:15 PM6/12/16
to Zhengyang Liu, llvm...@lists.llvm.org
On 6/12/16 8:11 AM, Zhengyang Liu via llvm-dev wrote:

It solved my question, thank you.


Alternatively, you can add a BitcodeWriter (or whatever it's called) pass.  This pass writes the bitcode out to a file.  As it is an LLVM pass, you can schedule it like any other pass.

Regards,

John Criswell
-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
Reply all
Reply to author
Forward
0 new messages