================
@@ -2554,6 +2560,320 @@ static RValue
EmitHipStdParUnsupportedBuiltin(CodeGenFunction *CGF,
return RValue::get(CGF->Builder.CreateCall(UBF, Args));
}
+namespace {
+
+
+// PaddingClearer is a utility class that clears padding bits in a
+// c++ type. It traverses the type recursively, collecting occupied
+// bit intervals, and then compute the padding intervals.
+// In the end, it clears the padding bits by writing zeros
+// to the padding intervals bytes-by-bytes. If a byte only contains
+// some padding bits, it writes zeros to only those bits. This is
+// the case for bit-fields.
+struct PaddingClearer {
+ PaddingClearer(CodeGenFunction &F)
+ : CGF(F), CharWidth(CGF.getContext().getCharWidth()) {}
+
+ void run(Value *Ptr, QualType Ty) {
+ OccuppiedIntervals.clear();
+ Queue.clear();
+
+ Queue.push_back(Data{0, Ty, true});
+ while (!Queue.empty()) {
+ auto Current = Queue.back();
+ Queue.pop_back();
+ Visit(Current);
+ }
+
+ MergeOccuppiedIntervals();
+ auto PaddingIntervals =
+ GetPaddingIntervals(CGF.getContext().getTypeSize(Ty));
+ llvm::dbgs() << "Occuppied Bits:\n";
----------------
jyknight wrote:
Did you want to keep these llvm::dbgs calls (here and elsewhere)? If so, they
need to be within an `LLVM_DEBUG()` so they're only selectively emitted.
https://github.com/llvm/llvm-project/pull/75371
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits