<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 Song,<br>
<br>
My best guess on the problem is that you're not adding the new
basic block C to the function when you create it.<br>
<br>
The BasicBlock::Create() method allows you to specify a NULL
pointers for the parent function and for the basic block before
which to insert the new basic block. If you specify those, then I
think that will alleviate the error.<br>
<br>
If you're creating basic blocks and not specifying into what
function they should go or in what order in the basic block list
they should be, then you might get the error that you're seeing.
There's a way to insert an existing basic block into a function,
but I don't know off hand what that is.<br>
<br>
I hope this helps. Let us know if it doesn't.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
On 8/23/14, 7:06 PM, <a class="moz-txt-link-abbreviated" href="mailto:songy92@stanford.edu">songy92@stanford.edu</a> wrote:<br>
</div>
<blockquote cite="mid:2014082317060657033313@stanford.edu"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ????; color: rgb(0, 0, 0); line-height: 1.5; }</style>
<div><span></span>Hi All,</div>
<div>I am new to LLVM and now involved into a problem, would it be
possible to get some help?</div>
<div><br>
</div>
<div>I want to insert a new basic block into a program by writing
a pass. For example, there are block A and B in the original
block where A jumps to B:</div>
<div>A -> B.</div>
<div><br>
</div>
<div>For now I want to insert a block C bewteen them:</div>
<div>A -> C -> B.</div>
<div><br>
</div>
<div>However, if the branch instruction from A to C or from C to B
is created, an error message occurs:</div>
<div>bb->getName() = C</div>
<div> "<span style="background-color: rgba(0, 0, 0, 0); font-size:
10.5pt; line-height: 1.5;">The basic block does not exist in
the map.</span><span style="font-size: 10.5pt; line-height:
1.5; background-color: window;">"=</span><span
style="font-size: 10.5pt; line-height: 1.5; background-color:
window;">The basic block does not exist in the map.</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;"><br>
</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;">So, how can I add the new block C
to the original map?</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;"><br>
</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;">Thank you very much!</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;"><br>
</span></div>
<div><span style="font-size: 10.5pt; line-height: 1.5;
background-color: window;">Song</span></div>
<div><br>
</div>
<div><br>
</div>
<hr style="width: 210px; height: 1px;" align="left"
color="#b5c4df" size="1">
<div><span>
<div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE:
10pt">
<div>Research Intern in Dept. of Computer Science, Stanford
University</div>
<div><span style="font-size: 10pt; line-height: 1.5;
background-color: rgba(0, 0, 0, 0);">Email:
<a class="moz-txt-link-abbreviated" href="mailto:songy92@stanford.edu">songy92@stanford.edu</a>,</span><span style="font-size:
10pt; line-height: 1.5; background-color: window;"> </span><a
moz-do-not-send="true"
href="mailto:yaosong1992@gmail.com" style="font-size:
10pt; line-height: 1.5; background-color: window;">yaosong1992@gmail.com</a><span
style="font-size: 10pt; line-height: 1.5;
background-color: rgba(0, 0, 0, 0);"> </span></div>
<div><br>
</div>
</div>
</span></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>