<p dir="ltr">Thanks!</p>
<br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 19, 2015, 12:24 AM 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">On 06/19/2015 04:59 AM, Eric Christopher wrote:<br>
> Unittest? :)<br>
<br>
r240124.<br>
<br>
Thanks for paying attention.<br>
<br>
Tobias<br>
<br>
<br>
> -eric<br>
><br>
> On Thu, Jun 18, 2015 at 7:19 PM Tobias Grosser <<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a><br>
> <mailto:<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>>> wrote:<br>
><br>
> 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=WtfWon2C8eVcoAodKpDQraHYqHNJl0ngDVSfXmfqtjs&s=28IQWQRQYWvRCqIT75vWk2RhjnBNmSKgLVWLVM4X55M&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:<br>
> <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=WtfWon2C8eVcoAodKpDQraHYqHNJl0ngDVSfXmfqtjs&s=pTwKeLkm0C8NF_GGky8lZnbdWc7ujkdM-n7XB38tkgU&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.<br>
> The new global<br>
> /// variable will be marked mergable with any others of the same<br>
> contents. If<br>
> /// Name is specified, it is the name of the global variable<br>
> created.<br>
> - GlobalVariable *CreateGlobalString(StringRef Str, const Twine<br>
> &Name = "");<br>
> + GlobalVariable *CreateGlobalString(StringRef Str, const Twine<br>
> &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<br>
> "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:<br>
> <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=WtfWon2C8eVcoAodKpDQraHYqHNJl0ngDVSfXmfqtjs&s=jA6-WwgriTDSBs9AgQZlIvT018X9BILV3tI8KDcG5gI&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<br>
> variable<br>
> /// created.<br>
> GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str,<br>
> - const Twine &Name) {<br>
> + const Twine &Name,<br>
> + unsigned<br>
> AddressSpace) {<br>
> Constant *StrConstant = ConstantDataArray::getString(Context, Str);<br>
> Module &M = *BB->getParent()->getParent();<br>
> GlobalVariable *GV = new GlobalVariable(M, StrConstant->getType(),<br>
> true,<br>
> GlobalValue::PrivateLinkage,<br>
> - StrConstant);<br>
> - GV->setName(Name);<br>
> + StrConstant, Name, nullptr,<br>
> +<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> <mailto:<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>
><br>
<br>
</blockquote></div>