[llvm-branch-commits] [llvm-branch] r352140 - Merging r352034:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 24 16:18:40 PST 2019


Author: hans
Date: Thu Jan 24 16:18:40 2019
New Revision: 352140

URL: http://llvm.org/viewvc/llvm-project?rev=352140&view=rev
Log:
Merging r352034:
------------------------------------------------------------------------
r352034 | atanasyan | 2019-01-24 10:13:14 +0100 (Thu, 24 Jan 2019) | 18 lines

Reapply: [mips] Handle MipsMCExpr sub-expression for the MEK_DTPREL tag

This reapplies commit r351987 with a failed test fix. Now the test
accepts both DW_OP_GNU_push_tls_address and DW_OP_form_tls_address
opcode.

Original commit message:
```
  This is a fix for a regression introduced by the rL348194 commit. In
  that change new type (MEK_DTPREL) of MipsMCExpr expression was added,
  but in some places of the code this type of expression considered as
  unexpected.

  This change fixes the bug. The MEK_DTPREL type of expression is used for
  marking TLS DIEExpr only and contains a regular sub-expression. Where we
  need to handle the expression, we retrieve the sub-expression and
  handle it in a common way.
```
------------------------------------------------------------------------

Modified:
    llvm/branches/release_80/   (props changed)
    llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
    llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
    llvm/branches/release_80/test/DebugInfo/Mips/dwarfdump-tls.ll

Propchange: llvm/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 24 16:18:40 2019
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,351325,351344-351345,351349,351351,351370,351381,351421,351426,351436,351475,351485,351753-351754,351930,351932
+/llvm/trunk:155241,351325,351344-351345,351349,351351,351370,351381,351421,351426,351436,351475,351485,351753-351754,351930,351932,352034

