mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
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
This commit is contained in:
parent
2611eeda98
commit
f35c62bf02
@ -554,6 +554,11 @@ namespace llvm {
|
||||
virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
|
||||
bool isVector);
|
||||
|
||||
/// PPC-related methods.
|
||||
/// FIXME: Eventually replace it with some "target MC streamer" and move
|
||||
/// these methods there.
|
||||
virtual void EmitTCEntry(const MCSymbol &S);
|
||||
|
||||
/// FinishImpl - Streamer specific finalization.
|
||||
virtual void FinishImpl() = 0;
|
||||
/// Finish - Finish emission of machine code.
|
||||
|
@ -251,6 +251,7 @@ public:
|
||||
virtual void EmitPad(int64_t Offset);
|
||||
virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList, bool);
|
||||
|
||||
virtual void EmitTCEntry(const MCSymbol &S);
|
||||
|
||||
virtual void EmitInstruction(const MCInst &Inst);
|
||||
|
||||
@ -1299,6 +1300,14 @@ void MCAsmStreamer::EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitTCEntry(const MCSymbol &S) {
|
||||
OS << "\t.tc ";
|
||||
OS << S.getName();
|
||||
OS << "[TC],";
|
||||
OS << S.getName();
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
|
||||
assert(getCurrentSection() && "Cannot emit contents before setting section!");
|
||||
|
||||
|
@ -103,6 +103,8 @@ public:
|
||||
|
||||
virtual void EmitFileDirective(StringRef Filename);
|
||||
|
||||
virtual void EmitTCEntry(const MCSymbol &S);
|
||||
|
||||
virtual void FinishImpl();
|
||||
|
||||
private:
|
||||
@ -469,6 +471,12 @@ void MCELFStreamer::FinishImpl() {
|
||||
this->MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
void MCELFStreamer::EmitTCEntry(const MCSymbol &S)
|
||||
{
|
||||
// Creates a R_PPC64_TOC relocation
|
||||
MCObjectStreamer::EmitSymbolValue(&S, 8, 0);
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
raw_ostream &OS, MCCodeEmitter *CE,
|
||||
bool RelaxAll, bool NoExecStack) {
|
||||
|
@ -561,6 +561,10 @@ void MCStreamer::EmitRegSave(const SmallVectorImpl<unsigned> &RegList, bool) {
|
||||
abort();
|
||||
}
|
||||
|
||||
void MCStreamer::EmitTCEntry(const MCSymbol &S) {
|
||||
llvm_unreachable("Unsupported method");
|
||||
}
|
||||
|
||||
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
||||
/// the specified string in the output .s file. This capability is
|
||||
/// indicated by the hasRawTextSupport() predicate.
|
||||
|
@ -451,8 +451,8 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
|
||||
for (DenseMap<MCSymbol*, MCSymbol*>::iterator I = TOC.begin(),
|
||||
E = TOC.end(); I != E; ++I) {
|
||||
OutStreamer.EmitLabel(I->second);
|
||||
OutStreamer.EmitRawText("\t.tc " + Twine(I->first->getName()) +
|
||||
"[TC]," + I->first->getName());
|
||||
MCSymbol *S = OutContext.GetOrCreateSymbol(I->first->getName());
|
||||
OutStreamer.EmitTCEntry(*S);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user