[llvm] r208496 - DwarfUnit: Factor out calling isUnsignedDIType into a utility function so each caller of emitConstantValue doesn't have to call it separately.
David Blaikie
dblaikie at gmail.com
Sun May 11 08:56:59 PDT 2014
Author: dblaikie
Date: Sun May 11 10:56:59 2014
New Revision: 208496
URL: http://llvm.org/viewvc/llvm-project?rev=208496&view=rev
Log:
DwarfUnit: Factor out calling isUnsignedDIType into a utility function so each caller of emitConstantValue doesn't have to call it separately.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=208496&r1=208495&r2=208496&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sun May 11 10:56:59 2014
@@ -832,9 +832,8 @@ void DwarfUnit::addConstantFPValue(DIE &
}
/// addConstantValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI,
- bool Unsigned) {
- addConstantValue(Die, CI->getValue(), Unsigned);
+void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI, DIType Ty) {
+ addConstantValue(Die, CI->getValue(), Ty);
}
/// addConstantValue - Add constant value entry in variable DIE.
@@ -852,6 +851,10 @@ void DwarfUnit::addConstantValue(DIE &Di
Signed ? dwarf::DW_FORM_sdata : dwarf::DW_FORM_udata, Val);
}
+void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, DIType Ty) {
+ addConstantValue(Die, Val, isUnsignedDIType(DD, Ty));
+}
+
// addConstantValue - Add constant value entry in variable DIE.
void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) {
unsigned CIBitWidth = Val.getBitWidth();
@@ -1310,8 +1313,7 @@ DwarfUnit::constructTemplateValueParamet
addString(ParamDIE, dwarf::DW_AT_name, VP.getName());
if (Value *Val = VP.getValue()) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(Val))
- addConstantValue(ParamDIE, CI,
- isUnsignedDIType(DD, resolve(VP.getType())));
+ addConstantValue(ParamDIE, CI, resolve(VP.getType()));
else if (GlobalValue *GV = dyn_cast<GlobalValue>(Val)) {
// For declaration non-type template parameters (such as global values and
// functions)
@@ -1617,7 +1619,7 @@ void DwarfCompileUnit::createGlobalVaria
// emitting AT_const_value multiple times, we only add AT_const_value when
// it is not a static member.
if (!IsStaticMember)
- addConstantValue(*VariableDIE, CI, isUnsignedDIType(DD, GTy));
+ addConstantValue(*VariableDIE, CI, GTy);
} else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getOperand(11))) {
addToAccelTable = true;
// GV is a merged global.
@@ -1804,7 +1806,7 @@ DwarfUnit::constructVariableDIEImpl(cons
addConstantFPValue(*VariableDie, DVInsn->getOperand(0));
else if (DVInsn->getOperand(0).isCImm())
addConstantValue(*VariableDie, DVInsn->getOperand(0).getCImm(),
- isUnsignedDIType(DD, DV.getType()));
+ DV.getType());
return VariableDie;
}
@@ -1948,7 +1950,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberD
dwarf::DW_ACCESS_public);
if (const ConstantInt *CI = dyn_cast_or_null<ConstantInt>(DT.getConstant()))
- addConstantValue(StaticMemberDIE, CI, isUnsignedDIType(DD, Ty));
+ addConstantValue(StaticMemberDIE, CI, Ty);
if (const ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(DT.getConstant()))
addConstantFPValue(StaticMemberDIE, CFP);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=208496&r1=208495&r2=208496&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Sun May 11 10:56:59 2014
@@ -348,7 +348,8 @@ public:
/// addConstantValue - Add constant value entry in variable DIE.
void addConstantValue(DIE &Die, const MachineOperand &MO, DIType Ty);
- void addConstantValue(DIE &Die, const ConstantInt *CI, bool Unsigned);
+ void addConstantValue(DIE &Die, const ConstantInt *CI, DIType Ty);
+ void addConstantValue(DIE &Die, const APInt &Val, DIType Ty);
void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
void addConstantValue(DIE &Die, bool Signed, uint64_t Val);
More information about the llvm-commits
mailing list