[LLVMdev] Declaring constant global variables

Eli Friedman eli.friedman at gmail.com
Thu Apr 8 16:57:47 PDT 2010


On Thu, Apr 8, 2010 at 2:31 PM, Zheng Wang <jason.wangz at gmail.com> wrote:
> Can I do this in my own pass module?
> Because the string is actually depended on the type of a value object.

The idea was that you could look at the output and generalize it
appropriately...

-Eli

> On 8 April 2010 20:29, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Thu, Apr 8, 2010 at 12:18 PM, Zheng Wang <jason.wangz at gmail.com> wrote:
>>> Hiya,
>>>
>>> I want to declare a constant global variable as:
>>>
>>> @.str = private constant [4 x i8] c"%f\0A\00", align 1 ; <[4 x i8]*> [#uses=1]
>>>
>>> I guess I should firstly declare an arrayType object, then declare a
>>> GlobalVariable object.
>>>
>>> I have two problems:
>>>
>>> 1. What element type I should set for the arrayType?
>>> 2. How to set the constant value as :c"%f\0A\00"
>>
>> Try passing the given declaration to "llc -march=cpp".
>>
>> -Eli
>>
>
>
>
> --
> Best regards,
>
> WANG Zheng
>



More information about the llvm-dev mailing list