[PATCH] D41968: [libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs.

John Baldwin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 14:43:19 PST 2018


bsdjhb added a comment.

Hmmm, so I was somewhat mistaken as DwarfInstructions.hpp::stepWithDwarf() does use the Register class's setFloatRegister(), however, it assumes that the floating point register is always a double (DwarfInstructions.hpp::getSavedFloatRegister() uses AddressSpace::getDouble() to read a double from memory).  So I think that means that the NEWABI cases work as-is.  O32 with 64-bit FP registers should also work as-is.  However, O32 with 32-bit FP registers will not quite work.  The DWARF info for O32 with 32-bit registers does save/restore individual 32-bit registers:

  000006dc 00000034 000006e0 FDE cie=00000000 pc=0000d384..0000d46c
    DW_CFA_advance_loc4: 16 to 0000d394
    DW_CFA_def_cfa_offset: 56
    DW_CFA_advance_loc4: 20 to 0000d3a8
    DW_CFA_offset: r31 at cfa-12
    DW_CFA_offset: r17 at cfa-16
    DW_CFA_offset: r16 at cfa-20
    DW_CFA_offset: r52 at cfa-4
    DW_CFA_offset: r53 at cfa-8
  ...

If the compiler happens to always save and restore them in pairs then the current approach will work.  If we don't want to assume that they are saved and restored in pairs, then we could instead perhaps claim that 32-bit FP registers aren't really floating point but are just plain 32-bit registers.  This would make unwinding work (I believe), but would mean that one would need to use unw_get_reg() instead of unw_get_fpreg() to fetch individual 32-bit FP registers.


https://reviews.llvm.org/D41968





More information about the cfe-commits mailing list