mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 19:42:54 +02:00
Split DbgVariable. Eventually, variable info will be communicated through frame index, or DBG_VALUE instruction, or collection of DBG_VALUE instructions. Plus each DbgVariable may not need a label.
llvm-svn: 104233
This commit is contained in:
parent
db5be4dfc7
commit
f90f78669f
@ -168,34 +168,15 @@ public:
|
|||||||
///
|
///
|
||||||
class DbgVariable {
|
class DbgVariable {
|
||||||
DIVariable Var; // Variable Descriptor.
|
DIVariable Var; // Variable Descriptor.
|
||||||
unsigned FrameIndex; // Variable frame index.
|
|
||||||
const MachineInstr *DbgValueMInsn; // DBG_VALUE
|
|
||||||
// DbgValueLabel - DBG_VALUE is effective from this label.
|
|
||||||
MCSymbol *DbgValueLabel;
|
|
||||||
DbgVariable *const AbstractVar; // Abstract variable for this variable.
|
|
||||||
DIE *TheDIE;
|
DIE *TheDIE;
|
||||||
public:
|
public:
|
||||||
// AbsVar may be NULL.
|
// AbsVar may be NULL.
|
||||||
DbgVariable(DIVariable V, unsigned I, DbgVariable *AbsVar)
|
DbgVariable(DIVariable V) : Var(V), TheDIE(0) {}
|
||||||
: Var(V), FrameIndex(I), DbgValueMInsn(0),
|
|
||||||
DbgValueLabel(0), AbstractVar(AbsVar), TheDIE(0) {}
|
|
||||||
DbgVariable(DIVariable V, const MachineInstr *MI, DbgVariable *AbsVar)
|
|
||||||
: Var(V), FrameIndex(0), DbgValueMInsn(MI), DbgValueLabel(0),
|
|
||||||
AbstractVar(AbsVar), TheDIE(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
// Accessors.
|
// Accessors.
|
||||||
DIVariable getVariable() const { return Var; }
|
DIVariable getVariable() const { return Var; }
|
||||||
unsigned getFrameIndex() const { return FrameIndex; }
|
|
||||||
const MachineInstr *getDbgValue() const { return DbgValueMInsn; }
|
|
||||||
MCSymbol *getDbgValueLabel() const { return DbgValueLabel; }
|
|
||||||
void setDbgValueLabel(MCSymbol *L) { DbgValueLabel = L; }
|
|
||||||
DbgVariable *getAbstractVariable() const { return AbstractVar; }
|
|
||||||
void setDIE(DIE *D) { TheDIE = D; }
|
void setDIE(DIE *D) { TheDIE = D; }
|
||||||
DIE *getDIE() const { return TheDIE; }
|
DIE *getDIE() const { return TheDIE; }
|
||||||
bool hasLocation() {
|
|
||||||
return DbgValueMInsn || FrameIndex != ~0U;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -819,7 +800,7 @@ void DwarfDebug::addAddress(DIE *Die, unsigned Attribute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// addRegisterAddress - Add register location entry in variable DIE.
|
/// addRegisterAddress - Add register location entry in variable DIE.
|
||||||
bool DwarfDebug::addRegisterAddress(DIE *Die, DbgVariable *DV,
|
bool DwarfDebug::addRegisterAddress(DIE *Die, const MCSymbol *VS,
|
||||||
const MachineOperand &MO) {
|
const MachineOperand &MO) {
|
||||||
assert (MO.isReg() && "Invalid machine operand!");
|
assert (MO.isReg() && "Invalid machine operand!");
|
||||||
if (!MO.getReg())
|
if (!MO.getReg())
|
||||||
@ -827,26 +808,26 @@ bool DwarfDebug::addRegisterAddress(DIE *Die, DbgVariable *DV,
|
|||||||
MachineLocation Location;
|
MachineLocation Location;
|
||||||
Location.set(MO.getReg());
|
Location.set(MO.getReg());
|
||||||
addAddress(Die, dwarf::DW_AT_location, Location);
|
addAddress(Die, dwarf::DW_AT_location, Location);
|
||||||
if (MCSymbol *VS = DV->getDbgValueLabel())
|
if (VS)
|
||||||
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, VS);
|
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, VS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addConstantValue - Add constant value entry in variable DIE.
|
/// addConstantValue - Add constant value entry in variable DIE.
|
||||||
bool DwarfDebug::addConstantValue(DIE *Die, DbgVariable *DV,
|
bool DwarfDebug::addConstantValue(DIE *Die, const MCSymbol *VS,
|
||||||
const MachineOperand &MO) {
|
const MachineOperand &MO) {
|
||||||
assert (MO.isImm() && "Invalid machine operand!");
|
assert (MO.isImm() && "Invalid machine operand!");
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
unsigned Imm = MO.getImm();
|
unsigned Imm = MO.getImm();
|
||||||
addUInt(Block, 0, dwarf::DW_FORM_udata, Imm);
|
addUInt(Block, 0, dwarf::DW_FORM_udata, Imm);
|
||||||
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
||||||
if (MCSymbol *VS = DV->getDbgValueLabel())
|
if (VS)
|
||||||
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, VS);
|
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, VS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addConstantFPValue - Add constant value entry in variable DIE.
|
/// addConstantFPValue - Add constant value entry in variable DIE.
|
||||||
bool DwarfDebug::addConstantFPValue(DIE *Die, DbgVariable *DV,
|
bool DwarfDebug::addConstantFPValue(DIE *Die, const MCSymbol *VS,
|
||||||
const MachineOperand &MO) {
|
const MachineOperand &MO) {
|
||||||
assert (MO.isFPImm() && "Invalid machine operand!");
|
assert (MO.isFPImm() && "Invalid machine operand!");
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
@ -868,10 +849,8 @@ bool DwarfDebug::addConstantFPValue(DIE *Die, DbgVariable *DV,
|
|||||||
(unsigned char)0xFF & FltPtr[Start]);
|
(unsigned char)0xFF & FltPtr[Start]);
|
||||||
|
|
||||||
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
||||||
|
if (VS)
|
||||||
if (MCSymbol *VS = DV->getDbgValueLabel())
|
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, VS);
|
||||||
addLabel(Die, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
|
|
||||||
VS);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,22 +1551,15 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
|
|||||||
// Define variable debug information entry.
|
// Define variable debug information entry.
|
||||||
DIE *VariableDie = new DIE(Tag);
|
DIE *VariableDie = new DIE(Tag);
|
||||||
|
|
||||||
|
|
||||||
DIE *AbsDIE = NULL;
|
DIE *AbsDIE = NULL;
|
||||||
if (DbgVariable *AV = DV->getAbstractVariable())
|
DenseMap<const DbgVariable *, const DbgVariable *>::iterator
|
||||||
AbsDIE = AV->getDIE();
|
V2AVI = VarToAbstractVarMap.find(DV);
|
||||||
|
if (V2AVI != VarToAbstractVarMap.end())
|
||||||
|
AbsDIE = V2AVI->second->getDIE();
|
||||||
|
|
||||||
if (AbsDIE) {
|
if (AbsDIE)
|
||||||
DIScope DS(Scope->getScopeNode());
|
|
||||||
DISubprogram InlinedSP = getDISubprogram(DS);
|
|
||||||
DIE *OriginSPDIE = getCompileUnit(InlinedSP)->getDIE(InlinedSP);
|
|
||||||
(void) OriginSPDIE;
|
|
||||||
assert(OriginSPDIE && "Unable to find Origin DIE for the SP!");
|
|
||||||
DIE *AbsDIE = DV->getAbstractVariable()->getDIE();
|
|
||||||
assert(AbsDIE && "Unable to find Origin DIE for the Variable!");
|
|
||||||
addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin,
|
addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin,
|
||||||
dwarf::DW_FORM_ref4, AbsDIE);
|
dwarf::DW_FORM_ref4, AbsDIE);
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
addString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
addString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
addSourceLine(VariableDie, &VD);
|
addSourceLine(VariableDie, &VD);
|
||||||
@ -1604,23 +1576,27 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
|
|||||||
// Add variable address.
|
// Add variable address.
|
||||||
if (!Scope->isAbstractScope()) {
|
if (!Scope->isAbstractScope()) {
|
||||||
// Check if variable is described by DBG_VALUE instruction.
|
// Check if variable is described by DBG_VALUE instruction.
|
||||||
if (const MachineInstr *DVInsn = DV->getDbgValue()) {
|
DenseMap<const DbgVariable *, const MachineInstr *>::iterator DVI =
|
||||||
|
DbgVariableToDbgInstMap.find(DV);
|
||||||
|
if (DVI != DbgVariableToDbgInstMap.end()) {
|
||||||
|
const MachineInstr *DVInsn = DVI->second;
|
||||||
|
const MCSymbol *DVLabel = findVariableLabel(DV);
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
// FIXME : Handle getNumOperands != 3
|
// FIXME : Handle getNumOperands != 3
|
||||||
if (DVInsn->getNumOperands() == 3) {
|
if (DVInsn->getNumOperands() == 3) {
|
||||||
if (DVInsn->getOperand(0).isReg())
|
if (DVInsn->getOperand(0).isReg())
|
||||||
updated = addRegisterAddress(VariableDie, DV, DVInsn->getOperand(0));
|
updated = addRegisterAddress(VariableDie, DVLabel, DVInsn->getOperand(0));
|
||||||
else if (DVInsn->getOperand(0).isImm())
|
else if (DVInsn->getOperand(0).isImm())
|
||||||
updated = addConstantValue(VariableDie, DV, DVInsn->getOperand(0));
|
updated = addConstantValue(VariableDie, DVLabel, DVInsn->getOperand(0));
|
||||||
else if (DVInsn->getOperand(0).isFPImm())
|
else if (DVInsn->getOperand(0).isFPImm())
|
||||||
updated = addConstantFPValue(VariableDie, DV, DVInsn->getOperand(0));
|
updated = addConstantFPValue(VariableDie, DVLabel, DVInsn->getOperand(0));
|
||||||
} else {
|
} else {
|
||||||
MachineLocation Location = Asm->getDebugValueLocation(DVInsn);
|
MachineLocation Location = Asm->getDebugValueLocation(DVInsn);
|
||||||
if (Location.getReg()) {
|
if (Location.getReg()) {
|
||||||
addAddress(VariableDie, dwarf::DW_AT_location, Location);
|
addAddress(VariableDie, dwarf::DW_AT_location, Location);
|
||||||
if (MCSymbol *VS = DV->getDbgValueLabel())
|
if (DVLabel)
|
||||||
addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
|
addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
|
||||||
VS);
|
DVLabel);
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1635,9 +1611,9 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
|
|||||||
MachineLocation Location;
|
MachineLocation Location;
|
||||||
unsigned FrameReg;
|
unsigned FrameReg;
|
||||||
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
|
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
|
||||||
if (DV->hasLocation()) {
|
int FI = 0;
|
||||||
int Offset = RI->getFrameIndexReference(*Asm->MF, DV->getFrameIndex(),
|
if (findVariableFrameIndex(DV, &FI)) {
|
||||||
FrameReg);
|
int Offset = RI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
|
||||||
Location.set(FrameReg, Offset);
|
Location.set(FrameReg, Offset);
|
||||||
|
|
||||||
if (VD.hasComplexAddress())
|
if (VD.hasComplexAddress())
|
||||||
@ -2083,8 +2059,7 @@ void DwarfDebug::endModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
|
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
|
||||||
DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &Var,
|
DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &Var,
|
||||||
unsigned FrameIdx,
|
|
||||||
DebugLoc ScopeLoc) {
|
DebugLoc ScopeLoc) {
|
||||||
|
|
||||||
DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
|
DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
|
||||||
@ -2096,36 +2071,12 @@ DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &Var,
|
|||||||
if (!Scope)
|
if (!Scope)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
AbsDbgVariable = new DbgVariable(Var, FrameIdx,
|
AbsDbgVariable = new DbgVariable(Var);
|
||||||
NULL /* No more-abstract variable*/);
|
|
||||||
Scope->addVariable(AbsDbgVariable);
|
Scope->addVariable(AbsDbgVariable);
|
||||||
AbstractVariables[Var] = AbsDbgVariable;
|
AbstractVariables[Var] = AbsDbgVariable;
|
||||||
return AbsDbgVariable;
|
return AbsDbgVariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
|
|
||||||
/// FIXME : Refactor findAbstractVariable.
|
|
||||||
DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &Var,
|
|
||||||
const MachineInstr *MI,
|
|
||||||
DebugLoc ScopeLoc) {
|
|
||||||
|
|
||||||
DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
|
|
||||||
if (AbsDbgVariable)
|
|
||||||
return AbsDbgVariable;
|
|
||||||
|
|
||||||
LLVMContext &Ctx = Var->getContext();
|
|
||||||
DbgScope *Scope = AbstractScopes.lookup(ScopeLoc.getScope(Ctx));
|
|
||||||
if (!Scope)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
AbsDbgVariable = new DbgVariable(Var, MI,
|
|
||||||
NULL /* No more-abstract variable*/);
|
|
||||||
Scope->addVariable(AbsDbgVariable);
|
|
||||||
AbstractVariables[Var] = AbsDbgVariable;
|
|
||||||
DbgValueStartMap[MI] = AbsDbgVariable;
|
|
||||||
return AbsDbgVariable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// collectVariableInfo - Populate DbgScope entries with variables' info.
|
/// collectVariableInfo - Populate DbgScope entries with variables' info.
|
||||||
void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
||||||
const LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
|
const LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
|
||||||
@ -2149,9 +2100,14 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
if (Scope == 0)
|
if (Scope == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.first, VP.second);
|
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
|
||||||
DbgVariable *RegVar = new DbgVariable(DV, VP.first, AbsDbgVariable);
|
DbgVariable *RegVar = new DbgVariable(DV);
|
||||||
|
recordVariableFrameIndex(RegVar, VP.first);
|
||||||
Scope->addVariable(RegVar);
|
Scope->addVariable(RegVar);
|
||||||
|
if (AbsDbgVariable) {
|
||||||
|
recordVariableFrameIndex(AbsDbgVariable, VP.first);
|
||||||
|
VarToAbstractVarMap[RegVar] = AbsDbgVariable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect variable information from DBG_VALUE machine instructions;
|
// Collect variable information from DBG_VALUE machine instructions;
|
||||||
@ -2172,9 +2128,10 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
.getMetadata()));
|
.getMetadata()));
|
||||||
if (DV.getTag() == dwarf::DW_TAG_arg_variable) {
|
if (DV.getTag() == dwarf::DW_TAG_arg_variable) {
|
||||||
// FIXME Handle inlined subroutine arguments.
|
// FIXME Handle inlined subroutine arguments.
|
||||||
DbgVariable *ArgVar = new DbgVariable(DV, MInsn, NULL);
|
DbgVariable *ArgVar = new DbgVariable(DV);
|
||||||
CurrentFnDbgScope->addVariable(ArgVar);
|
CurrentFnDbgScope->addVariable(ArgVar);
|
||||||
DbgValueStartMap[MInsn] = ArgVar;
|
DbgValueStartMap[MInsn] = ArgVar;
|
||||||
|
DbgVariableToDbgInstMap[ArgVar] = MInsn;
|
||||||
Processed.insert(DV);
|
Processed.insert(DV);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2192,10 +2149,15 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Processed.insert(DV);
|
Processed.insert(DV);
|
||||||
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, MInsn, DL);
|
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, DL);
|
||||||
DbgVariable *RegVar = new DbgVariable(DV, MInsn, AbsDbgVariable);
|
DbgVariable *RegVar = new DbgVariable(DV);
|
||||||
DbgValueStartMap[MInsn] = RegVar;
|
DbgValueStartMap[MInsn] = RegVar;
|
||||||
|
DbgVariableToDbgInstMap[RegVar] = MInsn;
|
||||||
Scope->addVariable(RegVar);
|
Scope->addVariable(RegVar);
|
||||||
|
if (AbsDbgVariable) {
|
||||||
|
DbgVariableToDbgInstMap[AbsDbgVariable] = MInsn;
|
||||||
|
VarToAbstractVarMap[RegVar] = AbsDbgVariable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2208,7 +2170,7 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
continue;
|
continue;
|
||||||
DbgScope *Scope = DbgScopeMap.lookup(DV.getContext());
|
DbgScope *Scope = DbgScopeMap.lookup(DV.getContext());
|
||||||
if (Scope)
|
if (Scope)
|
||||||
Scope->addVariable(new DbgVariable(DV, ~0U, NULL));
|
Scope->addVariable(new DbgVariable(DV));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2232,7 +2194,8 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
PrevLabel = Label;
|
PrevLabel = Label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this instruction begins a scope then note down corresponding label.
|
// If this instruction begins a scope then note down corresponding label
|
||||||
|
// even if previous label is reused.
|
||||||
if (InsnsBeginScopeSet.count(MI) != 0)
|
if (InsnsBeginScopeSet.count(MI) != 0)
|
||||||
LabelsBeforeInsn[MI] = Label;
|
LabelsBeforeInsn[MI] = Label;
|
||||||
}
|
}
|
||||||
@ -2259,7 +2222,7 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
PrevInstLoc = DL;
|
PrevInstLoc = DL;
|
||||||
PrevLabel = Label;
|
PrevLabel = Label;
|
||||||
}
|
}
|
||||||
DI->second->setDbgValueLabel(Label);
|
DbgVariableLabelsMap[DI->second] = Label;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2275,7 +2238,8 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
PrevLabel = Label;
|
PrevLabel = Label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this instruction begins a scope then note down corresponding label.
|
// If this instruction begins a scope then note down corresponding label
|
||||||
|
// even if previous label is reused.
|
||||||
if (InsnsBeginScopeSet.count(MI) != 0)
|
if (InsnsBeginScopeSet.count(MI) != 0)
|
||||||
LabelsBeforeInsn[MI] = Label;
|
LabelsBeforeInsn[MI] = Label;
|
||||||
}
|
}
|
||||||
@ -2630,6 +2594,10 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
|||||||
|
|
||||||
// Clear debug info
|
// Clear debug info
|
||||||
CurrentFnDbgScope = NULL;
|
CurrentFnDbgScope = NULL;
|
||||||
|
DbgVariableToFrameIndexMap.clear();
|
||||||
|
VarToAbstractVarMap.clear();
|
||||||
|
DbgVariableToDbgInstMap.clear();
|
||||||
|
DbgVariableLabelsMap.clear();
|
||||||
DeleteContainerSeconds(DbgScopeMap);
|
DeleteContainerSeconds(DbgScopeMap);
|
||||||
InsnsBeginScopeSet.clear();
|
InsnsBeginScopeSet.clear();
|
||||||
InsnsEndScopeSet.clear();
|
InsnsEndScopeSet.clear();
|
||||||
@ -2644,6 +2612,33 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
|||||||
PrevLabel = NULL;
|
PrevLabel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// recordVariableFrameIndex - Record a variable's index.
|
||||||
|
void DwarfDebug::recordVariableFrameIndex(const DbgVariable *V, int Index) {
|
||||||
|
assert (V && "Invalid DbgVariable!");
|
||||||
|
DbgVariableToFrameIndexMap[V] = Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// findVariableFrameIndex - Return true if frame index for the variable
|
||||||
|
/// is found. Update FI to hold value of the index.
|
||||||
|
bool DwarfDebug::findVariableFrameIndex(const DbgVariable *V, int *FI) {
|
||||||
|
assert (V && "Invalid DbgVariable!");
|
||||||
|
DenseMap<const DbgVariable *, int>::iterator I =
|
||||||
|
DbgVariableToFrameIndexMap.find(V);
|
||||||
|
if (I == DbgVariableToFrameIndexMap.end())
|
||||||
|
return false;
|
||||||
|
*FI = I->second;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// findVariableLabel - Find MCSymbol for the variable.
|
||||||
|
const MCSymbol *DwarfDebug::findVariableLabel(const DbgVariable *V) {
|
||||||
|
DenseMap<const DbgVariable *, const MCSymbol *>::iterator I
|
||||||
|
= DbgVariableLabelsMap.find(V);
|
||||||
|
if (I == DbgVariableLabelsMap.end())
|
||||||
|
return NULL;
|
||||||
|
else return I->second;
|
||||||
|
}
|
||||||
|
|
||||||
/// recordSourceLine - Register a source line with debug info. Returns the
|
/// recordSourceLine - Register a source line with debug info. Returns the
|
||||||
/// unique label that was emitted and which provides correspondence to
|
/// unique label that was emitted and which provides correspondence to
|
||||||
/// the source line list.
|
/// the source line list.
|
||||||
|
@ -170,6 +170,21 @@ class DwarfDebug {
|
|||||||
/// DW_AT_start_scope attribute.
|
/// DW_AT_start_scope attribute.
|
||||||
DenseMap<const MachineInstr *, DbgVariable *> DbgValueStartMap;
|
DenseMap<const MachineInstr *, DbgVariable *> DbgValueStartMap;
|
||||||
|
|
||||||
|
/// DbgVariableToFrameIndexMap - Tracks frame index used to find
|
||||||
|
/// variable's value.
|
||||||
|
DenseMap<const DbgVariable *, int> DbgVariableToFrameIndexMap;
|
||||||
|
|
||||||
|
/// DbgVariableToDbgInstMap - Maps DbgVariable to corresponding DBG_VALUE
|
||||||
|
/// machine instruction.
|
||||||
|
DenseMap<const DbgVariable *, const MachineInstr *> DbgVariableToDbgInstMap;
|
||||||
|
|
||||||
|
/// DbgVariableLabelsMap - Maps DbgVariable to corresponding MCSymbol.
|
||||||
|
DenseMap<const DbgVariable *, const MCSymbol *> DbgVariableLabelsMap;
|
||||||
|
|
||||||
|
/// VarToAbstractVarMap - Maps DbgVariable with corresponding Abstract
|
||||||
|
/// DbgVariable, if any.
|
||||||
|
DenseMap<const DbgVariable *, const DbgVariable *> VarToAbstractVarMap;
|
||||||
|
|
||||||
/// InliendSubprogramDIEs - Collection of subprgram DIEs that are marked
|
/// InliendSubprogramDIEs - Collection of subprgram DIEs that are marked
|
||||||
/// (at the end of the module) as DW_AT_inline.
|
/// (at the end of the module) as DW_AT_inline.
|
||||||
SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
|
SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
|
||||||
@ -306,13 +321,13 @@ private:
|
|||||||
const MachineLocation &Location);
|
const MachineLocation &Location);
|
||||||
|
|
||||||
/// addRegisterAddress - Add register location entry in variable DIE.
|
/// addRegisterAddress - Add register location entry in variable DIE.
|
||||||
bool addRegisterAddress(DIE *Die, DbgVariable *DV, const MachineOperand &MO);
|
bool addRegisterAddress(DIE *Die, const MCSymbol *VS, const MachineOperand &MO);
|
||||||
|
|
||||||
/// addConstantValue - Add constant value entry in variable DIE.
|
/// addConstantValue - Add constant value entry in variable DIE.
|
||||||
bool addConstantValue(DIE *Die, DbgVariable *DV, const MachineOperand &MO);
|
bool addConstantValue(DIE *Die, const MCSymbol *VS, const MachineOperand &MO);
|
||||||
|
|
||||||
/// addConstantFPValue - Add constant value entry in variable DIE.
|
/// addConstantFPValue - Add constant value entry in variable DIE.
|
||||||
bool addConstantFPValue(DIE *Die, DbgVariable *DV, const MachineOperand &MO);
|
bool addConstantFPValue(DIE *Die, const MCSymbol *VS, const MachineOperand &MO);
|
||||||
|
|
||||||
/// addComplexAddress - Start with the address based on the location provided,
|
/// addComplexAddress - Start with the address based on the location provided,
|
||||||
/// and generate the DWARF information necessary to find the actual variable
|
/// and generate the DWARF information necessary to find the actual variable
|
||||||
@ -385,10 +400,7 @@ private:
|
|||||||
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
||||||
|
|
||||||
/// findAbstractVariable - Find abstract variable associated with Var.
|
/// findAbstractVariable - Find abstract variable associated with Var.
|
||||||
DbgVariable *findAbstractVariable(DIVariable &Var, unsigned FrameIdx,
|
DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
|
||||||
DebugLoc Loc);
|
|
||||||
DbgVariable *findAbstractVariable(DIVariable &Var, const MachineInstr *MI,
|
|
||||||
DebugLoc Loc);
|
|
||||||
|
|
||||||
/// updateSubprogramScopeDIE - Find DIE for the given subprogram and
|
/// updateSubprogramScopeDIE - Find DIE for the given subprogram and
|
||||||
/// attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes.
|
/// attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes.
|
||||||
@ -536,6 +548,16 @@ private:
|
|||||||
return Lines.size();
|
return Lines.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// recordVariableFrameIndex - Record a variable's index.
|
||||||
|
void recordVariableFrameIndex(const DbgVariable *V, int Index);
|
||||||
|
|
||||||
|
/// findVariableFrameIndex - Return true if frame index for the variable
|
||||||
|
/// is found. Update FI to hold value of the index.
|
||||||
|
bool findVariableFrameIndex(const DbgVariable *V, int *FI);
|
||||||
|
|
||||||
|
/// findVariableLabel - Find MCSymbol for the variable.
|
||||||
|
const MCSymbol *findVariableLabel(const DbgVariable *V);
|
||||||
|
|
||||||
/// identifyScopeMarkers() - Indentify instructions that are marking
|
/// identifyScopeMarkers() - Indentify instructions that are marking
|
||||||
/// beginning of or end of a scope.
|
/// beginning of or end of a scope.
|
||||||
void identifyScopeMarkers();
|
void identifyScopeMarkers();
|
||||||
|
Loading…
Reference in New Issue
Block a user