Typedef struct types

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,

Hi Pankaj, you may find include/llvm/TypeFinder.h useful.

Ciao, Duncan.

This file was very much useful.
I could get the required information by referencing contents from this file.

Thanks & Regards,