mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-20 09:30:43 +00:00
Collect variable information during endFunction() instead of beginFunction().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46099f14dc
commit
65eb482e8f
@ -2156,8 +2156,10 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
DbgVariable *RegVar = new DbgVariable(DV);
|
DbgVariable *RegVar = new DbgVariable(DV);
|
||||||
DbgVariableToDbgInstMap[RegVar] = MInsn;
|
DbgVariableToDbgInstMap[RegVar] = MInsn;
|
||||||
Scope->addVariable(RegVar);
|
Scope->addVariable(RegVar);
|
||||||
if (DV.getTag() != dwarf::DW_TAG_arg_variable)
|
if (DV.getTag() != dwarf::DW_TAG_arg_variable) {
|
||||||
DbgValueStartMap[MInsn] = RegVar;
|
DbgValueStartMap[MInsn] = RegVar;
|
||||||
|
DbgVariableLabelsMap[RegVar] = LabelsBeforeInsn.lookup(MInsn);
|
||||||
|
}
|
||||||
if (DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc())) {
|
if (DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc())) {
|
||||||
DbgVariableToDbgInstMap[AbsVar] = MInsn;
|
DbgVariableToDbgInstMap[AbsVar] = MInsn;
|
||||||
VarToAbstractVarMap[RegVar] = AbsVar;
|
VarToAbstractVarMap[RegVar] = AbsVar;
|
||||||
@ -2186,12 +2188,13 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
if (DL.isUnknown() && !UnknownLocations)
|
if (DL.isUnknown() && !UnknownLocations)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DbgVariable *LocalVar = NULL;
|
bool LocalVar = false;
|
||||||
if (MI->isDebugValue()) {
|
if (MI->isDebugValue()) {
|
||||||
DenseMap<const MachineInstr *, DbgVariable *>::iterator DI
|
assert (MI->getNumOperands() > 1 && "Invalid machine instruction!");
|
||||||
= DbgValueStartMap.find(MI);
|
DIVariable DV(MI->getOperand(MI->getNumOperands() - 1).getMetadata());
|
||||||
if (DI != DbgValueStartMap.end())
|
if (!DV.Verify()) return;
|
||||||
LocalVar = DI->second;
|
if (DV.getTag() != dwarf::DW_TAG_arg_variable)
|
||||||
|
LocalVar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *Label = NULL;
|
MCSymbol *Label = NULL;
|
||||||
@ -2220,10 +2223,6 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
// even if previous label is reused.
|
// even if previous label is reused.
|
||||||
if (InsnsBeginScopeSet.count(MI) != 0)
|
if (InsnsBeginScopeSet.count(MI) != 0)
|
||||||
LabelsBeforeInsn[MI] = Label;
|
LabelsBeforeInsn[MI] = Label;
|
||||||
|
|
||||||
// If this is a DBG_VALUE instruction then record label to identify variable.
|
|
||||||
if (LocalVar)
|
|
||||||
DbgVariableLabelsMap[LocalVar] = Label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// endScope - Process end of a scope.
|
/// endScope - Process end of a scope.
|
||||||
@ -2509,8 +2508,6 @@ static DebugLoc FindFirstDebugLoc(const MachineFunction *MF) {
|
|||||||
void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||||
if (!MMI->hasDebugInfo()) return;
|
if (!MMI->hasDebugInfo()) return;
|
||||||
if (!extractScopeInformation()) return;
|
if (!extractScopeInformation()) return;
|
||||||
|
|
||||||
collectVariableInfo(MF);
|
|
||||||
|
|
||||||
FunctionBeginSym = Asm->GetTempSymbol("func_begin",
|
FunctionBeginSym = Asm->GetTempSymbol("func_begin",
|
||||||
Asm->getFunctionNumber());
|
Asm->getFunctionNumber());
|
||||||
@ -2543,6 +2540,9 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
|||||||
if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;
|
if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;
|
||||||
|
|
||||||
if (CurrentFnDbgScope) {
|
if (CurrentFnDbgScope) {
|
||||||
|
|
||||||
|
collectVariableInfo(MF);
|
||||||
|
|
||||||
// Define end label for subprogram.
|
// Define end label for subprogram.
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("func_end",
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("func_end",
|
||||||
Asm->getFunctionNumber()));
|
Asm->getFunctionNumber()));
|
||||||
|
Loading…
Reference in New Issue
Block a user