[LLVMdev] questions

xli3 at uiuc.edu xli3 at uiuc.edu
Tue Sep 17 11:27:01 PDT 2002


Sorry I got really overwhelmed by so many classes and member
functions in LLVM.  So would you please clarify some problems
I have?

1. If I see this instruction in the function.

%S.i = alloca %struct.SimpleStruct

Suppose SimpleStruct is as following:
struct.SimpleStruct = type { int, double }

When I read the instruction, how can I know the type of
simplstruct, should I use 'getType' member function like
Inst.getType()? If I use that, I will get a PointerType, how
can I use it?

2. Another question is that since we do the scalar replacement
on each function. If the program look like this.

struct s {
   int a;
   float b;
}
fun1( struct s *ps) {
   ps->a = 1;
   ps->b = 2;
}
main( )
{
        struct s mystru;

	fun1( &mystru );
}

When we process the function 'fun1', should we change fun1 to
something like
fun1( int *a, float *b )
then change fun1(&mystru) in main to something like
fun1( &mystru.a, &mystru.b)?

Thanks,
xiaodong




More information about the llvm-dev mailing list