Unify duplicated functions.

llvm-svn: 200014
This commit is contained in:
Rafael Espindola 2014-01-24 16:13:20 +00:00
parent f8f15bf670
commit e75837564c
3 changed files with 5 additions and 21 deletions

View File

@ -2350,7 +2350,7 @@ bool MipsAsmParser::parseSetMips16Directive() {
reportParseError("unexpected token in statement"); reportParseError("unexpected token in statement");
return false; return false;
} }
getTargetStreamer().emitDirectiveSetMips16(true); getTargetStreamer().emitDirectiveSetMips16();
Parser.Lex(); // Consume the EndOfStatement. Parser.Lex(); // Consume the EndOfStatement.
return false; return false;
} }

View File

@ -63,12 +63,6 @@ void MipsTargetAsmStreamer::emitDirectiveAbiCalls() { OS << "\t.abicalls\n"; }
void MipsTargetAsmStreamer::emitDirectiveOptionPic0() { void MipsTargetAsmStreamer::emitDirectiveOptionPic0() {
OS << "\t.option\tpic0\n"; OS << "\t.option\tpic0\n";
} }
void MipsTargetAsmStreamer::emitDirectiveSetMips16(bool IsMips16) {
if (IsMips16)
OS << "\t.set\tmips16\n";
else
OS << "\t.set\tnomips16\n";
}
// This part is for ELF object output. // This part is for ELF object output.
MipsTargetELFStreamer::MipsTargetELFStreamer() : MicroMipsEnabled(false) {} MipsTargetELFStreamer::MipsTargetELFStreamer() : MicroMipsEnabled(false) {}
@ -105,7 +99,10 @@ void MipsTargetELFStreamer::emitDirectiveSetNoMicroMips() {
} }
void MipsTargetELFStreamer::emitDirectiveSetMips16() { void MipsTargetELFStreamer::emitDirectiveSetMips16() {
// FIXME: implement. MCAssembler &MCA = getStreamer().getAssembler();
unsigned Flags = MCA.getELFHeaderEFlags();
Flags |= ELF::EF_MIPS_ARCH_ASE_M16;
MCA.setELFHeaderEFlags(Flags);
} }
void MipsTargetELFStreamer::emitDirectiveSetNoMips16() { void MipsTargetELFStreamer::emitDirectiveSetNoMips16() {
@ -128,13 +125,3 @@ void MipsTargetELFStreamer::emitDirectiveOptionPic0() {
Flags &= ~ELF::EF_MIPS_PIC; Flags &= ~ELF::EF_MIPS_PIC;
MCA.setELFHeaderEFlags(Flags); MCA.setELFHeaderEFlags(Flags);
} }
void MipsTargetELFStreamer::emitDirectiveSetMips16(bool IsMips16) {
// Don't do anything for .set nomips16
if (!IsMips16)
return;
MCAssembler &MCA = getStreamer().getAssembler();
unsigned Flags = MCA.getELFHeaderEFlags();
Flags |= ELF::EF_MIPS_ARCH_ASE_M16;
MCA.setELFHeaderEFlags(Flags);
}

View File

@ -26,7 +26,6 @@ public:
virtual void emitDirectiveEnt(const MCSymbol &Symbol) = 0; virtual void emitDirectiveEnt(const MCSymbol &Symbol) = 0;
virtual void emitDirectiveAbiCalls() = 0; virtual void emitDirectiveAbiCalls() = 0;
virtual void emitDirectiveOptionPic0() = 0; virtual void emitDirectiveOptionPic0() = 0;
virtual void emitDirectiveSetMips16(bool IsMips16) = 0;
}; };
// This part is for ascii assembly output // This part is for ascii assembly output
@ -43,7 +42,6 @@ public:
virtual void emitDirectiveEnt(const MCSymbol &Symbol); virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls(); virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0(); virtual void emitDirectiveOptionPic0();
virtual void emitDirectiveSetMips16(bool IsMips16);
}; };
// This part is for ELF object output // This part is for ELF object output
@ -66,7 +64,6 @@ public:
virtual void emitDirectiveEnt(const MCSymbol &Symbol); virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls(); virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0(); virtual void emitDirectiveOptionPic0();
virtual void emitDirectiveSetMips16(bool IsMips16);
}; };
} }
#endif #endif