@@ -117,7 +117,7 @@ class BPFAbstractMemberAccess final : public ModulePass {
117117 struct CallInfo {
118118 uint32_t Kind;
119119 uint32_t AccessIndex;
120- uint32_t RecordAlignment;
120+ Align RecordAlignment;
121121 MDNode *Metadata;
122122 Value *Base;
123123 };
@@ -157,11 +157,11 @@ class BPFAbstractMemberAccess final : public ModulePass {
157157 void replaceWithGEP (std::vector<CallInst *> &CallList,
158158 uint32_t NumOfZerosIndex, uint32_t DIIndex);
159159 bool HasPreserveFieldInfoCall (CallInfoStack &CallStack);
160- void GetStorageBitRange (DIDerivedType *MemberTy, uint32_t RecordAlignment,
160+ void GetStorageBitRange (DIDerivedType *MemberTy, Align RecordAlignment,
161161 uint32_t &StartBitOffset, uint32_t &EndBitOffset);
162162 uint32_t GetFieldInfo (uint32_t InfoKind, DICompositeType *CTy,
163163 uint32_t AccessIndex, uint32_t PatchImm,
164- uint32_t RecordAlignment);
164+ Align RecordAlignment);
165165
166166 Value *computeBaseAndAccessKey (CallInst *Call, CallInfo &CInfo,
167167 std::string &AccessKey, MDNode *&BaseMeta);
@@ -250,7 +250,7 @@ bool BPFAbstractMemberAccess::IsPreserveDIAccessIndexCall(const CallInst *Call,
250250 CInfo.AccessIndex = getConstant (Call->getArgOperand (2 ));
251251 CInfo.Base = Call->getArgOperand (0 );
252252 CInfo.RecordAlignment =
253- DL ->getABITypeAlignment (CInfo.Base ->getType ()->getPointerElementType ());
253+ DL ->getABITypeAlign (CInfo.Base ->getType ()->getPointerElementType ());
254254 return true ;
255255 }
256256 if (GV ->getName ().startswith (" llvm.preserve.union.access.index" )) {
@@ -261,7 +261,7 @@ bool BPFAbstractMemberAccess::IsPreserveDIAccessIndexCall(const CallInst *Call,
261261 CInfo.AccessIndex = getConstant (Call->getArgOperand (1 ));
262262 CInfo.Base = Call->getArgOperand (0 );
263263 CInfo.RecordAlignment =
264- DL ->getABITypeAlignment (CInfo.Base ->getType ()->getPointerElementType ());
264+ DL ->getABITypeAlign (CInfo.Base ->getType ()->getPointerElementType ());
265265 return true ;
266266 }
267267 if (GV ->getName ().startswith (" llvm.preserve.struct.access.index" )) {
@@ -272,7 +272,7 @@ bool BPFAbstractMemberAccess::IsPreserveDIAccessIndexCall(const CallInst *Call,
272272 CInfo.AccessIndex = getConstant (Call->getArgOperand (2 ));
273273 CInfo.Base = Call->getArgOperand (0 );
274274 CInfo.RecordAlignment =
275- DL ->getABITypeAlignment (CInfo.Base ->getType ()->getPointerElementType ());
275+ DL ->getABITypeAlign (CInfo.Base ->getType ()->getPointerElementType ());
276276 return true ;
277277 }
278278 if (GV ->getName ().startswith (" llvm.bpf.preserve.field.info" )) {
@@ -522,12 +522,12 @@ uint64_t BPFAbstractMemberAccess::getConstant(const Value *IndexValue) {
522522
523523// / Get the start and the end of storage offset for \p MemberTy.
524524void BPFAbstractMemberAccess::GetStorageBitRange (DIDerivedType *MemberTy,
525- uint32_t RecordAlignment,
525+ Align RecordAlignment,
526526 uint32_t &StartBitOffset,
527527 uint32_t &EndBitOffset) {
528528 uint32_t MemberBitSize = MemberTy->getSizeInBits ();
529529 uint32_t MemberBitOffset = MemberTy->getOffsetInBits ();
530- uint32_t AlignBits = RecordAlignment * 8 ;
530+ uint32_t AlignBits = RecordAlignment. value () * 8 ;
531531 if (RecordAlignment > 8 || MemberBitSize > AlignBits)
532532 report_fatal_error (" Unsupported field expression for llvm.bpf.preserve.field.info, "
533533 " requiring too big alignment" );
@@ -543,7 +543,7 @@ uint32_t BPFAbstractMemberAccess::GetFieldInfo(uint32_t InfoKind,
543543 DICompositeType *CTy,
544544 uint32_t AccessIndex,
545545 uint32_t PatchImm,
546- uint32_t RecordAlignment) {
546+ Align RecordAlignment) {
547547 if (InfoKind == BPFCoreSharedInfo::FIELD_EXISTENCE )
548548 return 1 ;
549549
@@ -829,11 +829,10 @@ Value *BPFAbstractMemberAccess::computeBaseAndAccessKey(CallInst *Call,
829829 AccessKey += " :" + std::to_string (AccessIndex);
830830
831831 MDNode *MDN = CInfo.Metadata ;
832- uint32_t RecordAlignment = CInfo.RecordAlignment ;
833832 // At this stage, it cannot be pointer type.
834833 auto *CTy = cast<DICompositeType>(stripQualifiers (cast<DIType>(MDN )));
835834 PatchImm = GetFieldInfo (InfoKind, CTy, AccessIndex, PatchImm,
836- RecordAlignment);
835+ CInfo. RecordAlignment );
837836 }
838837
839838 // Access key is the
0 commit comments