mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-21 04:41:34 +00:00
Select DW_AT_const_value size based on global variable size.
llvm-svn: 132239
This commit is contained in:
parent
707fa44bc0
commit
93e78e996f
@ -493,13 +493,21 @@ bool CompileUnit::addConstantFPValue(DIE *Die, const MachineOperand &MO) {
|
|||||||
/// addConstantValue - Add constant value entry in variable DIE.
|
/// addConstantValue - Add constant value entry in variable DIE.
|
||||||
bool CompileUnit::addConstantValue(DIE *Die, ConstantInt *CI,
|
bool CompileUnit::addConstantValue(DIE *Die, ConstantInt *CI,
|
||||||
bool Unsigned) {
|
bool Unsigned) {
|
||||||
if (CI->getBitWidth() <= 64) {
|
unsigned CIBitWidth = CI->getBitWidth();
|
||||||
|
if (CIBitWidth <= 64) {
|
||||||
|
unsigned form = 0;
|
||||||
|
switch (CIBitWidth) {
|
||||||
|
case 8: form = dwarf::DW_FORM_data1; break;
|
||||||
|
case 16: form = dwarf::DW_FORM_data2; break;
|
||||||
|
case 32: form = dwarf::DW_FORM_data4; break;
|
||||||
|
case 64: form = dwarf::DW_FORM_data8; break;
|
||||||
|
default:
|
||||||
|
form = Unsigned ? dwarf::DW_FORM_udata : dwarf::DW_FORM_sdata;
|
||||||
|
}
|
||||||
if (Unsigned)
|
if (Unsigned)
|
||||||
addUInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_udata,
|
addUInt(Die, dwarf::DW_AT_const_value, form, CI->getZExtValue());
|
||||||
CI->getZExtValue());
|
|
||||||
else
|
else
|
||||||
addSInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata,
|
addSInt(Die, dwarf::DW_AT_const_value, form, CI->getSExtValue());
|
||||||
CI->getSExtValue());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user