llvm.org GIT mirror llvm / 716a94f
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185460 91177308-0d34-0410-b5e6-96231b3b80d8 Ulrich Weigand 7 years ago
5 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
139139
140140 /// \brief Create a symbol reference to describe the given TLS variable when
141141 /// emitting the address in debug info.
142 virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
142 virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
143143
144144 protected:
145145 virtual const MCSection *
13571357 unsigned PointerSize = Asm->getDataLayout().getPointerSize();
13581358 assert((PointerSize == 4 || PointerSize == 8) &&
13591359 "Add support for other sizes if necessary");
1360 const MCSymbolRefExpr *Ref =
1360 const MCExpr *Expr =
13611361 Asm->getObjFileLowering().getDebugThreadLocalSymbol(Sym);
13621362 // Based on GCC's support for TLS:
13631363 if (!DD->useSplitDwarf()) {
13651365 addUInt(Block, 0, dwarf::DW_FORM_data1,
13661366 PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);
13671367 // 2) containing the (relocated) address of the TLS variable
1368 addExpr(Block, 0, dwarf::DW_FORM_udata, Ref);
1368 addExpr(Block, 0, dwarf::DW_FORM_udata, Expr);
13691369 } else {
13701370 addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
1371 addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Ref));
1371 addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));
13721372 }
13731373 // 3) followed by a custom OP to tell the debugger about TLS (presumably)
13741374 addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_lo_user);
317317 }
318318 }
319319
320 const MCSymbolRefExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
320 const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
321321 // FIXME: It's not clear what, if any, default this should have - perhaps a
322322 // null return could mean 'no location' & we should just do that here.
323323 return MCSymbolRefExpr::Create(Sym, *Ctx);
4747 InitializeELF(TM.Options.UseInitArray);
4848 }
4949
50 const MCSymbolRefExpr *
50 const MCExpr *
5151 X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
5252 const MCSymbol *Sym) const {
5353 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
3737 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
3838
3939 /// \brief Describe a TLS variable address within debug info.
40 virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
40 virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
4141 };
4242
4343 } // end namespace llvm