Modified: llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp?rev=352140&r1=352139&r2=352140&view=diff
==============================================================================
--- llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp (original)
+++ llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Thu Jan 24 16:18:40 2019
@@ -614,8 +614,9 @@ getExprOpValue(const MCExpr *Expr, Small
       llvm_unreachable("Unhandled fixup kind!");
       break;
     case MipsMCExpr::MEK_DTPREL:
-      llvm_unreachable("MEK_DTPREL is used for TLS DIEExpr only");
-      break;
+      // MEK_DTPREL is used for marking TLS DIEExpr only
+      // and contains a regular sub-expression.
+      return getExprOpValue(MipsExpr->getSubExpr(), Fixups, STI);
     case MipsMCExpr::MEK_CALL_HI16:
       FixupKind = Mips::fixup_Mips_CALL_HI16;
       break;

Modified: llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp?rev=352140&r1=352139&r2=352140&view=diff
==============================================================================
--- llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp (original)
+++ llvm/branches/release_80/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp Thu Jan 24 16:18:40 2019
@@ -44,8 +44,10 @@ void MipsMCExpr::printImpl(raw_ostream &
     llvm_unreachable("MEK_None and MEK_Special are invalid");
     break;
   case MEK_DTPREL:
-    llvm_unreachable("MEK_DTPREL is used for TLS DIEExpr only");
-    break;
+    // MEK_DTPREL is used for marking TLS DIEExpr only
+    // and contains a regular sub-expression.
+    getSubExpr()->print(OS, MAI, true);
+    return;
   case MEK_CALL_HI16:
     OS << "%call_hi";
     break;
@@ -161,7 +163,9 @@ MipsMCExpr::evaluateAsRelocatableImpl(MC
     case MEK_Special:
       llvm_unreachable("MEK_None and MEK_Special are invalid");
     case MEK_DTPREL:
-      llvm_unreachable("MEK_DTPREL is used for TLS DIEExpr only");
+      // MEK_DTPREL is used for marking TLS DIEExpr only
+      // and contains a regular sub-expression.
+      return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
     case MEK_DTPREL_HI:
     case MEK_DTPREL_LO:
     case MEK_GOT:
@@ -249,9 +253,6 @@ void MipsMCExpr::fixELFSymbolsInTLSFixup
   case MEK_Special:
     llvm_unreachable("MEK_None and MEK_Special are invalid");
     break;
-  case MEK_DTPREL:
-    llvm_unreachable("MEK_DTPREL is used for TLS DIEExpr only");
-    break;
   case MEK_CALL_HI16:
   case MEK_CALL_LO16:
   case MEK_GOT:
@@ -274,6 +275,7 @@ void MipsMCExpr::fixELFSymbolsInTLSFixup
     if (const MipsMCExpr *E = dyn_cast<const MipsMCExpr>(getSubExpr()))
       E->fixELFSymbolsInTLSFixups(Asm);
     break;
+  case MEK_DTPREL:
   case MEK_DTPREL_HI:
   case MEK_DTPREL_LO:
   case MEK_TLSLDM:

Modified: llvm/branches/release_80/test/DebugInfo/Mips/dwarfdump-tls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/test/DebugInfo/Mips/dwarfdump-tls.ll?rev=352140&r1=352139&r2=352140&view=diff
==============================================================================
--- llvm/branches/release_80/test/DebugInfo/Mips/dwarfdump-tls.ll (original)
+++ llvm/branches/release_80/test/DebugInfo/Mips/dwarfdump-tls.ll Thu Jan 24 16:18:40 2019
@@ -1,12 +1,34 @@
-; RUN: llc -O0 -march=mips -mcpu=mips32r2 -filetype=obj -o=%t-32.o < %s
+; RUN: llc -O0 -march=mips -mcpu=mips32r2 -filetype=obj \
+; RUN:     -split-dwarf-file=foo.dwo -o=%t-32.o < %s
 ; RUN: llvm-dwarfdump %t-32.o 2>&1 | FileCheck %s
-; RUN: llc -O0 -march=mips64 -mcpu=mips64r2 -filetype=obj -o=%t-64.o < %s
+; RUN: llc -O0 -march=mips64 -mcpu=mips64r2 -filetype=obj \
+; RUN:     -split-dwarf-file=foo.dwo -o=%t-64.o < %s
 ; RUN: llvm-dwarfdump %t-64.o 2>&1 | FileCheck %s
 
+; RUN: llc -O0 -march=mips -mcpu=mips32r2 -filetype=asm \
+; RUN:     -split-dwarf-file=foo.dwo < %s | FileCheck -check-prefix=ASM32 %s
+; RUN: llc -O0 -march=mips64 -mcpu=mips64r2 -filetype=asm \
+; RUN:     -split-dwarf-file=foo.dwo < %s | FileCheck -check-prefix=ASM64 %s
+
 @x = thread_local global i32 5, align 4, !dbg !0
 
 ; CHECK-NOT: error: failed to compute relocation: R_MIPS_TLS_DTPREL
 
+; CHECK:      DW_AT_name      ("x")
+; CHECK-NEXT: DW_AT_type      (0x00000025 "int")
+; CHECK-NEXT: DW_AT_external  (true)
+; CHECK-NEXT: DW_AT_decl_file (0x01)
+; CHECK-NEXT: DW_AT_decl_line (1)
+; CHECK-NEXT: DW_AT_location  (DW_OP_GNU_const_index 0x0, {{DW_OP_GNU_push_tls_address|DW_OP_form_tls_address}})
+
+; ASM32:              .section        .debug_addr
+; ASM32-NEXT: $addr_table_base0:
+; ASM32-NEXT:         .4byte  x+32768
+
+; ASM64:              .section        .debug_addr
+; ASM64-NEXT: .Laddr_table_base0:
+; ASM64-NEXT:         .8byte  x+32768
+
 !llvm.dbg.cu = !{!2}
 !llvm.module.flags = !{!7, !8}
 




More information about the llvm-branch-commits mailing list