summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-07-31 18:58:39 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-07-31 18:58:39 +0000
commited013cd221aea3911dc0c8f33948c05799f751c0 (patch)
treea164aebf28e64bfda6398d88c50d41ce4acf9ed3 /llvm/lib/IR
parent0aeed7c0b864f51e64a006a1a17172bfaab8998c (diff)
downloadbcm5719-llvm-ed013cd221aea3911dc0c8f33948c05799f751c0.tar.gz
bcm5719-llvm-ed013cd221aea3911dc0c8f33948c05799f751c0.zip
DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags, using `DW_TAG_variable` in their place Stop exposing the `tag:` field at all in the assembly format for `DILocalVariable`. Most of the testcase updates were generated by the following sed script: find test/ -name "*.ll" -o -name "*.mir" | xargs grep -l 'DILocalVariable' | xargs sed -i '' \ -e 's/tag: DW_TAG_arg_variable, //' \ -e 's/tag: DW_TAG_auto_variable, //' There were only a handful of tests in `test/Assembly` that I needed to update by hand. (Note: a follow-up could change `DILocalVariable::DILocalVariable()` to set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable` (as appropriate), instead of having that logic magically in the backend in `DbgVariable`. I've added a FIXME to that effect.) llvm-svn: 243774
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp5
-rw-r--r--llvm/lib/IR/DIBuilder.cpp7
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp16
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h25
-rw-r--r--llvm/lib/IR/Verifier.cpp6
5 files changed, 25 insertions, 34 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index e3905de6597..4f4e9850061 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1800,11 +1800,8 @@ static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N,
SlotTracker *Machine, const Module *Context) {
Out << "!DILocalVariable(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
- Printer.printTag(N);
Printer.printString("name", N->getName());
- Printer.printInt("arg", N->getArg(),
- /* ShouldSkipZero */
- N->getTag() == dwarf::DW_TAG_auto_variable);
+ Printer.printInt("arg", N->getArg());
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
Printer.printMetadata("file", N->getRawFile());
Printer.printInt("line", N->getLine());
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 7a4c5203965..3e5a50a8952 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -613,10 +613,9 @@ static DILocalVariable *createLocalVariable(
// the only valid scopes)?
DIScope *Context = getNonCompileUnitScope(Scope);
- dwarf::Tag Tag = ArgNo ? dwarf::DW_TAG_arg_variable : dwarf::DW_TAG_auto_variable;
- auto *Node = DILocalVariable::get(
- VMContext, Tag, cast_or_null<DILocalScope>(Context), Name, File, LineNo,
- DITypeRef::get(Ty), ArgNo, Flags);
+ auto *Node =
+ DILocalVariable::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
+ File, LineNo, DITypeRef::get(Ty), ArgNo, Flags);
if (AlwaysPreserve) {
// The optimizer may remove local variables. If there is an interest
// to preserve variable info in such situation then stash it in a
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index db6da05cfd8..4adda6fb293 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -466,21 +466,21 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
Ops);
}
-DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
- Metadata *Scope, MDString *Name,
- Metadata *File, unsigned Line,
- Metadata *Type, unsigned Arg,
- unsigned Flags, StorageType Storage,
+DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
+ MDString *Name, Metadata *File,
+ unsigned Line, Metadata *Type,
+ unsigned Arg, unsigned Flags,
+ StorageType Storage,
bool ShouldCreate) {
// 64K ought to be enough for any frontend.
assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
assert(Scope && "Expected scope");
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
- Line, Type, Arg, Flags));
+ DEFINE_GETIMPL_LOOKUP(DILocalVariable,
+ (Scope, getString(Name), File, Line, Type, Arg, Flags));
Metadata *Ops[] = {Scope, Name, File, Type};
- DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
+ DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops);
}
DIExpression *DIExpression::getImpl(LLVMContext &Context,
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index cbbf11e334c..35897a93788 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -759,7 +759,6 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
};
template <> struct MDNodeKeyImpl<DILocalVariable> {
- unsigned Tag;
Metadata *Scope;
StringRef Name;
Metadata *File;
@@ -768,23 +767,23 @@ template <> struct MDNodeKeyImpl<DILocalVariable> {
unsigned Arg;
unsigned Flags;
- MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File,
- unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags)
- : Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
- Arg(Arg), Flags(Flags) {}
+ MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *File, unsigned Line,
+ Metadata *Type, unsigned Arg, unsigned Flags)
+ : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
+ Flags(Flags) {}
MDNodeKeyImpl(const DILocalVariable *N)
- : Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
- File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
- Arg(N->getArg()), Flags(N->getFlags()) {}
+ : Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()),
+ Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
+ Flags(N->getFlags()) {}
bool isKeyOf(const DILocalVariable *RHS) const {
- return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
- Name == RHS->getName() && File == RHS->getRawFile() &&
- Line == RHS->getLine() && Type == RHS->getRawType() &&
- Arg == RHS->getArg() && Flags == RHS->getFlags();
+ return Scope == RHS->getRawScope() && Name == RHS->getName() &&
+ File == RHS->getRawFile() && Line == RHS->getLine() &&
+ Type == RHS->getRawType() && Arg == RHS->getArg() &&
+ Flags == RHS->getFlags();
}
unsigned getHashValue() const {
- return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags);
+ return hash_combine(Scope, Name, File, Line, Type, Arg, Flags);
}
};
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 855456d0b2b..7d791acf838 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1077,13 +1077,9 @@ void Verifier::visitDILocalVariable(const DILocalVariable &N) {
// Checks common to all variables.
visitDIVariable(N);
- Assert(N.getTag() == dwarf::DW_TAG_auto_variable ||
- N.getTag() == dwarf::DW_TAG_arg_variable,
- "invalid tag", &N);
+ Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
"local variable requires a valid scope", &N, N.getRawScope());
- Assert(bool(N.getArg()) == (N.getTag() == dwarf::DW_TAG_arg_variable),
- "local variable should have arg iff it's a DW_TAG_arg_variable", &N);
}
void Verifier::visitDIExpression(const DIExpression &N) {
OpenPOWER on IntegriCloud