[LLVMdev] GlobalValue Type

Duncan Sands baldrick at free.fr
Wed Oct 19 11:40:40 PDT 2011


Hi Shrey, if you declare a global variable of type T, then the GlobalVariable
object (call it G) always has type T*.  It's a pointer to the memory in which
the T is held.  So to write a T value to the global, you can just store it to
G.

Ciao, Duncan.

>      I am wondering why the following variable  has  a PointerTy.
>
> @foo.data = internal addrspace(3) global float 5.000000e+000, align 4
>
> When I do a V->getType()->dump() on the variable its printed as
>
> float addrspace(3)*
>
>
> thanks
> shrey
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list