[llvm-commits] [llvm-gcc-4.2] r65490 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Chris Lattner
clattner at apple.com
Wed Feb 25 16:31:09 PST 2009
On Feb 25, 2009, at 4:10 PM, Dale Johannesen wrote:
>
> On Feb 25, 2009, at 4:05 PMPST, Stuart Hastings wrote:
>
>> Author: stuart
>> Date: Wed Feb 25 18:05:28 2009
>> New Revision: 65490
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=65490&view=rev
>> Log:
>> Put all normal (no embedded NUL characters), constant STRING_CSTs in
>> the .cstring section.
>
> No, this needs to be Darwin-specific. I thought somebody did this
> already? If not you may want a new hook in TargetData.
Right, this should be target-specific. The idiom we're using in llvm-
gcc is to define an LLVM target-macro (e.g. in darwin.h) and then
change the code to something like:
#ifdef LLVM_STRING_SECTION
>> + // Try to put it into the .cstring (__TEXT, __cstring) section.
>> + if (StringIsConstant && static_cast<ConstantArray*>(Init)-
>> >isCString())
>> + GV->setSection(LLVM_STRING_SECTION);
>> return GV;
>
#endif
Then darwin.h just gets a LLVM_STRING_SECTION #define.
-Chris
>
>
>> Modified:
>> llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65490&r1=65489&r2=65490&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Feb 25 18:05:28 2009
>> @@ -7181,6 +7181,9 @@
>> TAI-
>>> getStringConstantPrefix() :
>> ".str", TheModule);
>> if (SlotP) *SlotP = GV;
>> + // Try to put it into the .cstring (__TEXT, __cstring) section.
>> + if (StringIsConstant && static_cast<ConstantArray*>(Init)-
>>> isCString())
>> + GV->setSection("__TEXT, __cstring");
>> return GV;
>> }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090225/fe252350/attachment.html>
More information about the llvm-commits
mailing list