[llvm-commits] [llvm] r132239 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Devang Patel
dpatel at apple.com
Fri May 27 17:39:18 PDT 2011
Author: dpatel
Date: Fri May 27 19:39:18 2011
New Revision: 132239
URL: http://llvm.org/viewvc/llvm-project?rev=132239&view=rev
Log:
Select DW_AT_const_value size based on global variable size.
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=132239&r1=132238&r2=132239&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri May 27 19:39:18 2011
@@ -493,13 +493,21 @@
/// addConstantValue - Add constant value entry in variable DIE.
bool CompileUnit::addConstantValue(DIE *Die, ConstantInt *CI,
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)
- addUInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_udata,
- CI->getZExtValue());
+ addUInt(Die, dwarf::DW_AT_const_value, form, CI->getZExtValue());
else
- addSInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata,
- CI->getSExtValue());
+ addSInt(Die, dwarf::DW_AT_const_value, form, CI->getSExtValue());
return true;
}
More information about the llvm-commits
mailing list