diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h @@ -24,8 +24,7 @@ public: class iterator; - /// This class represents an Operation in the Expression. Each operation can - /// have up to 2 oprerands. + /// This class represents an Operation in the Expression. /// /// An Operation can be in Error state (check with isError()). This /// means that it couldn't be decoded successfully and if it is the @@ -50,7 +49,6 @@ SignedSize4 = SignBit | Size4, SignedSize8 = SignBit | Size8, SignedSizeLEB = SignBit | SizeLEB, - SizeNA = 0xFF ///< Unused operands get this encoding. }; enum DwarfVersion : uint8_t { @@ -64,14 +62,13 @@ /// Description of the encoding of one expression Op. struct Description { DwarfVersion Version; ///< Dwarf version where the Op was introduced. - Encoding Op[2]; ///< Encoding for Op operands, or SizeNA. - - Description(DwarfVersion Version = DwarfNA, Encoding Op1 = SizeNA, - Encoding Op2 = SizeNA) - : Version(Version) { - Op[0] = Op1; - Op[1] = Op2; - } + SmallVector Op; ///< Encoding for Op operands. + + template + Description(DwarfVersion Version, Ts... Op) + : Version(Version), Op{Op...} {} + Description() : Description(DwarfNA) {} + ~Description() = default; }; private: @@ -80,13 +77,18 @@ Description Desc; bool Error = false; uint64_t EndOffset; - uint64_t Operands[2]; - uint64_t OperandEndOffsets[2]; + SmallVector Operands; + SmallVector OperandEndOffsets; public: const Description &getDescription() const { return Desc; } uint8_t getCode() const { return Opcode; } + uint64_t getNumOperands() const { return Operands.size(); } + ArrayRef getRawOperands() const { return Operands; }; uint64_t getRawOperand(unsigned Idx) const { return Operands[Idx]; } + ArrayRef getOperandEndOffsets() const { + return OperandEndOffsets; + } uint64_t getOperandEndOffset(unsigned Idx) const { return OperandEndOffsets[Idx]; } @@ -165,7 +167,7 @@ static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS, DIDumpOptions DumpOpts, uint8_t Opcode, - const uint64_t Operands[2]); + const ArrayRef Operands); private: DataExtractor Data; diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h @@ -33,22 +33,17 @@ // OP_[GNU_]deref_type, OP_[GNU_]entry_value, OP_implicit_value, // OP_[GNU_]implicit_pointer, OP_[GNU_]regval_type, OP_xderef_type. LVSmall Opcode = 0; - uint64_t Operands[2]; + SmallVector Operands; public: LVOperation() = delete; - LVOperation(LVSmall Opcode, LVUnsigned Operand1, LVUnsigned Operand2) - : Opcode(Opcode) { - Operands[0] = Operand1; - Operands[1] = Operand2; - } + LVOperation(LVSmall Opcode, ArrayRef Operands) + : Opcode(Opcode), Operands(Operands) {} LVOperation(const LVOperation &) = delete; LVOperation &operator=(const LVOperation &) = delete; ~LVOperation() = default; LVSmall getOpcode() const { return Opcode; } - uint64_t getOperand1() const { return Operands[0]; } - uint64_t getOperand2() const { return Operands[1]; } std::string getOperandsDWARFInfo(); std::string getOperandsCodeViewInfo(); @@ -154,8 +149,7 @@ virtual void addObject(LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset) {} - virtual void addObject(LVSmall Opcode, LVUnsigned Operand1, - LVUnsigned Operand2) {} + virtual void addObject(LVSmall Opcode, ArrayRef Operands) {} static void print(LVLocations *Locations, raw_ostream &OS, bool Full = true); void printInterval(raw_ostream &OS, bool Full = true) const; @@ -184,8 +178,7 @@ void addObject(LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset) override; - void addObject(LVSmall Opcode, LVUnsigned Operand1, - LVUnsigned Operand2) override; + void addObject(LVSmall Opcode, ArrayRef Operands) override; void printRawExtra(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override; diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h @@ -228,10 +228,8 @@ #undef LV_CREATE_OBJECT // Operations creation. - LVOperation *createOperation(LVSmall OpCode, LVUnsigned Operand1, - LVUnsigned Operand2) { - return new (AllocatedOperation.Allocate()) - LVOperation(OpCode, Operand1, Operand2); + LVOperation *createOperation(LVSmall OpCode, ArrayRef Operands) { + return new (AllocatedOperation.Allocate()) LVOperation(OpCode, Operands); } StringRef getFilename(LVObject *Object, size_t Index) const; @@ -263,7 +261,8 @@ Error doPrint(); Error doLoad(); - virtual std::string getRegisterName(LVSmall Opcode, uint64_t Operands[2]) { + virtual std::string getRegisterName(LVSmall Opcode, + ArrayRef Operands) { llvm_unreachable("Invalid instance reader."); return {}; } diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h @@ -126,8 +126,7 @@ // Add a Location Entry. void addLocationConstant(dwarf::Attribute Attr, LVUnsigned Constant, uint64_t LocDescOffset); - void addLocationOperands(LVSmall Opcode, uint64_t Operand1, - uint64_t Operand2); + void addLocationOperands(LVSmall Opcode, ArrayRef Operands); void addLocation(dwarf::Attribute Attr, LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset, bool CallSiteLocation = false); diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h --- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h @@ -215,7 +215,8 @@ static StringRef getSymbolKindName(SymbolKind Kind); static std::string formatRegisterId(RegisterId Register, CPUType CPU); - std::string getRegisterName(LVSmall Opcode, uint64_t Operands[2]) override; + std::string getRegisterName(LVSmall Opcode, + ArrayRef Operands) override; bool isSystemEntry(LVElement *Element, StringRef Name) const override; diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h --- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h @@ -145,7 +145,8 @@ return SymbolsWithLocations; } - std::string getRegisterName(LVSmall Opcode, uint64_t Operands[2]) override; + std::string getRegisterName(LVSmall Opcode, + ArrayRef Operands) override; void print(raw_ostream &OS) const; diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2615,9 +2615,7 @@ "3 operand ops not yet supported"); Streamer.emitInt8(Op.getCode(), Comment != End ? *(Comment++) : ""); Offset++; - for (unsigned I = 0; I < 2; ++I) { - if (Op.getDescription().Op[I] == Encoding::SizeNA) - continue; + for (unsigned I = 0; I < Op.getDescription().Op.size(); ++I) { if (Op.getDescription().Op[I] == Encoding::BaseTypeRef) { unsigned Length = Streamer.emitDIERef(*CU->ExprRefedBaseTypes[Op.getRawOperand(I)].Die); diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1152,17 +1152,17 @@ uint64_t OpOffset = 0; for (auto &Op : Expression) { - auto Description = Op.getDescription(); + auto Desc = Op.getDescription(); // DW_OP_const_type is variable-length and has 3 - // operands. DWARFExpression thus far only supports 2. - auto Op0 = Description.Op[0]; - auto Op1 = Description.Op[1]; - if ((Op0 == Encoding::BaseTypeRef && Op1 != Encoding::SizeNA) || - (Op1 == Encoding::BaseTypeRef && Op0 != Encoding::Size1)) + // operands. Thus far we only support 2. + if ((Desc.Op.size() == 2 && Desc.Op[0] == Encoding::BaseTypeRef) || + (Desc.Op.size() == 2 && Desc.Op[1] == Encoding::BaseTypeRef && + Desc.Op[0] != Encoding::Size1)) Linker.reportWarning("Unsupported DW_OP encoding.", File); - if ((Op0 == Encoding::BaseTypeRef && Op1 == Encoding::SizeNA) || - (Op1 == Encoding::BaseTypeRef && Op0 == Encoding::Size1)) { + if ((Desc.Op.size() == 1 && Desc.Op[0] == Encoding::BaseTypeRef) || + (Desc.Op.size() == 2 && Desc.Op[1] == Encoding::BaseTypeRef && + Desc.Op[0] == Encoding::Size1)) { // This code assumes that the other non-typeref operand fits into 1 byte. assert(OpOffset < Op.getEndOffset()); uint32_t ULEBsize = Op.getEndOffset() - OpOffset - 1; @@ -1171,7 +1171,7 @@ // Copy over the operation. OutputBuffer.push_back(Op.getCode()); uint64_t RefOffset; - if (Op1 == Encoding::SizeNA) { + if (Desc.Op.size() == 1) { RefOffset = Op.getRawOperand(0); } else { OutputBuffer.push_back(Op.getRawOperand(0)); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp @@ -18,13 +18,11 @@ namespace llvm { -typedef std::vector DescVector; - -static DescVector getDescriptions() { - DescVector Descriptions; - typedef DWARFExpression::Operation Op; - typedef Op::Description Desc; +typedef DWARFExpression::Operation Op; +typedef Op::Description Desc; +static std::vector getOpDescriptions() { + std::vector Descriptions; Descriptions.resize(0xff); Descriptions[DW_OP_addr] = Desc(Op::Dwarf2, Op::SizeAddr); Descriptions[DW_OP_deref] = Desc(Op::Dwarf2); @@ -97,24 +95,25 @@ Descriptions[DW_OP_GNU_addr_index] = Desc(Op::Dwarf4, Op::SizeLEB); Descriptions[DW_OP_GNU_const_index] = Desc(Op::Dwarf4, Op::SizeLEB); Descriptions[DW_OP_GNU_entry_value] = Desc(Op::Dwarf4, Op::SizeLEB); - Descriptions[DW_OP_addrx] = Desc(Op::Dwarf5, Op::SizeLEB); Descriptions[DW_OP_constx] = Desc(Op::Dwarf5, Op::SizeLEB); Descriptions[DW_OP_convert] = Desc(Op::Dwarf5, Op::BaseTypeRef); Descriptions[DW_OP_entry_value] = Desc(Op::Dwarf5, Op::SizeLEB); Descriptions[DW_OP_regval_type] = Desc(Op::Dwarf5, Op::SizeLEB, Op::BaseTypeRef); - return Descriptions; } -static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) { - // FIXME: Make this constexpr once all compilers are smart enough to do it. - static DescVector Descriptions = getDescriptions(); +static Desc getDescImpl(ArrayRef Descriptions, unsigned Opcode) { // Handle possible corrupted or unsupported operation. - if (OpCode >= Descriptions.size()) + if (Opcode >= Descriptions.size()) return {}; - return Descriptions[OpCode]; + return Descriptions[Opcode]; +} + +static Desc getOpDesc(unsigned Opcode) { + static std::vector Descriptions = getOpDescriptions(); + return getDescImpl(Descriptions, Opcode); } bool DWARFExpression::Operation::extract(DataExtractor Data, @@ -127,13 +126,12 @@ if (Desc.Version == Operation::DwarfNA) return false; - for (unsigned Operand = 0; Operand < 2; ++Operand) { + Operands.resize(Desc.Op.size()); + OperandEndOffsets.resize(Desc.Op.size()); + for (unsigned Operand = 0; Operand < Desc.Op.size(); ++Operand) { unsigned Size = Desc.Op[Operand]; unsigned Signed = Size & Operation::SignBit; - if (Size == Operation::SizeNA) - break; - switch (Size & ~Operation::SignBit) { case Operation::Size1: Operands[Operand] = Data.getU8(&Offset); @@ -208,9 +206,9 @@ static void prettyPrintBaseTypeRef(DWARFUnit *U, raw_ostream &OS, DIDumpOptions DumpOpts, - const uint64_t Operands[2], + ArrayRef Operands, unsigned Operand) { - assert(Operand < 2 && "operand out of bounds"); + assert(Operand < Operands.size() && "operand out of bounds"); auto Die = U->getDIEForOffset(U->getOffset() + Operands[Operand]); if (Die && Die.getTag() == dwarf::DW_TAG_base_type) { OS << " ("; @@ -228,7 +226,7 @@ bool DWARFExpression::prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS, DIDumpOptions DumpOpts, uint8_t Opcode, - const uint64_t Operands[2]) { + ArrayRef Operands) { if (!DumpOpts.GetNameForDWARFReg) return false; @@ -278,13 +276,10 @@ if (prettyPrintRegisterOp(U, OS, DumpOpts, Opcode, Operands)) return true; - for (unsigned Operand = 0; Operand < 2; ++Operand) { + for (unsigned Operand = 0; Operand < Desc.Op.size(); ++Operand) { unsigned Size = Desc.Op[Operand]; unsigned Signed = Size & Operation::SignBit; - if (Size == Operation::SizeNA) - break; - if (Size == Operation::BaseTypeRef && U) { // For DW_OP_convert the operand may be 0 to indicate that conversion to // the generic type should be done. The same holds for DW_OP_reinterpret, @@ -356,12 +351,9 @@ } bool DWARFExpression::Operation::verify(const Operation &Op, DWARFUnit *U) { - for (unsigned Operand = 0; Operand < 2; ++Operand) { + for (unsigned Operand = 0; Operand < Op.Desc.Op.size(); ++Operand) { unsigned Size = Op.Desc.Op[Operand]; - if (Size == Operation::SizeNA) - break; - if (Size == Operation::BaseTypeRef) { // For DW_OP_convert the operand may be 0 to indicate that conversion to // the generic type should be done, so don't look up a base type in that diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp --- a/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp @@ -352,7 +352,7 @@ uint16_t OperationCode = getCodeViewOperationCode(Opcode); switch (OperationCode) { - // Operands: [Offset, 0]. + // Operands: [Offset]. case codeview::SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL: Stream << "frame_pointer_rel " << int(Operands[0]); break; @@ -360,7 +360,7 @@ Stream << "frame_pointer_rel_full_scope " << int(Operands[0]); break; - // Operands: [Register, 0]. + // Operands: [Register]. case codeview::SymbolKind::S_DEFRANGE_REGISTER: Stream << "register " << getReader().getRegisterName(Opcode, Operands); break; @@ -375,7 +375,7 @@ << " offset " << int(Operands[1]); break; - // Operands: [Program, 0]. + // Operands: [Program]. case codeview::SymbolKind::S_DEFRANGE: Stream << "frame " << int(Operands[0]); break; @@ -576,11 +576,11 @@ } // Add a Location Record. -void LVLocationSymbol::addObject(LVSmall Opcode, LVUnsigned Operand1, - LVUnsigned Operand2) { +void LVLocationSymbol::addObject(LVSmall Opcode, + ArrayRef Operands) { if (!Entries) Entries = std::make_unique(); - Entries->push_back(getReader().createOperation(Opcode, Operand1, Operand2)); + Entries->push_back(getReader().createOperation(Opcode, Operands)); } // Based on the DWARF attribute, define the location kind. diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp --- a/llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp @@ -82,10 +82,10 @@ } // Add a Location Record. -void LVSymbol::addLocationOperands(LVSmall Opcode, uint64_t Operand1, - uint64_t Operand2) { +void LVSymbol::addLocationOperands(LVSmall Opcode, + ArrayRef Operands) { if (CurrentLocation) - CurrentLocation->addObject(Opcode, Operand1, Operand2); + CurrentLocation->addObject(Opcode, Operands); } // Add a Location Entry. @@ -97,8 +97,7 @@ /*SectionOffset=*/0, LocDescOffset); // Add records to Location Entry. - addLocationOperands(/*Opcode=*/LVLocationMemberOffset, - /*Operand1=*/Constant, /*Operand2=*/0); + addLocationOperands(/*Opcode=*/LVLocationMemberOffset, {Constant}); } LVLocations::iterator LVSymbol::addLocationGap(LVLocations::iterator Pos, @@ -115,8 +114,7 @@ LVLocations::iterator Iter = Locations->insert(Pos, Gap); // Add gap to Location Entry. - Gap->addObject(/*op=*/dwarf::DW_OP_hi_user, - /*opd1=*/0, /*opd2=*/0); + Gap->addObject(dwarf::DW_OP_hi_user, {}); // Mark the entry as a gap. Gap->setIsGapEntry(); diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp @@ -1212,7 +1212,7 @@ } std::string LVCodeViewReader::getRegisterName(LVSmall Opcode, - uint64_t Operands[2]) { + ArrayRef Operands) { // Get Compilation Unit CPU Type. CPUType CPU = getCompileUnitCPUType(); // For CodeView the register always is in Operands[0]; diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp @@ -1065,7 +1065,7 @@ uint64_t Operand1 = DefRangeFramePointerRelFullScope.Offset; Symbol->addLocation(Attr, 0, 0, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1}); } return Error::success(); @@ -1103,7 +1103,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1}); } return Error::success(); @@ -1142,7 +1142,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, Operand2); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1, Operand2}); } return Error::success(); @@ -1177,7 +1177,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1}); } return Error::success(); @@ -1215,7 +1215,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1}); } return Error::success(); @@ -1258,7 +1258,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1, /*Operand2=*/0}); } return Error::success(); @@ -1299,7 +1299,7 @@ Reader->linearAddress(Range.ISectStart, Range.OffsetStart); Symbol->addLocation(Attr, Address, Address + Range.Range, 0, 0); - Symbol->addLocationOperands(LVSmall(Attr), Operand1, /*Operand2=*/0); + Symbol->addLocationOperands(LVSmall(Attr), {Operand1, /*Operand2=*/0}); } return Error::success(); diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVELFReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVELFReader.cpp --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVELFReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVELFReader.cpp @@ -759,7 +759,8 @@ } } -std::string LVELFReader::getRegisterName(LVSmall Opcode, uint64_t Operands[2]) { +std::string LVELFReader::getRegisterName(LVSmall Opcode, + ArrayRef Operands) { // The 'prettyPrintRegisterOp' function uses the DWARFUnit to support // DW_OP_regval_type. At this point we are operating on a logical view // item, with no access to the underlying DWARF data used by LLVM. @@ -973,19 +974,8 @@ bool CallSiteLocation) { auto ProcessLocationExpression = [&](const DWARFExpression &Expression) { - // DW_OP_const_type is variable-length and has 3 - // operands. DWARFExpression thus far only supports 2. - uint64_t Operands[2] = {0}; - for (const DWARFExpression::Operation &Op : Expression) { - DWARFExpression::Operation::Description Description = Op.getDescription(); - for (unsigned Operand = 0; Operand < 2; ++Operand) { - if (Description.Op[Operand] == DWARFExpression::Operation::SizeNA) - break; - Operands[Operand] = Op.getRawOperand(Operand); - } - CurrentSymbol->addLocationOperands(Op.getCode(), Operands[0], - Operands[1]); - } + for (const DWARFExpression::Operation &Op : Expression) + CurrentSymbol->addLocationOperands(Op.getCode(), Op.getRawOperands()); }; DWARFUnit *U = Die.getDwarfUnit();