[llvm-commits] [llvm] r132206 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Devang Patel
dpatel at apple.com
Fri May 27 12:13:26 PDT 2011
Author: dpatel
Date: Fri May 27 14:13:26 2011
New Revision: 132206
URL: http://llvm.org/viewvc/llvm-project?rev=132206&view=rev
Log:
Keep this simple. Use DIType to get signness and size of a type. Based on size, select appropraite form.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=132206&r1=132205&r2=132206&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri May 27 14:13:26 2011
@@ -445,25 +445,20 @@
assert (MO.isImm() && "Invalid machine operand!");
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
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;
+ }
+
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.
+ if (BTy.Verify() &&
+ (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());
addBlock(Die, dwarf::DW_AT_const_value, 0, Block);
More information about the llvm-commits
mailing list