cdisselkoen / llvm-ir

LLVM IR in natural Rust data structures
MIT License
539 stars 45 forks source link

Add source element type for GEP instructions #45

Closed Benjins closed 1 year ago

Benjins commented 1 year ago

This uses LLVMGetGEPSourceElementType, which is present since llvm 14 (see https://github.com/llvm/llvm-project/commit/573a9bc4ad7fed92db5105ea75e0f9573712f973). It is necessary for analyzing LLVM 15.x and above, since the element type is no longer implicit in the pointer type due to opaque pointers

I did not see this exposed in the current API, so I implemented this based on loaded_ty in Load

Tested with LLVM 12, 14, and 15

cdisselkoen commented 1 year ago

Looks good, thanks for this