mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-19 04:28:20 +00:00
Attach AT_APPLE_optimized attribute to optimized function's debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102743 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -392,6 +392,7 @@ namespace llvm {
|
|||||||
return getFieldAs<DICompositeType>(13);
|
return getFieldAs<DICompositeType>(13);
|
||||||
}
|
}
|
||||||
unsigned isArtificial() const { return getUnsignedField(14); }
|
unsigned isArtificial() const { return getUnsignedField(14); }
|
||||||
|
unsigned isOptimized() const;
|
||||||
|
|
||||||
StringRef getFilename() const {
|
StringRef getFilename() const {
|
||||||
if (getVersion() == llvm::LLVMDebugVersion7)
|
if (getVersion() == llvm::LLVMDebugVersion7)
|
||||||
@@ -642,7 +643,8 @@ namespace llvm {
|
|||||||
unsigned VK = 0,
|
unsigned VK = 0,
|
||||||
unsigned VIndex = 0,
|
unsigned VIndex = 0,
|
||||||
DIType = DIType(),
|
DIType = DIType(),
|
||||||
bool isArtificial = 0);
|
bool isArtificial = 0,
|
||||||
|
bool isOptimized = false);
|
||||||
|
|
||||||
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
||||||
/// given declaration.
|
/// given declaration.
|
||||||
|
@@ -425,6 +425,13 @@ bool DISubprogram::describes(const Function *F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned DISubprogram::isOptimized() const {
|
||||||
|
assert (DbgNode && "Invalid subprogram descriptor!");
|
||||||
|
if (DbgNode->getNumOperands() == 16)
|
||||||
|
return getUnsignedField(15);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
StringRef DIScope::getFilename() const {
|
StringRef DIScope::getFilename() const {
|
||||||
if (!DbgNode)
|
if (!DbgNode)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
@@ -912,7 +919,8 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
|||||||
bool isDefinition,
|
bool isDefinition,
|
||||||
unsigned VK, unsigned VIndex,
|
unsigned VK, unsigned VIndex,
|
||||||
DIType ContainingType,
|
DIType ContainingType,
|
||||||
bool isArtificial) {
|
bool isArtificial,
|
||||||
|
bool isOptimized) {
|
||||||
|
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(dwarf::DW_TAG_subprogram),
|
GetTagConstant(dwarf::DW_TAG_subprogram),
|
||||||
@@ -929,9 +937,10 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
|||||||
ConstantInt::get(Type::getInt32Ty(VMContext), (unsigned)VK),
|
ConstantInt::get(Type::getInt32Ty(VMContext), (unsigned)VK),
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), VIndex),
|
ConstantInt::get(Type::getInt32Ty(VMContext), VIndex),
|
||||||
ContainingType.getNode(),
|
ContainingType.getNode(),
|
||||||
ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial)
|
ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial),
|
||||||
|
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized)
|
||||||
};
|
};
|
||||||
return DISubprogram(MDNode::get(VMContext, &Elts[0], 15));
|
return DISubprogram(MDNode::get(VMContext, &Elts[0], 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
||||||
@@ -956,9 +965,10 @@ DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration)
|
|||||||
DeclNode->getOperand(11), // Virtuality
|
DeclNode->getOperand(11), // Virtuality
|
||||||
DeclNode->getOperand(12), // VIndex
|
DeclNode->getOperand(12), // VIndex
|
||||||
DeclNode->getOperand(13), // Containting Type
|
DeclNode->getOperand(13), // Containting Type
|
||||||
DeclNode->getOperand(14) // isArtificial
|
DeclNode->getOperand(14), // isArtificial
|
||||||
|
DeclNode->getOperand(15) // isOptimized
|
||||||
};
|
};
|
||||||
return DISubprogram(MDNode::get(VMContext, &Elts[0], 15));
|
return DISubprogram(MDNode::get(VMContext, &Elts[0], 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||||
|
@@ -1328,12 +1328,18 @@ DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) {
|
|||||||
if (SP.isArtificial())
|
if (SP.isArtificial())
|
||||||
addUInt(SPDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
addUInt(SPDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
// DW_TAG_inlined_subroutine may refer to this DIE.
|
if (!SP.isLocalToUnit())
|
||||||
ModuleCU->insertDIE(SP.getNode(), SPDie);
|
addUInt(SPDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
|
if (SP.isOptimized())
|
||||||
|
addUInt(SPDie, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
if (!DisableFramePointerElim(*Asm->MF))
|
if (!DisableFramePointerElim(*Asm->MF))
|
||||||
addUInt(SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr, dwarf::DW_FORM_flag, 1);
|
addUInt(SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
|
// DW_TAG_inlined_subroutine may refer to this DIE.
|
||||||
|
ModuleCU->insertDIE(SP.getNode(), SPDie);
|
||||||
|
|
||||||
return SPDie;
|
return SPDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1424,9 +1430,6 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) {
|
|||||||
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
|
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
|
||||||
addAddress(SPDie, dwarf::DW_AT_frame_base, Location);
|
addAddress(SPDie, dwarf::DW_AT_frame_base, Location);
|
||||||
|
|
||||||
if (!DISubprogram(SPNode).isLocalToUnit())
|
|
||||||
addUInt(SPDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
|
|
||||||
|
|
||||||
return SPDie;
|
return SPDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user