[llvm] r185460 - [DebugInfo] Allow getDebugThreadLocalSymbol to return MCExpr

Ulrich Weigand ulrich.weigand at de.ibm.com
Tue Jul 2 11:47:09 PDT 2013


Author: uweigand
Date: Tue Jul  2 13:47:09 2013
New Revision: 185460

URL: http://llvm.org/viewvc/llvm-project?rev=185460&view=rev
Log:

[DebugInfo] Allow getDebugThreadLocalSymbol to return MCExpr

This allows getDebugThreadLocalSymbol to return a generic MCExpr
instead of just a MCSymbolRefExpr.

This is in preparation for supporting debug info for TLS variables
on PowerPC, where we need to describe the variable location using
a more complex expression than just MCSymbolRefExpr.


Modified:
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.h

Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=185460&r1=185459&r2=185460&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Jul  2 13:47:09 2013
@@ -140,7 +140,7 @@ public:
 
   /// \brief Create a symbol reference to describe the given TLS variable when
   /// emitting the address in debug info.
-  virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
+  virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
 
 protected:
   virtual const MCSection *

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=185460&r1=185459&r2=185460&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Jul  2 13:47:09 2013
@@ -1358,7 +1358,7 @@ void CompileUnit::createGlobalVariableDI
       unsigned PointerSize = Asm->getDataLayout().getPointerSize();
       assert((PointerSize == 4 || PointerSize == 8) &&
              "Add support for other sizes if necessary");
-      const MCSymbolRefExpr *Ref =
+      const MCExpr *Expr =
           Asm->getObjFileLowering().getDebugThreadLocalSymbol(Sym);
       // Based on GCC's support for TLS:
       if (!DD->useSplitDwarf()) {
@@ -1366,10 +1366,10 @@ void CompileUnit::createGlobalVariableDI
         addUInt(Block, 0, dwarf::DW_FORM_data1,
                 PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);
         // 2) containing the (relocated) address of the TLS variable
-        addExpr(Block, 0, dwarf::DW_FORM_udata, Ref);
+        addExpr(Block, 0, dwarf::DW_FORM_udata, Expr);
       } else {
         addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
-        addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Ref));
+        addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));
       }
       // 3) followed by a custom OP to tell the debugger about TLS (presumably)
       addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_lo_user);

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=185460&r1=185459&r2=185460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul  2 13:47:09 2013
@@ -318,7 +318,7 @@ getTTypeReference(const MCSymbolRefExpr
   }
 }
 
-const MCSymbolRefExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
+const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
   // FIXME: It's not clear what, if any, default this should have - perhaps a
   // null return could mean 'no location' & we should just do that here.
   return MCSymbolRefExpr::Create(Sym, *Ctx);

Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=185460&r1=185459&r2=185460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Tue Jul  2 13:47:09 2013
@@ -48,7 +48,7 @@ X86LinuxTargetObjectFile::Initialize(MCC
   InitializeELF(TM.Options.UseInitArray);
 }
 
-const MCSymbolRefExpr *
+const MCExpr *
 X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
     const MCSymbol *Sym) const {
   return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());

Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=185460&r1=185459&r2=185460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Tue Jul  2 13:47:09 2013
@@ -38,7 +38,7 @@ namespace llvm {
     virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
 
     /// \brief Describe a TLS variable address within debug info.
-    virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
+    virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
   };
 
 } // end namespace llvm





More information about the llvm-commits mailing list