mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-10 13:48:44 +00:00
Refactor some common logic in DwarfUnit::constructVariableDIE and pass non-null DIE by reference to DbgVariable::setDIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
// Accessors.
|
// Accessors.
|
||||||
DIVariable getVariable() const { return Var; }
|
DIVariable getVariable() const { return Var; }
|
||||||
void setDIE(DIE *D) { TheDIE = D; }
|
void setDIE(DIE &D) { TheDIE = &D; }
|
||||||
DIE *getDIE() const { return TheDIE; }
|
DIE *getDIE() const { return TheDIE; }
|
||||||
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
|
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
|
||||||
unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
|
unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
|
||||||
|
@ -1802,6 +1802,13 @@ void DwarfUnit::constructContainingTypeDIEs() {
|
|||||||
|
|
||||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||||
DIE *DwarfUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
DIE *DwarfUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
||||||
|
auto D = constructVariableDIEImpl(DV, isScopeAbstract);
|
||||||
|
DV.setDIE(*D);
|
||||||
|
return D;
|
||||||
|
}
|
||||||
|
|
||||||
|
DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
|
||||||
|
bool isScopeAbstract) {
|
||||||
StringRef Name = DV.getName();
|
StringRef Name = DV.getName();
|
||||||
|
|
||||||
// Define variable debug information entry.
|
// Define variable debug information entry.
|
||||||
@ -1820,17 +1827,14 @@ DIE *DwarfUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
|||||||
if (DV.isArtificial())
|
if (DV.isArtificial())
|
||||||
addFlag(VariableDie, dwarf::DW_AT_artificial);
|
addFlag(VariableDie, dwarf::DW_AT_artificial);
|
||||||
|
|
||||||
if (isScopeAbstract) {
|
if (isScopeAbstract)
|
||||||
DV.setDIE(VariableDie);
|
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
}
|
|
||||||
|
|
||||||
// Add variable address.
|
// Add variable address.
|
||||||
|
|
||||||
unsigned Offset = DV.getDotDebugLocOffset();
|
unsigned Offset = DV.getDotDebugLocOffset();
|
||||||
if (Offset != ~0U) {
|
if (Offset != ~0U) {
|
||||||
addLocationList(VariableDie, dwarf::DW_AT_location, Offset);
|
addLocationList(VariableDie, dwarf::DW_AT_location, Offset);
|
||||||
DV.setDIE(VariableDie);
|
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1854,21 +1858,19 @@ DIE *DwarfUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
|||||||
addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
|
addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
|
||||||
isUnsignedDIType(DD, DV.getType()));
|
isUnsignedDIType(DD, DV.getType()));
|
||||||
|
|
||||||
DV.setDIE(VariableDie);
|
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
} else {
|
|
||||||
// .. else use frame index.
|
|
||||||
int FI = DV.getFrameIndex();
|
|
||||||
if (FI != ~0) {
|
|
||||||
unsigned FrameReg = 0;
|
|
||||||
const TargetFrameLowering *TFI = Asm->TM.getFrameLowering();
|
|
||||||
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
|
|
||||||
MachineLocation Location(FrameReg, Offset);
|
|
||||||
addVariableAddress(DV, VariableDie, Location);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DV.setDIE(VariableDie);
|
// .. else use frame index.
|
||||||
|
int FI = DV.getFrameIndex();
|
||||||
|
if (FI != ~0) {
|
||||||
|
unsigned FrameReg = 0;
|
||||||
|
const TargetFrameLowering *TFI = Asm->TM.getFrameLowering();
|
||||||
|
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
|
||||||
|
MachineLocation Location(FrameReg, Offset);
|
||||||
|
addVariableAddress(DV, VariableDie, Location);
|
||||||
|
}
|
||||||
|
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,6 +457,10 @@ protected:
|
|||||||
virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0;
|
virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// \brief Construct a DIE for the given DbgVariable without initializing the
|
||||||
|
/// DbgVariable's DIE reference.
|
||||||
|
DIE *constructVariableDIEImpl(const DbgVariable &DV, bool isScopeAbstract);
|
||||||
|
|
||||||
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
||||||
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user