llvm.org GIT mirror llvm / f35c62b
PowerPC: add EmitTCEntry class for TOC creation This patch replaces the EmitRawText by a EmitTCEntry class (specialized for each Streamer) in PowerPC64 TOC entry creation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165940 91177308-0d34-0410-b5e6-96231b3b80d8 Adhemerval Zanella 8 years ago
5 changed file(s) with 28 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
553553 virtual void EmitRegSave(const SmallVectorImpl &RegList,
554554 bool isVector);
555555
556 /// PPC-related methods.
557 /// FIXME: Eventually replace it with some "target MC streamer" and move
558 /// these methods there.
559 virtual void EmitTCEntry(const MCSymbol &S);
560
556561 /// FinishImpl - Streamer specific finalization.
557562 virtual void FinishImpl() = 0;
558563 /// Finish - Finish emission of machine code.
250250 virtual void EmitPad(int64_t Offset);
251251 virtual void EmitRegSave(const SmallVectorImpl &RegList, bool);
252252
253 virtual void EmitTCEntry(const MCSymbol &S);
253254
254255 virtual void EmitInstruction(const MCInst &Inst);
255256
12981299 EmitEOL();
12991300 }
13001301
1302 void MCAsmStreamer::EmitTCEntry(const MCSymbol &S) {
1303 OS << "\t.tc ";
1304 OS << S.getName();
1305 OS << "[TC],";
1306 OS << S.getName();
1307 EmitEOL();
1308 }
1309
13011310 void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
13021311 assert(getCurrentSection() && "Cannot emit contents before setting section!");
13031312
101101 unsigned AddrSpace);
102102
103103 virtual void EmitFileDirective(StringRef Filename);
104
105 virtual void EmitTCEntry(const MCSymbol &S);
104106
105107 virtual void FinishImpl();
106108
468470 this->MCObjectStreamer::FinishImpl();
469471 }
470472
473 void MCELFStreamer::EmitTCEntry(const MCSymbol &S)
474 {
475 // Creates a R_PPC64_TOC relocation
476 MCObjectStreamer::EmitSymbolValue(&S, 8, 0);
477 }
478
471479 MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
472480 raw_ostream &OS, MCCodeEmitter *CE,
473481 bool RelaxAll, bool NoExecStack) {
560560 abort();
561561 }
562562
563 void MCStreamer::EmitTCEntry(const MCSymbol &S) {
564 llvm_unreachable("Unsupported method");
565 }
566
563567 /// EmitRawText - If this file is backed by an assembly streamer, this dumps
564568 /// the specified string in the output .s file. This capability is
565569 /// indicated by the hasRawTextSupport() predicate.
450450 for (DenseMap::iterator I = TOC.begin(),
451451 E = TOC.end(); I != E; ++I) {
452452 OutStreamer.EmitLabel(I->second);
453 OutStreamer.EmitRawText("\t.tc " + Twine(I->first->getName()) +
454 "[TC]," + I->first->getName());
453 MCSymbol *S = OutContext.GetOrCreateSymbol(I->first->getName());
454 OutStreamer.EmitTCEntry(*S);
455455 }
456456 }
457457