<html><head></head><body><div class="ydp6a16e024yahoo-style-wrap" style="font-family:verdana, helvetica, sans-serif;font-size:10px;"><div><div dir="ltr" data-setdir="false">Hi,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I checked the content of the hello.ll file and I have the bitcode disassembled in it. Compiling without optimizations gives the same result.<br></div><div><br></div><div dir="ltr" data-setdir="false">Regards,<br></div><div class="ydp6a16e024signature"><div style="font-family:verdana, helvetica, sans-serif;font-size:10px;">Iulia<div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>
        <div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_9469010984" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Wednesday, September 18, 2019, 5:58:41 PM GMT+3, Andrzej Warzynski <Andrzej.Warzynski@arm.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">Iulia,<br></div><div dir="ltr"><br></div><div dir="ltr">You need to check the contents of the hello.ll (or hello.bc) file rather<br></div><div dir="ltr">than the input *.c file - ultimately that's what opt consumes.<br></div><div dir="ltr"><br></div><div dir="ltr">Try compiling without any optimisations:<br></div><div dir="ltr"><br></div><div dir="ltr">clang -O0 -emit-llvm -S hello.c -c -o hello.ll<br></div><div dir="ltr"><br></div><div dir="ltr">-Andrzej<br></div><div dir="ltr"><br></div><div dir="ltr">On 18/09/2019 11:34, iulia_s24 wrote:<br></div><div dir="ltr">> Hi,<br></div><div dir="ltr">><br></div><div dir="ltr">> Actually I copy-pasted step 5 from the article in which I found the<br></div><div dir="ltr">> solution, in the text of the mail so that is why dummypass appears<br></div><div dir="ltr">> instead of hello. I used hello instead of dummypass in my tries, but it<br></div><div dir="ltr">> still doesn't display nothing after recompiling the pass. The hello.c<br></div><div dir="ltr">> file contains several functions, so the module pass should display<br></div><div dir="ltr">> something (I placed a message at the verry beginning of the runOnModule<br></div><div dir="ltr">> funtion of the pass). I am compiling all the code once with ninja on<br></div><div dir="ltr">> Linux and I have seen that the hello pass is compiled as well. I have<br></div><div dir="ltr">> not compiled it separatelly.<br></div><div dir="ltr">><br></div><div dir="ltr">> Do you have any ideas why is this?<br></div><div dir="ltr">><br></div><div dir="ltr">> Thank you,<br></div><div dir="ltr">> Iulia<br></div><div dir="ltr">><br></div><div dir="ltr">><br></div><div dir="ltr">><br></div><div dir="ltr">> Trimis de pe smartphone-ul meu Samsung Galaxy.<br></div><div dir="ltr">><br></div><div dir="ltr">> -------- Mesaj original --------<br></div><div dir="ltr">> De la: Andrzej Warzynski <<a ymailto="mailto:Andrzej.Warzynski@arm.com" href="mailto:Andrzej.Warzynski@arm.com">Andrzej.Warzynski@arm.com</a>><br></div><div dir="ltr">> Date: 17.09.2019 10:44 (GMT+02:00)<br></div><div dir="ltr">> Către: Iulia Stirb <<a ymailto="mailto:iulia_s24@yahoo.com" href="mailto:iulia_s24@yahoo.com">iulia_s24@yahoo.com</a>>, via Llvm-dev<br></div><div dir="ltr">> <<a ymailto="mailto:llvm-dev@lists.llvm.org" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>>, nd <<a ymailto="mailto:nd@arm.com" href="mailto:nd@arm.com">nd@arm.com</a>><br></div><div dir="ltr">> Subiect: Re: [llvm-dev] How to debug passes<br></div><div dir="ltr">><br></div><div dir="ltr">> Hi Iulia,<br></div><div dir="ltr">><br></div><div dir="ltr">> You can skip step 5 - it's not required. opt will happily work with *.ll<br></div><div dir="ltr">> as well as *.bc files. Since textual form _is_ much easier to read for<br></div><div dir="ltr">> humans, you can generate it directly in step 4:<br></div><div dir="ltr">><br></div><div dir="ltr">> clang -O3 -emit-llvm -S hello.c -c -o hello.ll<br></div><div dir="ltr">><br></div><div dir="ltr">> Otherwise your steps look correct (assuming that when registering your<br></div><div dir="ltr">> pass with RegisterPass<> you used 'dummypass' as the name for your<br></div><div dir="ltr">> pass). Did you verify that hello.ll contains any functions? And have you<br></div><div dir="ltr">> tried similar steps with the Hello pass?<br></div><div dir="ltr">><br></div><div dir="ltr">> -Andrzej<br></div><div dir="ltr">><br></div><div dir="ltr">> On 16/09/2019 14:49, Iulia Stirb via llvm-dev wrote:<br></div><div dir="ltr">>  > Hi,<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > Could you please confirm the following steps for debugging a pass?<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > 1. copy your pass into llvm/lib/Transforms/Hello/Hello.cpp<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > 2. name you pass Hello<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > 3. insert debug messages like:|<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  > |    errs() << "Vis­iting func­tion " << F.get­Name();|<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  > ||4. get LLVM bitcode:<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  >      clang -O3 -emit-llvm hello.c -c -o hello.bc<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > |5. disassemble the bitcode:<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > |    llvm-dis hel­lo.bc|<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > 6. |run the pass on your program:<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  >      opt -load lib­dum­my­pass.so -dum­my­pass hel­lo.ll|<br></div><div dir="ltr">>  > |<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > The above steps did not work because the last step does not display any<br></div><div dir="ltr">>  > error message that has been added in the pass.<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > Could you please help to debug the pass by displaying the error messages?<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > Thank you.<br></div><div dir="ltr">>  > Kind regards,<br></div><div dir="ltr">>  > Iulia<br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  ><br></div><div dir="ltr">>  > _______________________________________________<br></div><div dir="ltr">>  > LLVM Developers mailing list<br></div><div dir="ltr">>  > <a ymailto="mailto:llvm-dev@lists.llvm.org" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br></div><div dir="ltr">>  > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div><div dir="ltr">>  ><br></div><div dir="ltr">> IMPORTANT NOTICE: The contents of this email and any attachments are<br></div><div dir="ltr">> confidential and may also be privileged. If you are not the intended<br></div><div dir="ltr">> recipient, please notify the sender immediately and do not disclose the<br></div><div dir="ltr">> contents to any other person, use it for any purpose, or store or copy<br></div><div dir="ltr">> the information in any medium. Thank you.<br></div><div dir="ltr">IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.<br></div></div>
            </div>
        </div></body></html>