A question about getElementPtr

I'm busy writing the code that translates the LLVM construct GetElementPtr into my virtual circuit representation. Since GetElementPtr handles structures, I can end up at the end with a pointer to some literal type, and know the literal type, but not know the pointer type of what I have, at least not explicitly from the bytecode.

This has made me think I have to massage my context table so that literal types can find their pointer types just so I can properly put this resulting pointer into the correct type/value slot.

Am I missing something here? Sure would be nice if the resulting type were explicit in the instruction.

Cheers,

-- Robert.

Robert,

Perhaps this will help:
http://llvm.org/docs/GetElementPtr.html

You should be able to just retain the pointer type as you traverse the
arrays/structs.

Reid.

In our in-memory IR, the type of the result is explicitly represented in memory (just use GEP->getType()). In the .bc file, this information is 100% redundant with the information about the operands to the GEP, so we don't bother encoding the destination type. Doing so would just be a waste of space.

-Chris