obtain programer-defined structure name.

Hi, I intend to trace the Use instructions of a variable object in its lifecycle, so, the first step is to obtain the type of the object. However, the datastructure object is complicated typed value, such as "struct file f" in linux kernel.
The problerm is what operations should be taken to obtain the type of Value "struct file", and locate or such type Values
in a procedure.
Have I made myself clear? thanks.

Tian Shuo
2010-5-24

Hello Tian,

I assume you might try writing an analyzer for C-compiled bitcode.

Hi, I intend to trace the Use instructions of a variable object in its lifecycle, so, the first step is to obtain the type of the object. However, the datastructure object is complicated typed value, such as "struct file *f" in linux kernel.

At first, types with same type layout each other shall be treated
identically on LLVM type system.
And *name* is not ID but label(symbol) on the system. eg.

struct A {int a; int b;};
struct B {unsigned u; unsigned v;};

Both A and B are treated as same type.

You may see pretty type presentation with llvm::WriteTypeSymbolic()
http://llvm.org/doxygen/namespacellvm.html#ac5866be1ccf6effdfe9ff1c393e60969
But you might meet only either of names A or B.
See http://llvm.org/docs/LangRef.html#namedtypes

The problerm is what operations should be taken to obtain the type of Value "struct *file", and locate or such type Values in a procedure.

Good. It would be needed to track not only GEP but several pointer
operation! (eg. bitcast, inttoptr)
also I am trying a sort of type analysis now.

886,
Takumi