llvm.org GIT mirror llvm / 3192d14
rename getSymbolForDwarf* to getExprForDwarf* since it returns an MCExpr and not an MCSymbol. Change it to take an MCStreamer, which is currently unused. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98278 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
7 changed file(s) with 51 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
7777 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
7878 Mangler *Mang, const TargetMachine &TM) const;
7979
80 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
80 /// getExprForDwarfGlobalReference - Return an MCExpr to use for a reference
8181 /// to the specified global variable from exception handling information.
8282 ///
8383 virtual const MCExpr *
84 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
85 MachineModuleInfo *MMI, unsigned Encoding) const;
84 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
85 MachineModuleInfo *MMI, unsigned Encoding,
86 MCStreamer &Streamer) const;
8687 };
8788
8889
165166 return NonLazySymbolPointerSection;
166167 }
167168
168 /// getSymbolForDwarfGlobalReference - The mach-o version of this method
169 /// getExprForDwarfGlobalReference - The mach-o version of this method
169170 /// defaults to returning a stub reference.
170171 virtual const MCExpr *
171 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
172 MachineModuleInfo *MMI, unsigned Encoding) const;
172 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
173 MachineModuleInfo *MMI, unsigned Encoding,
174 MCStreamer &Streamer) const;
173175
174176 virtual unsigned getPersonalityEncoding() const;
175177 virtual unsigned getLSDAEncoding() const;
2121 class MachineModuleInfo;
2222 class Mangler;
2323 class MCAsmInfo;
24 class MCContext;
2425 class MCExpr;
2526 class MCSection;
2627 class MCSectionMachO;
2728 class MCSymbol;
28 class MCContext;
29 class MCStreamer;
2930 class GlobalValue;
3031 class TargetMachine;
3132
196197 return 0;
197198 }
198199
199 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
200 /// getExprForDwarfGlobalReference - Return an MCExpr to use for a reference
200201 /// to the specified global variable from exception handling information.
201202 ///
202203 virtual const MCExpr *
203 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
204 MachineModuleInfo *MMI, unsigned Encoding) const;
205
206 virtual const MCExpr *
207 getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
208 unsigned Encoding) const;
209
204 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
205 MachineModuleInfo *MMI, unsigned Encoding,
206 MCStreamer &Streamer) const;
207
208 ///
209 const MCExpr *
210 getExprForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
211 unsigned Encoding,
212 MCStreamer &Streamer) const;
213
210214 virtual unsigned getPersonalityEncoding() const;
211215 virtual unsigned getLSDAEncoding() const;
212216 virtual unsigned getFDEEncoding() const;
188188 void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
189189 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
190190
191 const MCExpr *Exp = TLOF.getSymbolForDwarfReference(Sym, Asm->MMI, Encoding);
191 const MCExpr *Exp = TLOF.getExprForDwarfReference(Sym, Asm->MMI, Encoding,
192 Asm->OutStreamer);
192193 Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0);
193194 }
194195
196197 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
197198
198199 const MCExpr *Exp =
199 TLOF.getSymbolForDwarfGlobalReference(GV, Asm->Mang, Asm->MMI, Encoding);
200 TLOF.getExprForDwarfGlobalReference(GV, Asm->Mang, Asm->MMI, Encoding,
201 Asm->OutStreamer);
200202 Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0);
201203 }
202204
390390 }
391391
392392 const MCExpr *TargetLoweringObjectFileELF::
393 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
394 MachineModuleInfo *MMI, unsigned Encoding) const {
393 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
394 MachineModuleInfo *MMI,
395 unsigned Encoding, MCStreamer &Streamer) const {
395396
396397 if (Encoding & dwarf::DW_EH_PE_indirect) {
397398 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo();
419420 }
420421
421422 return TargetLoweringObjectFile::
422 getSymbolForDwarfReference(Sym, MMI,
423 Encoding & ~dwarf::DW_EH_PE_indirect);
423 getExprForDwarfReference(Sym, MMI,
424 Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
424425 }
425426
426427 return TargetLoweringObjectFile::
427 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
428 getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
428429 }
429430
430431 //===----------------------------------------------------------------------===//
750751 }
751752
752753 const MCExpr *TargetLoweringObjectFileMachO::
753 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
754 MachineModuleInfo *MMI, unsigned Encoding) const {
754 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
755 MachineModuleInfo *MMI, unsigned Encoding,
756 MCStreamer &Streamer) const {
755757 // The mach-o version of this method defaults to returning a stub reference.
756758
757759 if (Encoding & DW_EH_PE_indirect) {
781783 }
782784
783785 return TargetLoweringObjectFile::
784 getSymbolForDwarfReference(Sym, MMI,
785 Encoding & ~dwarf::DW_EH_PE_indirect);
786 getExprForDwarfReference(Sym, MMI, Encoding & ~dwarf::DW_EH_PE_indirect,
787 Streamer);
786788 }
787789
788790 return TargetLoweringObjectFile::
789 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
791 getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
790792 }
791793
792794 unsigned TargetLoweringObjectFileMachO::getPersonalityEncoding() const {
289289 return DataSection;
290290 }
291291
292 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a
292 /// getExprForDwarfGlobalReference - Return an MCExpr to use for a
293293 /// reference to the specified global variable from exception
294294 /// handling information.
295295 const MCExpr *TargetLoweringObjectFile::
296 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
297 MachineModuleInfo *MMI, unsigned Encoding) const {
296 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
297 MachineModuleInfo *MMI, unsigned Encoding,
298 MCStreamer &Streamer) const {
298299 // FIXME: Use GetGlobalValueSymbol.
299300 SmallString<128> Name;
300301 Mang->getNameWithPrefix(Name, GV, false);
305306 else
306307 Sym = getContext().GetOrCreateSymbol(Name.str());
307308
308 return getSymbolForDwarfReference(Sym, MMI, Encoding);
309 return getExprForDwarfReference(Sym, MMI, Encoding, Streamer);
309310 }
310311
311312 const MCExpr *TargetLoweringObjectFile::
312 getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
313 unsigned Encoding) const {
313 getExprForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
314 unsigned Encoding, MCStreamer &Streamer) const {
314315 const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
315316
316317 switch (Encoding & 0xF0) {
1818 using namespace dwarf;
1919
2020 const MCExpr *X8664_MachoTargetObjectFile::
21 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
22 MachineModuleInfo *MMI,
23 unsigned Encoding) const {
21 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
22 MachineModuleInfo *MMI, unsigned Encoding,
23 MCStreamer &Streamer) const {
2424
2525 // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
2626 // is an indirect pc-relative reference.
3939 }
4040
4141 return TargetLoweringObjectFileMachO::
42 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
42 getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
4343 }
4444
4545 unsigned X8632_ELFTargetObjectFile::getPersonalityEncoding() const {
2222 public:
2323
2424 virtual const MCExpr *
25 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
26 MachineModuleInfo *MMI, unsigned Encoding) const;
25 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
26 MachineModuleInfo *MMI, unsigned Encoding,
27 MCStreamer &Streamer) const;
2728 };
2829
2930 class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {