Is there a structure type isomorphism check in LLVM 3.0?

In LLVM-3.0, the named structures are always unique, and pointer equality with other structurally identical structures does not work. From the blog entry on LLVM-3.0 types , my highlights are:

Identified structures are the kind we are talking about: they can have a name and can indicate their body after creating the type. A specific structure is not unique with other types of structure , so they are created using StructType :: create (...). Since the identified types are potentially recursive, asmprinter always prints them by their name (or a number like% 42 if the identified structure does not have a name).

This checks for type equality by checking the type pointer. For example, the haskell llvm package depends on the fact that the pointers of type llvm are equal for checking compile-time types and types.

Is there a way to verify that two structures are isomorphic (same structure)? Preferably in llvm-c api?

+3
source share
1 answer

In the C ++ API, the StructType class has

bool StructType::isLayoutIdentical(StructType *Other) const

This function iterates through StructTypes to make sure they are equal.

+3
source