[llvm] [RemoveDIs][DebugInfo] Create overloads of debug intrinsic utilities for DPValues (PR #78313)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 10:27:18 PST 2024
================
@@ -1824,6 +1835,30 @@ void at::deleteAll(Function *F) {
DAI->eraseFromParent();
}
+/// Get the FragmentInfo for the variable if it exists, otherwise return a
+/// FragmentInfo that covers the entire variable if the variable size is
+/// known, otherwise return a zero-sized fragment.
+static DIExpression::FragmentInfo
+getFragmentOrEntireVariable(const DPValue *DPV) {
+ DIExpression::FragmentInfo VariableSlice(0, 0);
+ // Get the fragment or variable size, or zero.
+ if (auto Sz = DPV->getFragmentSizeInBits())
+ VariableSlice.SizeInBits = *Sz;
+ if (auto Frag = DPV->getExpression()->getFragmentInfo())
+ VariableSlice.OffsetInBits = Frag->OffsetInBits;
+ return VariableSlice;
+}
----------------
jmorse wrote:
Newline desired
https://github.com/llvm/llvm-project/pull/78313
More information about the llvm-commits
mailing list