[llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/
daniel at zuster.org
Sun Jul 12 19:28:03 CDT 2009
On Wed, Jul 1, 2009 at 8:18 PM, Chris Lattner<clattner at apple.com> wrote:
> On Jul 1, 2009, at 6:40 PM, Daniel Dunbar wrote:
>> I probably missed the backstory here, but wouldn't it be better for us
>> to consistently use byte alignment?
>> Some contexts will always need non-power of two alignment, and I think
>> there is value in standardizing on one form. The situation now is we
>> have code like TargetData::get...Alignment which returns bytes, and
>> MachineFunction::get...Alignment which returns log2. Alternately we
>> could include Log2 in the name...
> I vote for keeping it in log2 and standardizing on log2 form. The
> reason is that it takes less space to represent, it is impossible to
> store something that is not a pow2, and it is cheaper to convert from
> log2 -> bytes than from bytes->log2.
I disagree. We can't unequivocally standardize on log2, because some
APIs allow non-power-of-2 alignments. Personally, I also find it more
natural that a function named getAlignment would give me the alignment
in bytes; your request that Bill comment on this in the method
indicates you may even subconsciously agree with me! :)
I also think there are currently more places in LLVM that represent
alignment as bytes instead of log2, and APIs which truly require a
power-of-2 alignment can easily assert this. And lastly, I don't think
the performance of this operation is at all relevant.
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
More information about the llvm-commits