<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 9/10/13 1:50 PM, Rasha Omar wrote:<br>
</div>
<blockquote
cite="mid:CACKsOi_3szgr6t_z3LGLneMAAXfzQff94Mc9rYfY_jT75OoJtA@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">
<div>Hi All,<br>
<br>
</div>
I need to call global variable by its name from the following
code<br>
<br>
for(Function::iterator i=F->begin();i!=F->end();++i)<br>
{<br>
BasicBlock*Bb =&*i;<br>
GlobalVariable* GV = new GlobalVariable(type,false,
F->getLinkage(),0, "F$"+Bb->getName()); <br>
GV->setInitializer(Constant::getNullValue (typ));<br>
GList.push_back(GV);<br>
}<br clear="all">
<div>
<div>
<div><br>
</div>
<div>Could I solve that by mapping the global variables in
Stringmap?<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
If you know the name of the GlobalVariable that you want to find,
you can use the Module::getGlobalVariable() method to get a pointer
to it:<br>
<br>
<a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1Module.html#a17ebd56685ee19e7761ae577cd511e25">http://llvm.org/doxygen/classllvm_1_1Module.html#a17ebd56685ee19e7761ae577cd511e25</a><br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CACKsOi_3szgr6t_z3LGLneMAAXfzQff94Mc9rYfY_jT75OoJtA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>I need to identify the global variable with its name in
the IR to be able to load and store its values.<br>
<br>
</div>
<div>Thanks<br>
</div>
<div><br>
<br>
</div>
<div>-- <br>
<div dir="ltr"><b style="color:rgb(32,18,77)"><span> </span>Rasha
Salah Omar<br>
<span> </span> Msc Student at E-JUST<br>
<span> </span> Demonestrator at Faculty of
Computers and Informatics<br>
<span> </span> Benha University</b>
<p
style="color:rgb(32,18,77);font-size:13px;font-family:arial,helvetica,clean,sans-serif;background-color:transparent;font-style:normal"><b><span>
e-mail: <a moz-do-not-send="true"
href="mailto:rasha.omar@ejust.edu.eg"
target="_blank">rasha.omar@ejust.edu.eg</a></span></b></p>
<font size="4"><span
style="font-family:Arial,Helvetica,sans-serif;font-size:12px;border-collapse:collapse;color:rgb(69,69,69)">
<div
style="padding:0px;display:block;line-height:normal">
<span
style="font-size:20pt;color:rgb(0,176,80);font-family:Webdings">P</span><b><span
style="font-size:11pt;color:rgb(0,176,80);font-family:sans-serif"> Please
consider the environment before printing this
email.</span></b></div>
</span></font><br>
</div>
</div>
</div>
</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>