<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Dear Byungchang,<br>
      <br>
      The OnlyCFG parameter tells the LLVM PassManager whether your pass
      modifies a function's control-flow graph (CFG) (i.e., does your
      pass change the branches between basic blocks or add or remove
      basic blocks).  The PassManager can avoid re-running analysis
      passes in some cases if the CFG is left unmodified.  If you're
      unsure of what to put in this field, put false.<br>
      <br>
      Setting the AnalysisPass option to true tells the PassManager that
      your pass never modifies the program.  If it is set to false, a
      pass *may* modify the program (but it is not required to do so). 
      If in doubt, set this to false.<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<br>
      <br>
      <br>
      On 8/10/14, 9:39 PM, Byungchan An wrote:<br>
    </div>
    <blockquote
cite="mid:CAC_qwH+XMrdX0AX+cdNiSndaYmRzCHyFQOz1b59S3_bnbdb5RQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello. This is Byungchan An.
        <div>I have a question on meaning of parameters in RegisterPass.</div>
        <div><br>
        </div>
        <div>In the LLVM Pass examples, I see the followings.</div>
        <div>
          <pre style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;line-height:15px;padding:0.5em;border:1px solid rgb(204,204,204);background-color:rgb(248,248,248);color:rgb(0,0,0)"><span class="" style="color:rgb(0,112,32);font-weight:bold">static</span> <span class="">RegisterPass</span><span class="" style="color:rgb(102,102,102)"><</span><span class="">Hello</span><span class="" style="color:rgb(102,102,102)">></span> <span class="">X</span><span class="">(</span><span class="" style="color:rgb(64,112,160)">"hello"</span><span class="">,</span> <span class="" style="color:rgb(64,112,160)">"Hello World Pass"</span><span class="">,</span>
                             <span class="" style="color:rgb(0,112,32)">false</span> <span class="" style="color:rgb(96,160,176);font-style:italic">/* Only looks at CFG */</span><span class="">,</span>
                             <span class="" style="color:rgb(0,112,32)">false</span> <span class="" style="color:rgb(96,160,176);font-style:italic">/* Analysis Pass */</span><span class="">);</span></pre>
        </div>
        <div>Here I have one question, what means by only looking at
          CFG?</div>
        <div>If I set it third parameters as "true" what limitations I
          have?</div>
        <div><br>
        </div>
        <div>Second, the last parameter, Analysis Pass means it doesn't
          change IR given as input. Am I right? Then, why the following
          example I got from the llvm website set the last parameter as
          false?</div>
        <div><br>
        </div>
        <div>Thanks.</div>
        <div>
          <pre style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;line-height:15px;padding:0.5em;border:1px solid rgb(204,204,204);background-color:rgb(248,248,248);color:rgb(0,0,0)"><span class="" style="color:rgb(0,112,32)">#include "llvm/Pass.h"</span>
<span class="" style="color:rgb(0,112,32)">#include "llvm/IR/Function.h"</span>
<span class="" style="color:rgb(0,112,32)">#include "llvm/Support/raw_ostream.h"</span>

<span class="" style="color:rgb(0,112,32);font-weight:bold">using</span> <span class="" style="color:rgb(0,112,32);font-weight:bold">namespace</span> <span class="">llvm</span><span class="">;</span>

<span class="" style="color:rgb(0,112,32);font-weight:bold">namespace</span> <span class="">{</span>
  <span class="" style="color:rgb(0,112,32);font-weight:bold">struct</span> <span class="">Hello</span> <span class="" style="color:rgb(102,102,102)">:</span> <span class="" style="color:rgb(0,112,32);font-weight:bold">public</span> <span class="">FunctionPass</span> <span class="">{</span>
    <span class="" style="color:rgb(0,112,32);font-weight:bold">static</span> <span class="" style="color:rgb(144,32,0)">char</span> <span class="">ID</span><span class="">;</span>
    <span class="">Hello</span><span class="">()</span> <span class="" style="color:rgb(102,102,102)">:</span> <span class="">FunctionPass</span><span class="">(</span><span class="">ID</span><span class="">)</span> <span class="">{}</span>

    <span class="" style="color:rgb(0,112,32);font-weight:bold">virtual</span> <span class="" style="color:rgb(144,32,0)">bool</span> <span class="">runOnFunction</span><span class="">(</span><span class="">Function</span> <span class="" style="color:rgb(102,102,102)">&</span><span class="">F</span><span class="">)</span> <span class="">{</span>
      <span class="">errs</span><span class="">()</span> <span class="" style="color:rgb(102,102,102)"><<</span> <span class="" style="color:rgb(64,112,160)">"Hello: "</span><span class="">;</span>
      <span class="">errs</span><span class="">().</span><span class="">write_escaped</span><span class="">(</span><span class="">F</span><span class="">.</span><span class="">getName</span><span class="">())</span> <span class="" style="color:rgb(102,102,102)"><<</span> <span class="" style="color:rgb(64,112,160)">'\n'</span><span class="">;</span>
      <span class="" style="color:rgb(0,112,32);font-weight:bold">return</span> <span class="" style="color:rgb(0,112,32)">false</span><span class="">;</span>
    <span class="">}</span>
  <span class="">};</span>
<span class="">}</span>

<span class="" style="color:rgb(144,32,0)">char</span> <span class="">Hello</span><span class="" style="color:rgb(102,102,102)">::</span><span class="">ID</span> <span class="" style="color:rgb(102,102,102)">=</span> <span class="" style="color:rgb(64,160,112)">0</span><span class="">;</span>
<span class="" style="color:rgb(0,112,32);font-weight:bold">static</span> <span class="">RegisterPass</span><span class="" style="color:rgb(102,102,102)"><</span><span class="">Hello</span><span class="" style="color:rgb(102,102,102)">></span> <span class="">X</span><span class="">(</span><span class="" style="color:rgb(64,112,160)">"hello"</span><span class="">,</span> <span class="" style="color:rgb(64,112,160)">"Hello World Pass"</span><span class="">,</span> <span class="" style="color:rgb(0,112,32)">false</span><span class="">,</span> <span class="" style="color:rgb(0,112,32)">false</span><span class="">);</span></pre>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>