<div dir="ltr">Unittest? :)<div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 18, 2015 at 7:19 PM Tobias Grosser <<a href="mailto:tobias@grosser.es">tobias@grosser.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: grosser<br>
Date: Thu Jun 18 21:12:07 2015<br>
New Revision: 240113<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D240113-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=OSgrft-sAk0N-2asgToli9F8IThR-HR5kCcQDOQ6wRA&s=wy3LKUD-dvdEFyfQ3ZGMkCr891E3l_vlEy5-k3xKmGg&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=240113&view=rev</a><br>
Log:<br>
IRBuilder: Allow globals to be constructed in a specific address space<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/IRBuilder.h<br>
    llvm/trunk/lib/IR/IRBuilder.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/IR/IRBuilder.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_IR_IRBuilder.h-3Frev-3D240113-26r1-3D240112-26r2-3D240113-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=OSgrft-sAk0N-2asgToli9F8IThR-HR5kCcQDOQ6wRA&s=mh3uQMSUzdBq_k8dZoao9taiZtmrhxscbRcyCQ0j320&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=240113&r1=240112&r2=240113&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)<br>
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Thu Jun 18 21:12:07 2015<br>
@@ -245,7 +245,8 @@ public:<br>
   /// filled in with the null terminated string value specified.  The new global<br>
   /// variable will be marked mergable with any others of the same contents.  If<br>
   /// Name is specified, it is the name of the global variable created.<br>
-  GlobalVariable *CreateGlobalString(StringRef Str, const Twine &Name = "");<br>
+  GlobalVariable *CreateGlobalString(StringRef Str, const Twine &Name = "",<br>
+                                     unsigned AddressSpace = 0);<br>
<br>
   /// \brief Get a constant value representing either true or false.<br>
   ConstantInt *getInt1(bool V) {<br>
@@ -1191,8 +1192,9 @@ public:<br>
<br>
   /// \brief Same as CreateGlobalString, but return a pointer with "i8*" type<br>
   /// instead of a pointer to array of i8.<br>
-  Value *CreateGlobalStringPtr(StringRef Str, const Twine &Name = "") {<br>
-    GlobalVariable *gv = CreateGlobalString(Str, Name);<br>
+  Value *CreateGlobalStringPtr(StringRef Str, const Twine &Name = "",<br>
+                               unsigned AddressSpace = 0) {<br>
+    GlobalVariable *gv = CreateGlobalString(Str, Name, AddressSpace);<br>
     Value *zero = ConstantInt::get(Type::getInt32Ty(Context), 0);<br>
     Value *Args[] = { zero, zero };<br>
     return CreateInBoundsGEP(gv->getValueType(), gv, Args, Name);<br>
<br>
Modified: llvm/trunk/lib/IR/IRBuilder.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_IR_IRBuilder.cpp-3Frev-3D240113-26r1-3D240112-26r2-3D240113-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=OSgrft-sAk0N-2asgToli9F8IThR-HR5kCcQDOQ6wRA&s=BetHZ945ykkvuqbQLBu_tep3Y3gmJTspI0Wzq0XmejI&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IRBuilder.cpp?rev=240113&r1=240112&r2=240113&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/IRBuilder.cpp (original)<br>
+++ llvm/trunk/lib/IR/IRBuilder.cpp Thu Jun 18 21:12:07 2015<br>
@@ -25,13 +25,15 @@ using namespace llvm;<br>
 /// specified.  If Name is specified, it is the name of the global variable<br>
 /// created.<br>
 GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str,<br>
-                                                  const Twine &Name) {<br>
+                                                  const Twine &Name,<br>
+                                                  unsigned AddressSpace) {<br>
   Constant *StrConstant = ConstantDataArray::getString(Context, Str);<br>
   Module &M = *BB->getParent()->getParent();<br>
   GlobalVariable *GV = new GlobalVariable(M, StrConstant->getType(),<br>
                                           true, GlobalValue::PrivateLinkage,<br>
-                                          StrConstant);<br>
-  GV->setName(Name);<br>
+                                          StrConstant, Name, nullptr,<br>
+                                          GlobalVariable::NotThreadLocal,<br>
+                                          AddressSpace);<br>
   GV->setUnnamedAddr(true);<br>
   return GV;<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>