[llvm-dev] How to generate IR code to dynamically compute object size ?

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 1 12:27:08 PDT 2015


On 10/1/2015 5:01 AM, St├ęphane Letz via llvm-dev wrote:
>
> We are using the following kind code to compile the size of a dynamically allocated object, flowing the recommendation described here :
>
> http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt
>

Since you must know the type for the above to work, can't you use 
DataLayout::getTypeSizeInBits instead?

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list