[LLVMdev] Structure memory layout

Renato Golin renato.golin at arm.com
Thu Oct 21 00:55:19 PDT 2010


On 21 October 2010 08:26, Jin Gu Kang <jaykang10 at imrc.kist.re.kr> wrote:
> I think you misunderstood our type notation.
> By using your suggetion, "s4" means "i4 align short" in our notation.
> In "i4 align 2" for "short a:4", I think that "align 2" is already target dependent
> because short can be 2 or 4 bytes according to each target.

I see, but that still doesn't change the fact that "short" means many
things, but 2 means only 2.

Saying that a variable aligns to something is already going towards
platform-specific choices, I agree, but at least with explicit sizes,
the back-end can ponder about its consequences in an organized way.

But if you say "short" compiling to one architecture X, the
architecture Y has no way of knowing what did you really mean, so it
can't determine if it's going to change the alignment of all short or
leave it.


> so I wonder how do you think about "i4 align short" notation.
> (Is it impossible to have c specifier in align in order to be consistent with the rest of LLVM?)

The symbol 'i' is canonical in LLVM to mean any type of integer, I
doubt that's going to change. Besides, there is already an explicit
way of expressing the alignment, via the 'align' keyword.

Besides, it's already a heavy change just to make sure type and/or
variable alignment won't break all kinds of codegen/optimizations for
all platforms you have access to.

cheers,
--renato



More information about the llvm-dev mailing list