[llvm-commits] [llvm] r100487 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Chris Lattner
clattner at apple.com
Mon Apr 5 16:31:07 PDT 2010
On Apr 5, 2010, at 3:59 PM, Bill Wendling wrote:
> Author: void
> Date: Mon Apr 5 17:59:21 2010
> New Revision: 100487
>
> URL: http://llvm.org/viewvc/llvm-project?rev=100487&view=rev
> Log:
> Output floating point representations in DWARF format. This is done by outputing
> the FP encoding directly as a hex representation.
Did you verify that this works on both big and little endian systems?
-Chris
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=100487&r1=100486&r2=100487&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Apr 5 17:59:21 2010
> @@ -14,6 +14,7 @@
> #define DEBUG_TYPE "dwarfdebug"
> #include "DwarfDebug.h"
> #include "DIE.h"
> +#include "llvm/Constants.h"
> #include "llvm/Module.h"
> #include "llvm/CodeGen/MachineFunction.h"
> #include "llvm/CodeGen/MachineModuleInfo.h"
> @@ -1532,6 +1533,31 @@
> if (MCSymbol *VS = DV->getDbgValueLabel())
> addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
> VS);
> + } else if (DbgValueInsn->getOperand(0).getType() ==
> + MachineOperand::MO_FPImmediate) {
> + DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
> + APFloat FPImm = DbgValueInsn->getOperand(0).getFPImm()->getValueAPF();
> +
> + // Get the raw data form of the floating point.
> + const APInt FltVal = FPImm.bitcastToAPInt();
> + const char *FltPtr = (const char*)FltVal.getRawData();
> +
> + unsigned NumBytes = FltVal.getBitWidth() / 8; // 8 bits per byte.
> + bool LittleEndian = Asm->getTargetData().isLittleEndian();
> + int Incr = (LittleEndian ? 1 : -1);
> + int Start = (LittleEndian ? 0 : NumBytes - 1);
> + int Stop = (LittleEndian ? NumBytes : -1);
> +
> + // Output the constant to DWARF one byte at a time.
> + for (; Start != Stop; Start += Incr)
> + addUInt(Block, 0, dwarf::DW_FORM_data1,
> + (unsigned char)0xFF & FltPtr[Start]);
> +
> + addBlock(VariableDie, dwarf::DW_AT_const_value, 0, Block);
> +
> + if (MCSymbol *VS = DV->getDbgValueLabel())
> + addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
> + VS);
> } else {
> //FIXME : Handle other operand types.
> delete VariableDie;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list