Aligning Long Long Vairables

Hi,

I'm trying to align long long variable on a 4 byte boundary. I tried
to change to clang frontend as follow:

LongLongAlign = 32 ; LongLongWidth = 64;

The asm output is still 8 bytes, when I declare a long long global array:

.align 8

How can I change the alignment from 8 byte to 4 byte for long long
variables? Do I need to write an ASMprinter class or change something
in my backend?

Thank you.

Does this happen for individual "long long" variables, or only for arrays? There is something like "long array alignment", and "long array size" that could increase the alignment for arrays that are considered long (according to these settings). I don't remember the exact names, but it's in the same place in clang.

-Krzysztof

I'm trying to align long long variable on a 4 byte boundary. I tried
to change to clang frontend as follow:

LongLongAlign = 32 ; LongLongWidth = 64;

These mostly affect things like the preprocessor defines and
(possibly) applications of _Alignof.

The asm output is still 8 bytes, when I declare a long long global array:

What's your target's DataLayout? You should be able to see it at the
top of any module you dump.

This is what I'd expect to affect how the backend deals with alignment
(including struct/array layout and variable definitions). There should
be an "-i64:N-" bit for your 64-bit type, and it sounds you want that
to read "-i64:32-". If there's no i64 entry, then the default is
(oddly) 32, so this isn't the issue.

Cheers.

Tim.

Hi Tim,

Thanks for your quick reply.

My backend doesn’t have a true i64 type. I combine two i32 registers to create an extended register, that’s supported by my architecture.

My datalayout is: …i64:32:32…