Open langston-barrett opened 1 year ago
LLVM does have a lot of methods (for this and other things) but unfortunately only a subset of them are exposed in the LLVM C API, which is what all Rust bindings are based off of. As a practical matter, we (llvm-ir
) can't really take advantage of any LLVM APIs that don't exist in our dependency llvm-sys
. You sound like you're familiar with the LLVM methods you're looking for; is LLVMSizeOf()
something we could use to get sizes of types?
LLVM does have a lot of methods (for this and other things) but unfortunately only a subset of them are exposed in the LLVM C API, which is what all Rust bindings are based off of. As a practical matter, we (llvm-ir) can't really take advantage of any LLVM APIs that don't exist in our dependency llvm-sys.
Ah, I was picturing llvm-ir
reimplementing these methods, rather than, say, calling the LLVM method and storing the result alongside the type (which could take up a lot of space).
You sound like you're familiar with the LLVM methods you're looking for; is LLVMSizeOf() something we could use to get sizes of types?
Unfortunately, I'm only familiar with the C++ interface...
I have an analysis that could make use of information about the sizes of types, in particular, what LLVM calls
DataLayout::getTypeAllocSize
. LLVM has a whole variety of methods that calculate different sorts of sizes for various types, it looks to me like they're all fundamentally based onDataLayout::getTypeSizeInBits
.