mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator changes to ensure discriminator changes don't introduce new DWARF DW_TAG_lexical_blocks.
Somewhat unnoticed in the original implementation of discriminators, but it could cause instructions to end up in new, small, DW_TAG_lexical_blocks due to the use of DILexicalBlock to track discriminator changes. Instead, use DILexicalBlockFile which we already use to track file changes without introducing new scopes, so it works well to track discriminator changes in the same way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1249,11 +1249,13 @@ DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
|
||||
/// createLexicalBlockFile - This creates a new MDNode that encapsulates
|
||||
/// an existing scope with a new filename.
|
||||
DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
|
||||
DIFile File) {
|
||||
DIFile File,
|
||||
unsigned Discriminator) {
|
||||
Value *Elts[] = {
|
||||
GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
|
||||
File.getFileNode(),
|
||||
Scope
|
||||
Scope,
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
|
||||
};
|
||||
DILexicalBlockFile R(MDNode::get(VMContext, Elts));
|
||||
assert(
|
||||
@@ -1263,8 +1265,7 @@ DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
|
||||
}
|
||||
|
||||
DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
|
||||
unsigned Line, unsigned Col,
|
||||
unsigned Discriminator) {
|
||||
unsigned Line, unsigned Col) {
|
||||
// FIXME: This isn't thread safe nor the right way to defeat MDNode uniquing.
|
||||
// I believe the right way is to have a self-referential element in the node.
|
||||
// Also: why do we bother with line/column - they're not used and the
|
||||
@@ -1280,7 +1281,6 @@ DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
|
||||
getNonCompileUnitScope(Scope),
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), Col),
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
|
||||
};
|
||||
DILexicalBlock R(MDNode::get(VMContext, Elts));
|
||||
|
@@ -326,7 +326,7 @@ bool DIDescriptor::isNameSpace() const {
|
||||
/// lexical block with an extra file.
|
||||
bool DIDescriptor::isLexicalBlockFile() const {
|
||||
return DbgNode && getTag() == dwarf::DW_TAG_lexical_block &&
|
||||
(DbgNode->getNumOperands() == 3);
|
||||
(DbgNode->getNumOperands() == 4);
|
||||
}
|
||||
|
||||
/// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
|
||||
@@ -638,12 +638,12 @@ bool DISubrange::Verify() const {
|
||||
|
||||
/// \brief Verify that the lexical block descriptor is well formed.
|
||||
bool DILexicalBlock::Verify() const {
|
||||
return isLexicalBlock() && DbgNode->getNumOperands() == 7;
|
||||
return isLexicalBlock() && DbgNode->getNumOperands() == 6;
|
||||
}
|
||||
|
||||
/// \brief Verify that the file-scoped lexical block descriptor is well formed.
|
||||
bool DILexicalBlockFile::Verify() const {
|
||||
return isLexicalBlockFile() && DbgNode->getNumOperands() == 3;
|
||||
return isLexicalBlockFile() && DbgNode->getNumOperands() == 4;
|
||||
}
|
||||
|
||||
/// \brief Verify that the template type parameter descriptor is well formed.
|
||||
@@ -851,7 +851,7 @@ DIArray DICompileUnit::getImportedEntities() const {
|
||||
/// copyWithNewScope - Return a copy of this location, replacing the
|
||||
/// current scope with the given one.
|
||||
DILocation DILocation::copyWithNewScope(LLVMContext &Ctx,
|
||||
DILexicalBlock NewScope) {
|
||||
DILexicalBlockFile NewScope) {
|
||||
SmallVector<Value *, 10> Elts;
|
||||
assert(Verify());
|
||||
for (unsigned I = 0; I < DbgNode->getNumOperands(); ++I) {
|
||||
|
Reference in New Issue
Block a user