[LLVMdev] PR400 - alignment for LD/ST

Chris Lattner sabre at nondot.org
Sun Apr 1 01:11:53 PDT 2007


On Sun, 1 Apr 2007, Christopher Lamb wrote:
> Also I wanted to clear something up about the meaning of the alignment 
> attribute. My thinking is that this indicates over/under alignment with 
> respect to natural alignment for the type. This is to say in the Load/Store 
> instruction classes the default alignment value will be zero, meaning natural 
> alignment for the given type. If the alignment value is nonzero then the 
> alignment value should be used over the natural or preferred alignment.

Yes, exactly.  To put this another way: if the specified alignment is less 
than the natural alignment for the type, then the codegen needs to be 
careful (e.g. use special unaligned loads).  If it is more aligned, then 
this is a guarantee to clients about the load, who can choose to use it or 
not.  If the specified alignment matches the natural alignment, then it 
can be dropped (set to zero).

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list