It's not a big deal, but it always annoyed me a bit when I hit it, so I'll bring it up here. LLD represents an alignment X as log2(X) in some places and just X in other places. It's a bit confusing. Because I always think alignments in my mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like to propose to always use real values. Any objections? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150324/9b662ee6/attachment.html>
Davide Italiano
2015-Mar-25 00:19 UTC
[LLVMdev] LLD: representation of a power of two value
On Tue, Mar 24, 2015 at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote:> It's not a big deal, but it always annoyed me a bit when I hit it, so I'll > bring it up here. > > LLD represents an alignment X as log2(X) in some places and just X in other > places. It's a bit confusing. Because I always think alignments in my mind > in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like to > propose to always use real values. > > Any objections?I'm in favor of this change, not only for consistency but because I feel the same way as you. I've recently hit some alignment issues linking on FreeBSD and it will be easier for me to reason about them if you make this change. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare
On Mar 24, 2015, at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote:> It's not a big deal, but it always annoyed me a bit when I hit it, so I'll bring it up here. > > LLD represents an alignment X as log2(X) in some places and just X in other places. It's a bit confusing. Because I always think alignments in my mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like to propose to always use real values.Can you give some examples? The DefinedAtom class has struct: struct Alignment { uint16_t powerOf2; uint16_t modulus; }; That use seems clear. But, yes, if there is “int alignment” somewhere, that is ambiguous. -Nick
On Tue, Mar 24, 2015 at 5:40 PM, Nick Kledzik <kledzik at apple.com> wrote:> > On Mar 24, 2015, at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote: > > > It's not a big deal, but it always annoyed me a bit when I hit it, so > I'll bring it up here. > > > > LLD represents an alignment X as log2(X) in some places and just X in > other places. It's a bit confusing. Because I always think alignments in my > mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like > to propose to always use real values. > Can you give some examples? > > The DefinedAtom class has struct: > > struct Alignment { > uint16_t powerOf2; > uint16_t modulus; > }; > > That use seems clear. But, yes, if there is “int alignment” somewhere, > that is ambiguous. >At least in ELF, alignment values are represented not by exponents but by just numbers in files, so we convert them back and force. "Alignment" is used for both exponents and actual values there. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150324/4ad185ae/attachment.html>
Michael Spencer
2015-Mar-25 04:22 UTC
[LLVMdev] LLD: representation of a power of two value
On Tue, Mar 24, 2015 at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote:> It's not a big deal, but it always annoyed me a bit when I hit it, so I'll > bring it up here. > > LLD represents an alignment X as log2(X) in some places and just X in other > places. It's a bit confusing. Because I always think alignments in my mind > in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like to > propose to always use real values. > > Any objections?I agree. This is how we represent alignment everywhere in llvm projects except a few places in lld. - Michael Spencer
Simon Atanasyan
2015-Mar-25 07:54 UTC
[LLVMdev] LLD: representation of a power of two value
On Wed, Mar 25, 2015 at 3:09 AM, Rui Ueyama <ruiu at google.com> wrote:> It's not a big deal, but it always annoyed me a bit when I hit it, so I'll > bring it up here. > > LLD represents an alignment X as log2(X) in some places and just X in other > places. It's a bit confusing. Because I always think alignments in my mind > in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like to > propose to always use real values. > > Any objections?I agree. Every time I deal with alignment in the LLD code I have to remember how we represent alignment in that case. -- Simon Atanasyan
On Tue, Mar 24, 2015 at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote:> It's not a big deal, but it always annoyed me a bit when I hit it, so I'll > bring it up here. > > LLD represents an alignment X as log2(X) in some places and just X in > other places. It's a bit confusing. Because I always think alignments in my > mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like > to propose to always use real values. > > Any objections? >The only theoretical objection I can imagine is that you can use much less storage for holding the log2(X). But right now that isn't causing us any problems it seems. -- Sean Silva> > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150325/436e5d5a/attachment.html>
I submitted a series of patches to convert all uses of log2 values to non-log2 values (That was harder than I thought because the types of the two are the same. They only different in meaning. So it was not easy to distinguish them. I split up patches so that anyone can verify correctness of the conversion that I've done.)>From now on, please always use non-log2 alignment values exclusively inLLD. Thanks! On Wed, Mar 25, 2015 at 12:16 PM, Sean Silva <chisophugis at gmail.com> wrote:> > > On Tue, Mar 24, 2015 at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote: > >> It's not a big deal, but it always annoyed me a bit when I hit it, so >> I'll bring it up here. >> >> LLD represents an alignment X as log2(X) in some places and just X in >> other places. It's a bit confusing. Because I always think alignments in my >> mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like >> to propose to always use real values. >> >> Any objections? >> > > The only theoretical objection I can imagine is that you can use much less > storage for holding the log2(X). But right now that isn't causing us any > problems it seems. > > -- Sean Silva > > >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150325/1aefca22/attachment.html>
Apparently Analagous Threads
- [LLVMdev] LLD: representation of a power of two value
- [LLVMdev] LLD: representation of a power of two value
- [LLVMdev] LLD: representation of a power of two value
- [LLVMdev] [lld][ELF] How to transfer st_other field value from input to output file
- [LLVMdev] LLD input graph handling proposal