mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
Keep this simple. Use DIType to get signness and size of a type. Based on size, select appropraite form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132206 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b06b7357a
commit
045c1d4e48
@ -445,14 +445,6 @@ bool CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
|
|||||||
assert (MO.isImm() && "Invalid machine operand!");
|
assert (MO.isImm() && "Invalid machine operand!");
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
unsigned form = dwarf::DW_FORM_udata;
|
unsigned form = dwarf::DW_FORM_udata;
|
||||||
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()) {
|
switch (Ty.getSizeInBits()) {
|
||||||
case 8: form = dwarf::DW_FORM_data1; break;
|
case 8: form = dwarf::DW_FORM_data1; break;
|
||||||
case 16: form = dwarf::DW_FORM_data2; break;
|
case 16: form = dwarf::DW_FORM_data2; break;
|
||||||
@ -460,10 +452,13 @@ bool CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
|
|||||||
case 64: form = dwarf::DW_FORM_data8; break;
|
case 64: form = dwarf::DW_FORM_data8; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
addUInt(Block, 0, form, MO.getImm());
|
|
||||||
}
|
DIBasicType BTy(Ty);
|
||||||
} else
|
if (BTy.Verify() &&
|
||||||
//if this is not basic type then just use _udata.
|
(BTy.getEncoding() == dwarf::DW_ATE_signed
|
||||||
|
|| BTy.getEncoding() == dwarf::DW_ATE_signed_char))
|
||||||
|
addSInt(Block, 0, form, MO.getImm());
|
||||||
|
else
|
||||||
addUInt(Block, 0, form, MO.getImm());
|
addUInt(Block, 0, form, MO.getImm());
|
||||||
|
|
||||||
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user