On 10/20/2015 03:27 PM, Richard Henderson wrote:
---
  gcc/config/i386/i386.c | 21 +++++++++++++++++++++
  gcc/doc/tm.texi        |  7 +++++++
  gcc/doc/tm.texi.in     |  2 ++
  gcc/dwarf2out.c        | 48 +++++++++++++++++++++++++++++-------------------
  gcc/target.def         | 10 ++++++++++
  gcc/targhooks.c        |  8 ++++++++
  gcc/targhooks.h        |  1 +
  7 files changed, 78 insertions(+), 19 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8f833d1..9fb0fac 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -53707,6 +53707,27 @@ ix86_addr_space_convert (rtx op, tree from_type, tree 
to_type)
  #undef TARGET_ADDR_SPACE_CONVERT
  #define TARGET_ADDR_SPACE_CONVERT ix86_addr_space_convert

+static int
+ix86_addr_space_debug (addr_space_t as)
+{
+  /* Represent debugging for address spaces with DW_AT_segment,
+     and the dwarf register for fsbase/gsbase.  */
+  if (as == ADDR_SPACE_SEG_TLS)
+    as = DEFAULT_TLS_SEG_REG;
+
+  /* ??? These register numbers are defined in the x86-64 abi,
+     but there is no corresponding definition for the i386 abi.
+     That said, {58,59} appear to be reserved, so perhaps best
+     to use the same numbers in the 32-bit abi.  */
+  if (as == ADDR_SPACE_SEG_FS)
+    return ~58;  /* dwarf fsbase */
+  else if (as == ADDR_SPACE_SEG_GS)
+    return ~59;  /* dwarf gsbase */
+  gcc_unreachable ();
+}
So in the case where AS, as passed in is ADDR_SPACE_SEG_TLS, we then change it to DEFAULT_TLS_SEG_REG.

Yet I don't see DEFAULT_TLS_SEG_REG handled in the two cases below which would make one think we'd hit the gcc_unreachable (). Of course DEFAULT_TLS_SEG_REG will be defined as ADDR_SPACE_SEG_FS or ADDR_SPACE_SEG_GS, so we can't actually hit the gcc_unreachable, but as-written that's non-obvious.

If you could clarify that with a comment I think this hunk is ready to go.
jeff

Reply via email to