[LLVMdev] The definition of getTypeSize

Dale Johannesen dalej at apple.com
Mon Oct 8 13:52:42 PDT 2007


I do not have a strong opinion on the naming of the various size  
functions, or on how to deal with APInt's of sizes that are not  
multiples of a byte.

I do think loading and storing more bytes than necessary is generally  
a bad idea, especially if you're getting uninitialized bits.  (If you  
incorrectly cross a page boundary, you might fault, for one thing.   
Watch out for packed structs.)

I also think the current general approach to x86 long double is  
best:  use 80 bits for the underlying size, and where extra bytes are  
required for padding, do that by looking at the alignment.  There is  
no need to allocate more than 10 bytes for scalars of this type, and  
we currently don't for stack objects.

(The code you point to in visitAlloca does look like it might be a  
problem, but I can't make it fail.   Known-size arrays appear here as  
a single object [3 x x86_f80], and the size is computed
correctly; unknown-size arrays have the size of the elements passed  
from the FE, and this includes padding.  How does that size*count  
computation get executed?)




More information about the llvm-dev mailing list