diff options
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 25 | ||||
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 |
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) { |