GlobalValue Type

Hi
    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

Hi
     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)*

A Global is globally allocated memory. @foo.data is a pointer to that globally allocated memory: http://llvm.org/docs/LangRef.html#globalvars

-- John T.

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.