[LLVMdev] using a structs datafield as operand

Alexander Poddey alexander.poddey at gmx.net
Fri Feb 27 10:26:36 PST 2015


Hi all,

I need to exchange operands of e.g. instructions by others of the same type.
Suppose I need to replace a double typed operand; a possible candidate could 
be a double typed datafield of a struct.

The typefinder shows how to recursively crawl types using 
llvm::Type::subtype_reverse_iterator and thereby compiles a list of types 
occuring in the module.

I could determine when I arrived at the 'deepest' level (an actual 
datafield) by
getNumContainedTypes() (returns 0 in this case).

Suppose I descended from e.g. a global struct down to a double field (of 
that struct).
How and which information would I extract/store in order to be able to use 
the datafield as operand to an instruction later on?

Thanks
Alex

 
 





More information about the llvm-dev mailing list