<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 04/25/2012 08:02 PM, Cristianno Martins wrote:
<blockquote cite="mid:E7D141B678B9437189E749A815465CED@gmail.com"
type="cite">
<div> Hello Tomas,
<div><br>
</div>
</div>
</blockquote>
Hi!<br>
<blockquote cite="mid:E7D141B678B9437189E749A815465CED@gmail.com"
type="cite">
<div>
<div>I'm a little bit new here too, but I guess I could try to
help you. First, let me see if I get your project straight:
you are writing a tool that should (let's say) help students
to identify what does a loop seems like after a chosen
transformation. Is that the case? If so, your first objective
would be isolating a loop transformation and avoid other
transformations to mess up with the transformed loop, right?</div>
<div><br>
</div>
</div>
</blockquote>
Yes, I think you got me right. <br>
<blockquote cite="mid:E7D141B678B9437189E749A815465CED@gmail.com"
type="cite">
<div>
<div>Well, as far as I know, every analysis and transformation
in LLVM is a Pass. If you want to see which passes and the
order that they were called, you could pass <span
style="font-family: Menlo; font-size: 11px; ">--debug-pass=Structure</span> when
using opt, and the PassManager will print the call list for
you.</div>
<div><br>
</div>
</div>
</blockquote>
I have already found out that opt can help me but thanks anyway. I
think this could be my approach:<br>
- Think up how to mark the loop which is wanted to be transformed
and how to get that mark through the compiler frontend from the
source to the IR. I guess I could use #pragma or implement new
__attribute__ for that.<br>
- Then I have to store that mark in the IR form. I could probably
use IR metadata for that but I have to look at them more to find out
if this could suit my needs.<br>
- And finally I have to implement new pass which will search the
given IR for specified mark and transform the marked loop
accordingly. <br>
<br>
If any of you think my vision is wrong or you have better ideas feel
free to express your opinions.<br>
<br>
<blockquote cite="mid:E7D141B678B9437189E749A815465CED@gmail.com"
type="cite">
<div>
<div>If you want only one transformation to be called, you could
disable in opt all analysis and transformations (I guess -o0
is the default), and enable only the ones that you are
interested in (something like -transform1 -transform2 etc.).
Keep in mind that the transformations could need different
types of analysis (that will be also printed by the
PassManager), and, sometimes, should be interesting for a
transformation the combination of it with another
transformations that only will clean up the code (such as dead
code elimination, for example). For a list of all passes
available in LLVM, please check <a moz-do-not-send="true"
href="http://llvm.org/docs/Passes.html" style="color: rgb(0,
106, 227); ">http://llvm.org/docs/Passes.html</a>.</div>
<div><br>
</div>
<div>I advise you to have a read in <a moz-do-not-send="true"
href="http://llvm.org/docs/WritingAnLLVMPass.html"
style="color: rgb(0, 106, 227); ">http://llvm.org/docs/WritingAnLLVMPass.html</a> too,
to get a better idea of how the passes work.</div>
<div><br>
</div>
<div>Hope I could help,</div>
</div>
<div>
<div><br>
</div>
</div>
</blockquote>
Thanks for your feedback! I will definitely look at those links.<br>
<blockquote cite="mid:E7D141B678B9437189E749A815465CED@gmail.com"
type="cite">
<div>
<div>-- </div>
<div>Cristianno Martins</div>
<div>PhD Student of Computer Science</div>
<div>University of Campinas</div>
<div><a class="moz-txt-link-abbreviated" href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a></div>
<div><br>
</div>
</div>
<p style="color: #A0A0A8;">On Tuesday, 24 de April de 2012 at
18:19, Tomáš Heger wrote:</p>
<blockquote type="cite"
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span>
<div>
<div>
<div>Hi everyone!</div>
<div><br>
</div>
<div>I would like to create a tool which would "simulate"
several loop </div>
<div>transformations. It should serve as a part of my
bachelor thesis.</div>
<div><br>
</div>
<div>Typical usage of that tool would be this:</div>
<div>Mark a loop in a source (probably C/C++) file and
specify desired </div>
<div>transformation in a predefined way (for example a
special comment or </div>
<div>something). -> Run the tool on that "crafted"
source file. -> Watch the </div>
<div>result (which should be in an input language or
possibly in LLVM IR).</div>
<div><br>
</div>
<div>I know that LLVM can do some of the loop
transformations but as far as I </div>
<div>know it decides itself what transformation (if any)
will be done. Or am </div>
<div>I mistaken? Is it possible to specify which loop is
supposed to be </div>
<div>transformed and how? Is it easily possible to get the
(above mentioned) </div>
<div>mark through the compiler frontend so it would appear
in the LLVM IR as </div>
<div>well? Then maybe I could write my own pass and use
the `opt` command to </div>
<div>run it on the .ll file and watch it before and after
the pass. Am I </div>
<div>mistaken? Is there a better way?</div>
<div><br>
</div>
<div>Do you understand what I want to achieve? Is LLVM
suitable for my needs? </div>
<div>What should I read? Where should I start? What would
you advise me?</div>
<div><br>
</div>
<div>Thanks for all your answers and ideas.</div>
<div><br>
</div>
<div>-- </div>
<div>Regards,</div>
<div>Tomas Heger</div>
<div><br>
</div>
<div>_______________________________________________</div>
<div>LLVM Developers mailing list</div>
<div><a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a moz-do-not-send="true"
href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div>
<div><a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div>
</div>
</div>
</span> </blockquote>
<div> <br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Regards,
Tomas Heger
</pre>
</body>
</html>