[LLVMdev] Re: global variable

Chris Lattner sabre at nondot.org
Tue Jun 6 14:17:21 PDT 2006


Note: please don't email me directly, please email the llvmdev list.

On Tue, 6 Jun 2006, Lan Bai wrote:

>> You probably want to pass Gv in as an argument to the call? I don't know 
>> what you're trying to do, so I can't help without more details.
>> 
>> No, Gv is not used as an argument to the call. The return value of the call 
>> is to be assigned to Gv. For example, I want
> %Gv = global uint0;
> %Gv = call my_func(Args);
>
> But now, I can only get:
> %Gv = global uint 0;
> %my_func = call %my_func(Args);

You need to emit a store instruction.  globals are memory, accessed with 
load/store instructions.  Try something like this:

V = new CallInst(...)
new StoreInst(V, GV);

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list