This patch implements .set dsp directive and sets appropriate feature bits.This directive is a counterpart of -mattr=dsp command line option with the exception that it does not influence elf header flags. The usage example is gives in test file.

llvm-svn: 202966
This commit is contained in:
Vladimir Medic 2014-03-05 11:05:09 +00:00
parent cef10edcb2
commit 27c398e38c
4 changed files with 24 additions and 0 deletions

View File

@ -2460,6 +2460,13 @@ bool MipsAsmParser::parseDirectiveSet() {
setFeatureBits(Mips::FeatureMips32r2,"mips32r2");
getTargetStreamer().emitDirectiveSetMips32R2();
return false;
} else if (Tok.getString() == "dsp") {
Parser.Lex(); // Eat token.
if (getLexer().isNot(AsmToken::EndOfStatement))
return reportParseError("unexpected token in .set directive");
setFeatureBits(Mips::FeatureDSP, "dsp");
getTargetStreamer().emitDirectiveSetDsp();
return false;
} else {
// It is just an identifier, look for an assignment.
parseSetAssignment();

View File

@ -101,6 +101,9 @@ void MipsTargetAsmStreamer::emitDirectiveSetMips32R2() {
OS << "\t.set\tmips32r2\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetDsp() {
OS << "\t.set\tdsp\n";
}
// Print a 32 bit hex number with all numbers.
static void printHex32(unsigned Value, raw_ostream &OS) {
OS << "0x";
@ -310,3 +313,7 @@ void MipsTargetELFStreamer::emitFMask(unsigned FPUBitmask,
void MipsTargetELFStreamer::emitDirectiveSetMips32R2() {
// No action required for ELF output.
}
void MipsTargetELFStreamer::emitDirectiveSetDsp() {
// No action required for ELF output.
}

View File

@ -41,6 +41,7 @@ public:
virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) = 0;
virtual void emitDirectiveSetMips32R2() = 0;
virtual void emitDirectiveSetDsp() = 0;
};
// This part is for ascii assembly output
@ -71,6 +72,7 @@ public:
virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
virtual void emitDirectiveSetMips32R2();
virtual void emitDirectiveSetDsp();
};
// This part is for ELF object output
@ -108,6 +110,7 @@ public:
virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
virtual void emitDirectiveSetMips32R2();
virtual void emitDirectiveSetDsp();
};
}
#endif

View File

@ -58,3 +58,10 @@ $BB0_4:
ldxc1 $f0, $zero($5)
luxc1 $f0, $6($5)
lwxc1 $f6, $2($5)
# CHECK: .set dsp
# CHECK: lbux $7, $10($11) # encoding: [0x7d,0x6a,0x39,0x8a]
# CHECK: lhx $5, $6($7) # encoding: [0x7c,0xe6,0x29,0x0a]
.set dsp
lbux $7, $10($11)
lhx $5, $6($7)