[LLVMdev] question about alignment of structures on the stack (arm 32)
Alexey Perevalov
alexey.perevalov at hotmail.com
Mon Apr 20 11:09:59 PDT 2015
Dear community,
I faced with code which was generated by llvm, assembly instructions of that code is relying on 8-bytes alignment for structures on the stack.
The part of Objective C code is following:
-(void)getCharacters:(unichar *)unicode {
NSRange range;
range.location = 0;
range.length = [self length];
printf("%p, %p\n", &range.location, &range.length);
And before printf call I see an argument preparation, and one of the most interesting instruction
orr r3, r2, #4 ;for address of range.length
Does this mean llvm always expects "range" address aligned by 8 bytes?
Is it possible to tweak it somehow by cmd line option for clang, e.g. to set 4-bytes alignment,
and generate another code instead of orr, e.g. add?
Best Regards,
Alexey
More information about the llvm-dev
mailing list