[LLVMdev] Declaring constant global variables

Zheng Wang jason.wangz at gmail.com
Thu Apr 8 14:31:17 PDT 2010


Can I do this in my own pass module?
Because the string is actually depended on the type of a value object.

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