[llvm] r202966 - 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.
Vladimir Medic
Vladimir.Medic at imgtec.com
Wed Mar 5 03:05:10 PST 2014
Author: vmedic
Date: Wed Mar 5 05:05:09 2014
New Revision: 202966
URL: http://llvm.org/viewvc/llvm-project?rev=202966&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h
llvm/trunk/test/MC/Mips/mips_directives.s
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=202966&r1=202965&r2=202966&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Wed Mar 5 05:05:09 2014
@@ -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();
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp?rev=202966&r1=202965&r2=202966&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp Wed Mar 5 05:05:09 2014
@@ -101,6 +101,9 @@ void MipsTargetAsmStreamer::emitDirectiv
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(un
void MipsTargetELFStreamer::emitDirectiveSetMips32R2() {
// No action required for ELF output.
}
+
+void MipsTargetELFStreamer::emitDirectiveSetDsp() {
+ // No action required for ELF output.
+}
Modified: llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h?rev=202966&r1=202965&r2=202966&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h Wed Mar 5 05:05:09 2014
@@ -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
Modified: llvm/trunk/test/MC/Mips/mips_directives.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips_directives.s?rev=202966&r1=202965&r2=202966&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips_directives.s (original)
+++ llvm/trunk/test/MC/Mips/mips_directives.s Wed Mar 5 05:05:09 2014
@@ -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)
More information about the llvm-commits
mailing list