Convert some easy uses of EmitRawText to TargetStreamer methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-01-26 05:06:48 +00:00
parent baa58b6692
commit 7c44f63f89
3 changed files with 97 additions and 12 deletions

View File

@ -55,6 +55,34 @@ void MipsTargetAsmStreamer::emitDirectiveSetNoMips16() {
OS << "\t.set\tnomips16\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetReorder() {
OS << "\t.set\treorder\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetNoReorder() {
OS << "\t.set\tnoreorder\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetMacro() {
OS << "\t.set\tmacro\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetNoMacro() {
OS << "\t.set\tnomacro\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetAt() {
OS << "\t.set\tat\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetNoAt() {
OS << "\t.set\tnoat\n";
}
void MipsTargetAsmStreamer::emitDirectiveEnd(StringRef Name) {
OS << "\t.end\t" << Name << '\n';
}
void MipsTargetAsmStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {
OS << "\t.ent\t" << Symbol.getName() << '\n';
}
@ -109,6 +137,34 @@ void MipsTargetELFStreamer::emitDirectiveSetNoMips16() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetReorder() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetNoReorder() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetMacro() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetNoMacro() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetAt() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetNoAt() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {
// FIXME: implement.
}

View File

@ -284,6 +284,8 @@ void MipsAsmPrinter::EmitFunctionEntryLabel() {
/// EmitFunctionBodyStart - Targets can override this to emit stuff before
/// the first basic block in the function.
void MipsAsmPrinter::EmitFunctionBodyStart() {
MipsTargetStreamer &TS = getTargetStreamer();
MCInstLowering.Initialize(&MF->getContext());
bool IsNakedFunction =
@ -299,28 +301,28 @@ void MipsAsmPrinter::EmitFunctionBodyStart() {
if (!IsNakedFunction)
printSavedRegsBitmask(OS);
OutStreamer.EmitRawText(OS.str());
if (!Subtarget->inMips16Mode()) {
OutStreamer.EmitRawText(StringRef("\t.set\tnoreorder"));
OutStreamer.EmitRawText(StringRef("\t.set\tnomacro"));
OutStreamer.EmitRawText(StringRef("\t.set\tnoat"));
}
if (!Subtarget->inMips16Mode()) {
TS.emitDirectiveSetNoReorder();
TS.emitDirectiveSetNoMacro();
TS.emitDirectiveSetNoAt();
}
}
/// EmitFunctionBodyEnd - Targets can override this to emit stuff after
/// the last basic block in the function.
void MipsAsmPrinter::EmitFunctionBodyEnd() {
MipsTargetStreamer &TS = getTargetStreamer();
// There are instruction for this macros, but they must
// always be at the function end, and we can't emit and
// break with BB logic.
if (OutStreamer.hasRawTextSupport()) {
if (!Subtarget->inMips16Mode()) {
OutStreamer.EmitRawText(StringRef("\t.set\tat"));
OutStreamer.EmitRawText(StringRef("\t.set\tmacro"));
OutStreamer.EmitRawText(StringRef("\t.set\treorder"));
}
OutStreamer.EmitRawText("\t.end\t" + Twine(CurrentFnSym->getName()));
TS.emitDirectiveSetAt();
TS.emitDirectiveSetMacro();
TS.emitDirectiveSetReorder();
}
TS.emitDirectiveEnd(CurrentFnSym->getName());
// Make sure to terminate any constant pools that were at the end
// of the function.
if (!InConstantPool)

View File

@ -23,6 +23,15 @@ public:
virtual void emitDirectiveSetNoMicroMips() = 0;
virtual void emitDirectiveSetMips16() = 0;
virtual void emitDirectiveSetNoMips16() = 0;
virtual void emitDirectiveSetReorder() = 0;
virtual void emitDirectiveSetNoReorder() = 0;
virtual void emitDirectiveSetMacro() = 0;
virtual void emitDirectiveSetNoMacro() = 0;
virtual void emitDirectiveSetAt() = 0;
virtual void emitDirectiveSetNoAt() = 0;
virtual void emitDirectiveEnd(StringRef Name) = 0;
virtual void emitDirectiveEnt(const MCSymbol &Symbol) = 0;
virtual void emitDirectiveAbiCalls() = 0;
virtual void emitDirectiveOptionPic0() = 0;
@ -39,6 +48,15 @@ public:
virtual void emitDirectiveSetNoMicroMips();
virtual void emitDirectiveSetMips16();
virtual void emitDirectiveSetNoMips16();
virtual void emitDirectiveSetReorder();
virtual void emitDirectiveSetNoReorder();
virtual void emitDirectiveSetMacro();
virtual void emitDirectiveSetNoMacro();
virtual void emitDirectiveSetAt();
virtual void emitDirectiveSetNoAt();
virtual void emitDirectiveEnd(StringRef Name);
virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0();
@ -61,6 +79,15 @@ public:
virtual void emitDirectiveSetNoMicroMips();
virtual void emitDirectiveSetMips16();
virtual void emitDirectiveSetNoMips16();
virtual void emitDirectiveSetReorder();
virtual void emitDirectiveSetNoReorder();
virtual void emitDirectiveSetMacro();
virtual void emitDirectiveSetNoMacro();
virtual void emitDirectiveSetAt();
virtual void emitDirectiveSetNoAt();
virtual void emitDirectiveEnd(StringRef Name);
virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0();