mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Handle qualified constants that are directly folded by FE.
PR 7920. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111820 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1861,6 +1861,21 @@ CompileUnit *DwarfDebug::getCompileUnit(const MDNode *N) const {
|
||||
return I->second;
|
||||
}
|
||||
|
||||
/// isUnsignedDIType - Return true if type encoding is unsigned.
|
||||
static bool isUnsignedDIType(DIType Ty) {
|
||||
DIDerivedType DTy(Ty);
|
||||
if (DTy.Verify())
|
||||
return isUnsignedDIType(DTy.getTypeDerivedFrom());
|
||||
|
||||
DIBasicType BTy(Ty);
|
||||
if (BTy.Verify()) {
|
||||
unsigned Encoding = BTy.getEncoding();
|
||||
if (Encoding == dwarf::DW_ATE_unsigned ||
|
||||
Encoding == dwarf::DW_ATE_unsigned_char)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// constructGlobalVariableDIE - Construct global variable DIE.
|
||||
void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) {
|
||||
@ -1930,17 +1945,12 @@ void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) {
|
||||
}
|
||||
} else if (Constant *C = GV.getConstant()) {
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
|
||||
DIBasicType BTy(GTy);
|
||||
if (BTy.Verify()) {
|
||||
unsigned Encoding = BTy.getEncoding();
|
||||
if (Encoding == dwarf::DW_ATE_unsigned ||
|
||||
Encoding == dwarf::DW_ATE_unsigned_char)
|
||||
if (isUnsignedDIType(GTy))
|
||||
addUInt(VariableDIE, dwarf::DW_AT_const_value, dwarf::DW_FORM_udata,
|
||||
CI->getZExtValue());
|
||||
else
|
||||
addSInt(VariableDIE, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata,
|
||||
CI->getSExtValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
Reference in New Issue
Block a user