While writing bindings to LLVM for another language via the c api I noticed that LLVMAlignment and LLVMStackAlignment do not use 1<<x like all the others, but 31<<x and 7<x respectively (see below, or here: http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148). It's likely this is as it is intended, but it does look out-of-place enough that I thought it might be a typo and I would like to know. Also, 1<<27 and 1<<28 get skipped over from LLVMStackAlignment to LLVMReturnsTwice: LLVMZExtAttribute = 1<<0, LLVMSExtAttribute = 1<<1, LLVMNoReturnAttribute = 1<<2, LLVMInRegAttribute = 1<<3, LLVMStructRetAttribute = 1<<4, LLVMNoUnwindAttribute = 1<<5, LLVMNoAliasAttribute = 1<<6, LLVMByValAttribute = 1<<7, LLVMNestAttribute = 1<<8, LLVMReadNoneAttribute = 1<<9, LLVMReadOnlyAttribute = 1<<10, LLVMNoInlineAttribute = 1<<11, LLVMAlwaysInlineAttribute = 1<<12, LLVMOptimizeForSizeAttribute = 1<<13, LLVMStackProtectAttribute = 1<<14, LLVMStackProtectReqAttribute = 1<<15, *LLVMAlignment** = 31<<16,* LLVMNoCaptureAttribute = 1<<21, LLVMNoRedZoneAttribute = 1<<22, LLVMNoImplicitFloatAttribute = 1<<23, LLVMNakedAttribute = 1<<24, LLVMInlineHintAttribute = 1<<25, *LLVMStackAlignment** = 7<<26,* *LLVMReturnsTwice** = 1 << 29,* LLVMUWTable = 1 << 30, http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130217/1681af15/attachment.html>
On 17.02.2013, at 13:30, Moritz Maxeiner <moritzmaxeiner at googlemail.com> wrote:> While writing bindings to LLVM for another language via the c api I noticed that > LLVMAlignment and LLVMStackAlignment do not use 1<<x like all the others, > but 31<<x and 7<x respectively (see below, or here: http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148). > It's likely this is as it is intended, but it does look out-of-place enough that > I thought it might be a typo and I would like to know. Also, 1<<27 and 1<<28 > get skipped over from LLVMStackAlignment to LLVMReturnsTwice:This is intentional. LLVMAlignment is not just a bit, it's a 5 bit value so we reserve 5 bits for it. Same for the 3 bits LLVMStackAlignment uses. - Ben> LLVMZExtAttribute > = 1<<0, > > LLVMSExtAttribute > = 1<<1, > > LLVMNoReturnAttribute > = 1<<2, > > LLVMInRegAttribute > = 1<<3, > > LLVMStructRetAttribute > = 1<<4, > > LLVMNoUnwindAttribute > = 1<<5, > > LLVMNoAliasAttribute > = 1<<6, > > LLVMByValAttribute > = 1<<7, > > LLVMNestAttribute > = 1<<8, > > LLVMReadNoneAttribute > = 1<<9, > > LLVMReadOnlyAttribute > = 1<<10, > > LLVMNoInlineAttribute > = 1<<11, > > LLVMAlwaysInlineAttribute > = 1<<12, > > LLVMOptimizeForSizeAttribute > = 1<<13, > > LLVMStackProtectAttribute > = 1<<14, > > LLVMStackProtectReqAttribute > = 1<<15, > > LLVMAlignment = 31<<16, > LLVMNoCaptureAttribute > = 1<<21, > > LLVMNoRedZoneAttribute > = 1<<22, > > LLVMNoImplicitFloatAttribute > = 1<<23, > > LLVMNakedAttribute > = 1<<24, > > LLVMInlineHintAttribute > = 1<<25, > > LLVMStackAlignment = 7<<26, > LLVMReturnsTwice = 1 << 29, > LLVMUWTable = 1 << 30, > > > http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148 > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hello This is fine and intended. All this stuff works like bitmasks. On Sun, Feb 17, 2013 at 4:30 PM, Moritz Maxeiner <moritzmaxeiner at googlemail.com> wrote:> While writing bindings to LLVM for another language via the c api I noticed > that > LLVMAlignment and LLVMStackAlignment do not use 1<<x like all the others, > but 31<<x and 7<x respectively (see below, or here: > http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148). > It's likely this is as it is intended, but it does look out-of-place enough > that > I thought it might be a typo and I would like to know. Also, 1<<27 and 1<<28 > get skipped over from LLVMStackAlignment to LLVMReturnsTwice: > > LLVMZExtAttribute = 1<<0, > LLVMSExtAttribute = 1<<1, > LLVMNoReturnAttribute = 1<<2, > LLVMInRegAttribute = 1<<3, > LLVMStructRetAttribute = 1<<4, > LLVMNoUnwindAttribute = 1<<5, > LLVMNoAliasAttribute = 1<<6, > LLVMByValAttribute = 1<<7, > LLVMNestAttribute = 1<<8, > LLVMReadNoneAttribute = 1<<9, > LLVMReadOnlyAttribute = 1<<10, > LLVMNoInlineAttribute = 1<<11, > LLVMAlwaysInlineAttribute = 1<<12, > LLVMOptimizeForSizeAttribute = 1<<13, > LLVMStackProtectAttribute = 1<<14, > LLVMStackProtectReqAttribute = 1<<15, > LLVMAlignment = 31<<16, > LLVMNoCaptureAttribute = 1<<21, > LLVMNoRedZoneAttribute = 1<<22, > LLVMNoImplicitFloatAttribute = 1<<23, > LLVMNakedAttribute = 1<<24, > LLVMInlineHintAttribute = 1<<25, > LLVMStackAlignment = 7<<26, > LLVMReturnsTwice = 1 << 29, > LLVMUWTable = 1 << 30, > > > > http://llvm.org/docs/doxygen/html/Core_8h_source.html#l00148 > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University