[llvm] r261167 - DbgVariable: Add an accessor for the common case of a single expression
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 14:20:00 PST 2016
Author: adrian
Date: Wed Feb 17 16:19:59 2016
New Revision: 261167
URL: http://llvm.org/viewvc/llvm-project?rev=261167&view=rev
Log:
DbgVariable: Add an accessor for the common case of a single expression
belonging to a single DBG_VALUE instruction.
NFC
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=261167&r1=261166&r2=261167&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Feb 17 16:19:59 2016
@@ -771,8 +771,7 @@ void DwarfCompileUnit::addComplexAddress
const MachineLocation &Location) {
DIELoc *Loc = new (DIEValueAllocator) DIELoc;
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
- assert(DV.getExpression().size() == 1);
- const DIExpression *Expr = DV.getExpression().back();
+ const DIExpression *Expr = DV.getSingleExpression();
bool ValidReg;
if (Location.getOffset()) {
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=261167&r1=261166&r2=261167&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 17 16:19:59 2016
@@ -111,6 +111,10 @@ public:
const DILocalVariable *getVariable() const { return Var; }
const DILocation *getInlinedAt() const { return IA; }
ArrayRef<const DIExpression *> getExpression() const { return Expr; }
+ const DIExpression *getSingleExpression() const {
+ assert(MInsn && Expr.size() <= 1);
+ return Expr.size() ? Expr[0] : nullptr;
+ }
void setDIE(DIE &D) { TheDIE = &D; }
DIE *getDIE() const { return TheDIE; }
void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
More information about the llvm-commits
mailing list