forked from OSchip/llvm-project
Store the LocationKind of an entry value buffer independently from the main LocationKind (NFC)
This patch hides the logic for setting the location kind of an entry value inside the begin/finalize/cancel functions. This way we get rid the strange workaround that is currently in setLocation(). In the future, this will allow us to set the location kind of the entry value independently from the location kind of the main expression. Differential Revision: https://reviews.llvm.org/D96554
This commit is contained in:
parent
afd8bd601e
commit
982b891905
|
@ -365,11 +365,7 @@ void DwarfExpression::setEntryValueFlags(const MachineLocation &Loc) {
|
||||||
void DwarfExpression::setLocation(const MachineLocation &Loc,
|
void DwarfExpression::setLocation(const MachineLocation &Loc,
|
||||||
const DIExpression *DIExpr) {
|
const DIExpression *DIExpr) {
|
||||||
if (Loc.isIndirect())
|
if (Loc.isIndirect())
|
||||||
// Do not treat entry value descriptions of indirect parameters as memory
|
setMemoryLocationKind();
|
||||||
// locations. This allows DwarfExpression::addReg() to add DW_OP_regN to an
|
|
||||||
// entry value description.
|
|
||||||
if (!DIExpr->isEntryValue())
|
|
||||||
setMemoryLocationKind();
|
|
||||||
|
|
||||||
if (DIExpr->isEntryValue())
|
if (DIExpr->isEntryValue())
|
||||||
setEntryValueFlags(Loc);
|
setEntryValueFlags(Loc);
|
||||||
|
@ -380,12 +376,12 @@ void DwarfExpression::beginEntryValueExpression(
|
||||||
auto Op = ExprCursor.take();
|
auto Op = ExprCursor.take();
|
||||||
(void)Op;
|
(void)Op;
|
||||||
assert(Op && Op->getOp() == dwarf::DW_OP_LLVM_entry_value);
|
assert(Op && Op->getOp() == dwarf::DW_OP_LLVM_entry_value);
|
||||||
assert(!isMemoryLocation() &&
|
|
||||||
"We don't support entry values of memory locations yet");
|
|
||||||
assert(!IsEmittingEntryValue && "Already emitting entry value?");
|
assert(!IsEmittingEntryValue && "Already emitting entry value?");
|
||||||
assert(Op->getArg(0) == 1 &&
|
assert(Op->getArg(0) == 1 &&
|
||||||
"Can currently only emit entry values covering a single operation");
|
"Can currently only emit entry values covering a single operation");
|
||||||
|
|
||||||
|
SavedLocationKind = LocationKind;
|
||||||
|
LocationKind = Register;
|
||||||
IsEmittingEntryValue = true;
|
IsEmittingEntryValue = true;
|
||||||
enableTemporaryBuffer();
|
enableTemporaryBuffer();
|
||||||
}
|
}
|
||||||
|
@ -403,6 +399,7 @@ void DwarfExpression::finalizeEntryValue() {
|
||||||
// Emit the entry value's DWARF block operand.
|
// Emit the entry value's DWARF block operand.
|
||||||
commitTemporaryBuffer();
|
commitTemporaryBuffer();
|
||||||
|
|
||||||
|
LocationKind = SavedLocationKind;
|
||||||
IsEmittingEntryValue = false;
|
IsEmittingEntryValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,6 +412,7 @@ void DwarfExpression::cancelEntryValue() {
|
||||||
assert(getTemporaryBufferSize() == 0 &&
|
assert(getTemporaryBufferSize() == 0 &&
|
||||||
"Began emitting entry value block before cancelling entry value");
|
"Began emitting entry value block before cancelling entry value");
|
||||||
|
|
||||||
|
LocationKind = SavedLocationKind;
|
||||||
IsEmittingEntryValue = false;
|
IsEmittingEntryValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ protected:
|
||||||
enum { EntryValue = 1 << 0, Indirect = 1 << 1, CallSiteParamValue = 1 << 2 };
|
enum { EntryValue = 1 << 0, Indirect = 1 << 1, CallSiteParamValue = 1 << 2 };
|
||||||
|
|
||||||
unsigned LocationKind : 3;
|
unsigned LocationKind : 3;
|
||||||
|
unsigned SavedLocationKind : 3;
|
||||||
unsigned LocationFlags : 3;
|
unsigned LocationFlags : 3;
|
||||||
unsigned DwarfVersion : 4;
|
unsigned DwarfVersion : 4;
|
||||||
|
|
||||||
|
@ -284,8 +285,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
DwarfExpression(unsigned DwarfVersion, DwarfCompileUnit &CU)
|
DwarfExpression(unsigned DwarfVersion, DwarfCompileUnit &CU)
|
||||||
: CU(CU), SubRegisterSizeInBits(0), SubRegisterOffsetInBits(0),
|
: CU(CU), SubRegisterSizeInBits(0), SubRegisterOffsetInBits(0),
|
||||||
LocationKind(Unknown), LocationFlags(Unknown),
|
LocationKind(Unknown), SavedLocationKind(Unknown),
|
||||||
DwarfVersion(DwarfVersion) {}
|
LocationFlags(Unknown), DwarfVersion(DwarfVersion) {}
|
||||||
|
|
||||||
/// This needs to be called last to commit any pending changes.
|
/// This needs to be called last to commit any pending changes.
|
||||||
void finalize();
|
void finalize();
|
||||||
|
|
Loading…
Reference in New Issue