-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIR][CodeGen][Bugfix] bitfields: use the storage type ifor the getMeberOp #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,13 +216,16 @@ static bool isAAPCS(const TargetInfo &TargetInfo) { | |
return TargetInfo.getABI().startswith("aapcs"); | ||
} | ||
|
||
Address CIRGenFunction::getAddrOfField(LValue base, const FieldDecl *field, | ||
unsigned index) { | ||
Address CIRGenFunction::getAddrOfBitFieldStorage(LValue base, | ||
const FieldDecl *field, | ||
unsigned index, | ||
unsigned size) { | ||
if (index == 0) | ||
return base.getAddress(); | ||
|
||
auto loc = getLoc(field->getLocation()); | ||
auto fieldType = convertType(field->getType()); | ||
auto fieldType = builder.getUIntNTy(size); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please explain why it shouldn't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So please add |
||
|
||
auto fieldPtr = | ||
mlir::cir::PointerType::get(getBuilder().getContext(), fieldType); | ||
auto sea = getBuilder().createGetMember( | ||
|
@@ -257,9 +260,8 @@ LValue CIRGenFunction::buildLValueForBitField(LValue base, | |
llvm_unreachable("NYI"); | ||
} | ||
|
||
Address Addr = getAddrOfField(base, field, Idx); | ||
|
||
const unsigned SS = useVolatile ? info.VolatileStorageSize : info.StorageSize; | ||
Address Addr = getAddrOfBitFieldStorage(base, field, Idx, SS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's LLVM codegen doing here? Does it call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no LLVM codegen here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, we follow the principle of using the same skeleton as I don't see anything similar to |
||
|
||
// Get the access type. | ||
mlir::Type FieldIntTy = builder.getUIntNTy(SS); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing the function signature? Why wasn't it
getAddrOfBitFieldStorage
in the first place?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function was introduced by me and in previous version it was not intended to work with bitfields only. After the last changes it will serve only them though. That's why I renamed it and added one more argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.