mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-04 18:58:44 +00:00
Handle signed types gracefully.
This fixes regressions reported by buildbots as a fallout of r132193. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
45c4c4f257
commit
72f0d9cdef
@ -444,16 +444,28 @@ bool CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
|
||||
DIType Ty) {
|
||||
assert (MO.isImm() && "Invalid machine operand!");
|
||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||
unsigned Imm = MO.getImm();
|
||||
unsigned form = dwarf::DW_FORM_udata;
|
||||
switch (Ty.getSizeInBits()) {
|
||||
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: break;
|
||||
}
|
||||
addUInt(Block, 0, form, Imm);
|
||||
DIBasicType BTy(Ty);
|
||||
if (BTy.Verify()) {
|
||||
unsigned Encoding = BTy.getEncoding();
|
||||
if (Encoding == dwarf::DW_ATE_signed ||
|
||||
Encoding == dwarf::DW_ATE_signed_char) {
|
||||
form = dwarf::DW_FORM_sdata;
|
||||
addSInt(Block, 0, dwarf::DW_FORM_sdata, MO.getImm());
|
||||
} else {
|
||||
switch (Ty.getSizeInBits()) {
|
||||
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: break;
|
||||
}
|
||||
addUInt(Block, 0, form, MO.getImm());
|
||||
}
|
||||
} else
|
||||
//if this is not basic type then just use _udata.
|
||||
addUInt(Block, 0, form, MO.getImm());
|
||||
|
||||
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user