mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Use a reference rather than a pointer as we don't expect a NULL
DbgVariable. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194761 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1742,42 +1742,42 @@ void CompileUnit::constructContainingTypeDIEs() {
|
||||
}
|
||||
|
||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||
DIE *CompileUnit::constructVariableDIE(DbgVariable *DV, bool isScopeAbstract) {
|
||||
StringRef Name = DV->getName();
|
||||
DIE *CompileUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
||||
StringRef Name = DV.getName();
|
||||
|
||||
// Define variable debug information entry.
|
||||
DIE *VariableDie = new DIE(DV->getTag());
|
||||
DbgVariable *AbsVar = DV->getAbstractVariable();
|
||||
DIE *VariableDie = new DIE(DV.getTag());
|
||||
DbgVariable *AbsVar = DV.getAbstractVariable();
|
||||
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL;
|
||||
if (AbsDIE)
|
||||
addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE);
|
||||
else {
|
||||
if (!Name.empty())
|
||||
addString(VariableDie, dwarf::DW_AT_name, Name);
|
||||
addSourceLine(VariableDie, DV->getVariable());
|
||||
addType(VariableDie, DV->getType());
|
||||
addSourceLine(VariableDie, DV.getVariable());
|
||||
addType(VariableDie, DV.getType());
|
||||
}
|
||||
|
||||
if (DV->isArtificial())
|
||||
if (DV.isArtificial())
|
||||
addFlag(VariableDie, dwarf::DW_AT_artificial);
|
||||
|
||||
if (isScopeAbstract) {
|
||||
DV->setDIE(VariableDie);
|
||||
DV.setDIE(VariableDie);
|
||||
return VariableDie;
|
||||
}
|
||||
|
||||
// Add variable address.
|
||||
|
||||
unsigned Offset = DV->getDotDebugLocOffset();
|
||||
unsigned Offset = DV.getDotDebugLocOffset();
|
||||
if (Offset != ~0U) {
|
||||
addLabel(VariableDie, dwarf::DW_AT_location, dwarf::DW_FORM_data4,
|
||||
Asm->GetTempSymbol("debug_loc", Offset));
|
||||
DV->setDIE(VariableDie);
|
||||
DV.setDIE(VariableDie);
|
||||
return VariableDie;
|
||||
}
|
||||
|
||||
// Check if variable is described by a DBG_VALUE instruction.
|
||||
if (const MachineInstr *DVInsn = DV->getMInsn()) {
|
||||
if (const MachineInstr *DVInsn = DV.getMInsn()) {
|
||||
assert(DVInsn->getNumOperands() == 3);
|
||||
if (DVInsn->getOperand(0).isReg()) {
|
||||
const MachineOperand RegOp = DVInsn->getOperand(0);
|
||||
@@ -1785,32 +1785,32 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV, bool isScopeAbstract) {
|
||||
if (DVInsn->getOperand(1).isImm()) {
|
||||
MachineLocation Location(RegOp.getReg(),
|
||||
DVInsn->getOperand(1).getImm());
|
||||
addVariableAddress(*DV, VariableDie, Location);
|
||||
addVariableAddress(DV, VariableDie, Location);
|
||||
} else if (RegOp.getReg())
|
||||
addVariableAddress(*DV, VariableDie, MachineLocation(RegOp.getReg()));
|
||||
addVariableAddress(DV, VariableDie, MachineLocation(RegOp.getReg()));
|
||||
} else if (DVInsn->getOperand(0).isImm())
|
||||
addConstantValue(VariableDie, DVInsn->getOperand(0), DV->getType());
|
||||
addConstantValue(VariableDie, DVInsn->getOperand(0), DV.getType());
|
||||
else if (DVInsn->getOperand(0).isFPImm())
|
||||
addConstantFPValue(VariableDie, DVInsn->getOperand(0));
|
||||
else if (DVInsn->getOperand(0).isCImm())
|
||||
addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
|
||||
isUnsignedDIType(DD, DV->getType()));
|
||||
isUnsignedDIType(DD, DV.getType()));
|
||||
|
||||
DV->setDIE(VariableDie);
|
||||
DV.setDIE(VariableDie);
|
||||
return VariableDie;
|
||||
} else {
|
||||
// .. else use frame index.
|
||||
int FI = DV->getFrameIndex();
|
||||
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);
|
||||
addVariableAddress(DV, VariableDie, Location);
|
||||
}
|
||||
}
|
||||
|
||||
DV->setDIE(VariableDie);
|
||||
DV.setDIE(VariableDie);
|
||||
return VariableDie;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ public:
|
||||
void constructContainingTypeDIEs();
|
||||
|
||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||
DIE *constructVariableDIE(DbgVariable *DV, bool isScopeAbstract);
|
||||
DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
|
||||
|
||||
/// Create a DIE with the given Tag, add the DIE to its parent, and
|
||||
/// call insertDIE if MD is not null.
|
||||
|
||||
@@ -578,7 +578,7 @@ DIE *DwarfDebug::createScopeChildrenDIE(CompileUnit *TheCU, LexicalScope *Scope,
|
||||
for (unsigned i = 0, N = CurrentFnArguments.size(); i < N; ++i)
|
||||
if (DbgVariable *ArgDV = CurrentFnArguments[i])
|
||||
if (DIE *Arg =
|
||||
TheCU->constructVariableDIE(ArgDV, Scope->isAbstractScope())) {
|
||||
TheCU->constructVariableDIE(*ArgDV, Scope->isAbstractScope())) {
|
||||
Children.push_back(Arg);
|
||||
if (ArgDV->isObjectPointer()) ObjectPointer = Arg;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ DIE *DwarfDebug::createScopeChildrenDIE(CompileUnit *TheCU, LexicalScope *Scope,
|
||||
const SmallVectorImpl<DbgVariable *> &Variables =ScopeVariables.lookup(Scope);
|
||||
for (unsigned i = 0, N = Variables.size(); i < N; ++i)
|
||||
if (DIE *Variable =
|
||||
TheCU->constructVariableDIE(Variables[i], Scope->isAbstractScope())) {
|
||||
TheCU->constructVariableDIE(*Variables[i], Scope->isAbstractScope())) {
|
||||
Children.push_back(Variable);
|
||||
if (Variables[i]->isObjectPointer()) ObjectPointer = Variable;
|
||||
}
|
||||
@@ -999,7 +999,7 @@ void DwarfDebug::collectDeadVariables() {
|
||||
continue;
|
||||
DbgVariable NewVar(DV, NULL, this);
|
||||
if (DIE *VariableDIE =
|
||||
SPCU->constructVariableDIE(&NewVar, false))
|
||||
SPCU->constructVariableDIE(NewVar, false))
|
||||
SPDIE->addChild(VariableDIE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user