[llvm] r200065 - Remove an easy use of EmitRawText from PPC.
Rafael Espindola
rafael.espindola at gmail.com
Fri Jan 24 18:35:56 PST 2014
Author: rafael
Date: Fri Jan 24 20:35:56 2014
New Revision: 200065
URL: http://llvm.org/viewvc/llvm-project?rev=200065&view=rev
Log:
Remove an easy use of EmitRawText from PPC.
This makes lib/Target/PowerPC EmitRawText free.
Modified:
llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetStreamer.h
Modified: llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp?rev=200065&r1=200064&r2=200065&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp Fri Jan 24 20:35:56 2014
@@ -9,6 +9,7 @@
#include "MCTargetDesc/PPCMCTargetDesc.h"
#include "MCTargetDesc/PPCMCExpr.h"
+#include "PPCTargetStreamer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
@@ -1436,6 +1437,10 @@ bool PPCAsmParser::ParseDirectiveMachine
Error(L, "unexpected token in directive");
return false;
}
+ PPCTargetStreamer &TStreamer =
+ *static_cast<PPCTargetStreamer *>(
+ getParser().getStreamer().getTargetStreamer());
+ TStreamer.emitMachine(CPU);
return false;
}
Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp?rev=200065&r1=200064&r2=200065&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp Fri Jan 24 20:35:56 2014
@@ -120,6 +120,9 @@ public:
OS << S.getName();
OS << '\n';
}
+ virtual void emitMachine(StringRef CPU) {
+ OS << "\t.machine " << CPU << '\n';
+ }
};
class PPCTargetELFStreamer : public PPCTargetStreamer {
@@ -127,6 +130,10 @@ class PPCTargetELFStreamer : public PPCT
// Creates a R_PPC64_TOC relocation
Streamer->EmitSymbolValue(&S, 8);
}
+ virtual void emitMachine(StringRef CPU) {
+ // FIXME: Is there anything to do in here or does this directive only
+ // limit the parser?
+ }
};
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=200065&r1=200064&r2=200065&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Jan 24 20:35:56 2014
@@ -850,13 +850,12 @@ void PPCDarwinAsmPrinter::EmitStartOfAsm
if (Subtarget.isPPC64() && Directive < PPC::DIR_64)
Directive = PPC::DIR_64;
assert(Directive <= PPC::DIR_64 && "Directive out of range.");
-
- // FIXME: This is a total hack, finish mc'izing the PPC backend.
- if (OutStreamer.hasRawTextSupport()) {
- assert(Directive < array_lengthof(CPUDirectives) &&
- "CPUDirectives[] might not be up-to-date!");
- OutStreamer.EmitRawText("\t.machine " + Twine(CPUDirectives[Directive]));
- }
+
+ assert(Directive < array_lengthof(CPUDirectives) &&
+ "CPUDirectives[] might not be up-to-date!");
+ PPCTargetStreamer &TStreamer =
+ *static_cast<PPCTargetStreamer *>(OutStreamer.getTargetStreamer());
+ TStreamer.emitMachine(CPUDirectives[Directive]);
// Prime text sections so they are adjacent. This reduces the likelihood a
// large data or debug section causes a branch to exceed 16M limit.
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetStreamer.h?rev=200065&r1=200064&r2=200065&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetStreamer.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetStreamer.h Fri Jan 24 20:35:56 2014
@@ -17,6 +17,7 @@ class PPCTargetStreamer : public MCTarge
public:
virtual ~PPCTargetStreamer();
virtual void emitTCEntry(const MCSymbol &S) = 0;
+ virtual void emitMachine(StringRef CPU) = 0;
};
}
More information about the llvm-commits
mailing list