[LLVMdev] Primitive types

Vladimir Prus ghost at cs.msu.su
Thu Jun 17 02:36:01 PDT 2004


Hello,
I'm getting this in debugger, where 't' is 'Type*':

   (gdb) p t->isPrimitiveType()
   $15 = false
   (gdb) p t->getPrimitiveID()
   $16 = PointerTyID
   (gdb) p t->getPrimitiveSize()
   $17 = 0

There are a couple of things that I'd like to ask. First, if isPrimitiveType() 
returns false, that the fact that getPrimitiveID returns reasonable value is 
quite strange. Maybe, the method is better called just getID, since it can 
get id for both primitive and derived types.

Second, why getPrimitiveSize() returns 0? In seems that LLVM knows the size a 
pointer occupies (at least it puts in in LLVM assembly), so why not return 
it? For me, that would be quite convenient -- I would only check that type 
passed to a function has size of either 4 or 8 bytes and that would catch 
both primitives and pointers.

- Volodya




More information about the llvm-dev mailing list