[LLVMdev] Typedef struct types

Pankaj Gode godepankaj at yahoo.com
Sat Sep 22 07:26:28 PDT 2012

Hi All,
I was searching for, extracting information about 'typedefed struct types' from 'module'. 
I have 'struct' typedefed in a .h file. I try to use this structure instance inside a function. 
My .ll file rightly defines this type in the beginning so that it can be used later. (for example below)
%struct.DEBLOCK_UNIT = type { i8*, i8*, i8*, i8, i32, i32, %struct.DEBLOCK_UNIT*, %struct.DEBLOCK_UNIT*, %struct.DEBLOCK_UNIT* }
define void @DeblockAreaFetch(i8* %SrcY, i8* %SrcU, i8* %SrcV, i32 %FrameWidth, %struct.DEBLOCK_UNIT* nocapture %DeblockUnit, i32 %TransferWidth) nounwind {
How to I get information about "%struct.DEBLOCK_UNIT" from the 'Module' of this file ?
The approach I tried was to iterate through the "global variable list" and extract type from there. This works well for below case.
%struct._D_ChannelReg = type { %struct._D_ChannelReg*, i8*, i8*, i32, i32, i32, [2 x i32] }
@gInterPredD = external global %struct._D_ChannelReg*
In this case "gInterPredD" is a global variable and hence I easily get information about it's type and their element type. 
But for the case, where an instance of this 'typedefed struct' is passed as a variable or used inside a function, 
In llvm2.9, we had TypeSymbolTable in module which used to have information about all the types explicitly. I think no such information is present from llvm3.0 onwards due to type system change. 
So, is it the case that I have to get the type information as and when I encounter any variable which is of type 'typedefed struct' only ?
Thanks & Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120922/d556fff9/attachment.html>

More information about the llvm-dev mailing list