<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">On 11/20/14, 12:22 PM, Zahra Marj
wrote:<br>
</div>
<blockquote
cite="mid:CAKSnXa_TwNFxd-9BA=Hid_SL-RwK8h7_mKM8NgqmeyM_7EPaaA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style="font-family:tahoma,sans-serif" class="gmail_default"><font
color="#000000" face="Times New Roman" size="3">
</font>
<p style="margin:0in 0in 10pt" class="MsoNormal"><font
color="#000000" face="Times New Roman" size="3">Hi.</font></p>
<p style="margin:0in 0in 10pt" class="MsoNormal"><font
color="#000000" face="Times New Roman" size="3">I would
like to change order of code basic blocks “in memory”
without changing behavior of code. For finding basic block
memory address, I
use blockaddress(@function, %block) in .ll file
(intermediate representation),
but it doesn’t work well. I would like to see basic blocks
in memory
explicitly.</font></p>
</div>
</div>
</blockquote>
<br>
<font size="3"><font face="Times New Roman">I don't think the LLVM
IR has a way to express the virtual memory address at which a
basic block is placed. The blockaddress feature (if I recall
correctly) is used at the LLVM IR level to build indirect
branches for jump tables.<br>
<br>
If you want to change the order that basic blocks are placed in
memory, I think you can simply reorder the basic blocks within
the list of basic blocks that belong to a function. The code
generator typically generates native code for basic blocks in
the order in which they appear in the function, so if you change
the order within the list, they get generated in a different
order (the control flow between basic blocks will not change as
each basic block ends with an explicit branch or return
instruction).<br>
<br>
Please note that doing it this way is taking advantage of a side
effect within the code generator. Future versions of LLVM can
layout the basic blocks any way it likes, so while it will
probably work today, it may not work in the future.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
</font></font>
<blockquote
cite="mid:CAKSnXa_TwNFxd-9BA=Hid_SL-RwK8h7_mKM8NgqmeyM_7EPaaA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style="font-family:tahoma,sans-serif" class="gmail_default"><font
color="#000000" face="Times New Roman" size="3">
</font>
<p style="margin:0in 0in 10pt" class="MsoNormal"><font
color="#000000" face="Times New Roman" size="3">Is
changing place of basic blocks in CFG using successors
and predecessors helpful?</font></p>
<font color="#000000" face="Times New Roman" size="3">
</font>
<p style="margin:0in 0in 10pt" class="MsoNormal"><font
color="#000000" face="Times New Roman" size="3">What parts
of LLVM help me and how? I am a newbie on LLVM.</font></p>
<p style="margin:0in 0in 10pt" class="MsoNormal"><font
color="#000000" face="Times New Roman" size="3">Thanks.</font></p>
<font color="#000000" face="Times New Roman" size="3">
</font></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>
<br>
<pre class="moz-signature" cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
</body>
</html>