Lines Matching full:alignment

1 //===- DataLayout.cpp - Data size & alignment routines ---------------------==//
9 // This file defines layout properties related to datatype size/offset/alignment
65 // the same data type so no alignment issue will happen. The condition here
74 // Keep track of maximum alignment constraint.
127 assert(ABIAlign <= PrefAlign && "Preferred alignment worse than ABI!");
148 assert(ABIAlign <= PrefAlign && "Preferred alignment worse than ABI!");
342 // ABI alignment.
345 "Missing alignment specification for pointer in datalayout string");
352 return reportError("Pointer ABI alignment must be a power of 2");
358 // Preferred alignment.
367 "Pointer preferred alignment must be a power of 2");
408 // ABI alignment.
411 "Missing alignment specification in datalayout string");
419 "ABI alignment specification must be >0 for non-aggregate types");
422 return reportError("Invalid ABI alignment, must be a 16bit integer");
424 return reportError("Invalid ABI alignment, must be a power of 2");
427 "Invalid ABI alignment, i8 must be naturally aligned");
429 // Preferred alignment.
440 "Invalid preferred alignment, must be a 16bit integer");
442 return reportError("Invalid preferred alignment, must be a power of 2");
465 case 'S': { // Stack natural alignment.
466 uint64_t Alignment;
467 if (Error Err = getIntInBytes(Tok, Alignment))
469 if (Alignment != 0 && !llvm::isPowerOf2_64(Alignment))
470 return reportError("Alignment is neither 0 nor a power of 2");
471 StackNaturalAlign = MaybeAlign(Alignment);
483 return reportError("Unknown function pointer alignment type in "
487 uint64_t Alignment;
488 if (Error Err = getIntInBytes(Tok, Alignment))
490 if (Alignment != 0 && !llvm::isPowerOf2_64(Alignment))
491 return reportError("Alignment is neither 0 nor a power of 2");
492 FunctionPtrAlign = MaybeAlign(Alignment);
589 // uint16_t, it is unclear if there are requirements for alignment to be less
592 assert(Log2(ABIAlign) < 16 && Log2(PrefAlign) < 16 && "Alignment too big");
597 "Preferred alignment cannot be less than the ABI alignment");
651 "Preferred alignment cannot be less than the ABI alignment");
675 // If we don't have an exact match, use alignment of next larger integer
676 // type. If there is none, use alignment of largest integer type by going
782 \param abi_or_pref Flag that determines which alignment is returned. true
783 returns the ABI alignment, false returns the preferred alignment.
784 \param Ty The underlying type for which alignment is determined.
786 Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref
804 // Packed structure types always have an ABI alignment of one.
821 // same size and alignment, so they look the same here.
830 // If we still couldn't find a reasonable default alignment, fall back
831 // to a simple heuristic that the alignment is the first power of two
846 // By default, use natural alignment for vector types. This is consistent
849 // We're only calculating a natural alignment, so it doesn't have to be
1013 /// getPreferredAlign - Return the preferred alignment of the specified global.
1014 /// This includes an explicitly requested alignment (if the global has one).
1017 // If a section is specified, always precisely honor explicit alignment,
1022 // If no explicit alignment is specified, compute the alignment based on
1023 // the IR type. If an alignment is specified, increase it to match the ABI
1024 // alignment of the IR type.
1026 // FIXME: Not sure it makes sense to use the alignment of the type if
1027 // there's already an explicit alignment specification.
1029 Align Alignment = getPrefTypeAlign(ElemType);
1031 if (*GVAlignment >= Alignment)
1032 Alignment = *GVAlignment;
1034 Alignment = std::max(*GVAlignment, getABITypeAlign(ElemType));
1037 // If no explicit alignment is specified, and the global is large, increase
1038 // the alignment to 16.
1041 if (Alignment < Align(16)) {
1043 // larger alignment.
1045 Alignment = Align(16); // 16-byte alignment.
1048 return Alignment;