[LLVMbugs] [Bug 4089] New: LLVM asm has no way to specify alignment in structure types

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Apr 27 05:02:24 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4089

           Summary: LLVM asm has no way to specify alignment in structure
                    types
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM assembly language parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jgarzik at pobox.com
                CC: llvmbugs at cs.uiuc.edu


When writing LLVM assembly language (i.e. NOT using the LLVM libraries), there
is no way to specify alignment of a structure type for implementation of the C
feature __attribute__((__aligned__(nnn))).

The current workaround is for my asm writer to insert i8's as padding.  This
works, but doing so defeats a key attraction of the structure type:  struct
layout is completely offloaded onto LLVM.

To support __attribute__((__aligned__(nnn))), my asm writer has two options,
listed in order of increasing complexity:

(1) Perform full target ABI layout internally, and unconditionally use packed
structure type

(2) Perform full target ABI layout internally, use normal structure type where
possible.  Guess where LLVM will insert padding, and insert additional padding
as needed.

What I hope for is a much more simple third option...

(3) Perform NO target ABI layout internally, and specify alignment in LLVM
assembly language.  Something like this:

       %struct.foo = type <{i8, i32/align8, i32}>


I feel this is consistent with the rest of LLVM assembly language, which
permits specification of custom alignment in multiple places.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list