[LLVMdev] PR400 - alignment for LD/ST

Christopher Lamb christopher.lamb at gmail.com
Mon Apr 2 08:53:05 PDT 2007


On Apr 1, 2007, at 3:11 AM, Chris Lattner wrote:

> 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

Here's a related question. It seems that there might be a benefit in  
knowing about two alignment values for a load/store. The alignment of  
the load/store itself, but potentially also the alignment of the base  
pointer used for the load/store. Having an alignment attribute on  
pointer types would solve both these issues, but having a single  
alignment attribute on loads/stores doesn't. This would lead me to  
propose having an alignment attribute for getelementptr. Thoughts?

--
Christopher Lamb



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070402/b59e8c4e/attachment.html>


More information about the llvm-dev mailing list