mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user