[LLVMdev] IR sizeof?
kparzysz at codeaurora.org
Sun Nov 11 04:33:02 PST 2012
On 11/11/2012 4:52 AM, edA-qa mort-ora-y wrote:
> Is there a way to get the size of a type in the IR assembly code? I know
> the size must be known since alloca and getelementptr both implicitly
> use it, but I don't see any way to get access to the size directly.
> I know my final compiler will have to get the size itself, but I'm just
> doing some simple tests directly in assembly now and am hoping there is
> an easy way to get the size of a structure.
Look in DerivedTypes.h and see if you can find anything that will help
you there. For structs you will need to account for padding and be
careful about bitfields, but there should be functions to help you
calculate a total size of a struct.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev