llvm.org GIT mirror llvm / 4378ff0
[mips] Add assembler support for the .set nodsp directive. Summary: This directive is used to tell the assembler to reject DSP-specific instructions. Reviewers: dsanders Reviewed By: dsanders Differential Revision: http://reviews.llvm.org/D5142 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217946 91177308-0d34-0410-b5e6-96231b3b80d8 Toma Tabacu 5 years ago
4 changed file(s) with 37 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
191191 bool parseSetNoMacroDirective();
192192 bool parseSetMsaDirective();
193193 bool parseSetNoMsaDirective();
194 bool parseSetNoDspDirective();
194195 bool parseSetReorderDirective();
195196 bool parseSetNoReorderDirective();
196197 bool parseSetNoMips16Directive();
26532654 return false;
26542655 }
26552656
2657 bool MipsAsmParser::parseSetNoDspDirective() {
2658 Parser.Lex(); // Eat "nodsp".
2659
2660 // If this is not the end of the statement, report an error.
2661 if (getLexer().isNot(AsmToken::EndOfStatement)) {
2662 reportParseError("unexpected token, expected end of statement");
2663 return false;
2664 }
2665
2666 clearFeatureBits(Mips::FeatureDSP, "dsp");
2667 getTargetStreamer().emitDirectiveSetNoDsp();
2668 return false;
2669 }
2670
26562671 bool MipsAsmParser::parseSetNoMips16Directive() {
26572672 Parser.Lex();
26582673 // If this is not the end of the statement, report an error.
30363051 return parseSetFeature(Mips::FeatureMips64r6);
30373052 } else if (Tok.getString() == "dsp") {
30383053 return parseSetFeature(Mips::FeatureDSP);
3054 } else if (Tok.getString() == "nodsp") {
3055 return parseSetNoDspDirective();
30393056 } else if (Tok.getString() == "msa") {
30403057 return parseSetMsaDirective();
30413058 } else if (Tok.getString() == "nomsa") {
7373 void MipsTargetStreamer::emitDirectiveSetPop() {}
7474 void MipsTargetStreamer::emitDirectiveSetPush() {}
7575 void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
76 void MipsTargetStreamer::emitDirectiveSetNoDsp() { forbidModuleDirective(); }
7677 void MipsTargetStreamer::emitDirectiveCpload(unsigned RegNo) {}
7778 void MipsTargetStreamer::emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
7879 const MCSymbol &Sym, bool IsReg) {
244245 void MipsTargetAsmStreamer::emitDirectiveSetDsp() {
245246 OS << "\t.set\tdsp\n";
246247 MipsTargetStreamer::emitDirectiveSetDsp();
248 }
249
250 void MipsTargetAsmStreamer::emitDirectiveSetNoDsp() {
251 OS << "\t.set\tnodsp\n";
252 MipsTargetStreamer::emitDirectiveSetNoDsp();
247253 }
248254
249255 void MipsTargetAsmStreamer::emitDirectiveSetPop() { OS << "\t.set\tpop\n"; }
6161 virtual void emitDirectiveSetMips64R2();
6262 virtual void emitDirectiveSetMips64R6();
6363 virtual void emitDirectiveSetDsp();
64 virtual void emitDirectiveSetNoDsp();
6465 virtual void emitDirectiveSetPop();
6566 virtual void emitDirectiveSetPush();
6667
164165 void emitDirectiveSetMips64R2() override;
165166 void emitDirectiveSetMips64R6() override;
166167 void emitDirectiveSetDsp() override;
168 void emitDirectiveSetNoDsp() override;
167169 void emitDirectiveSetPop() override;
168170 void emitDirectiveSetPush() override;
169171
0 # RUN: not llvm-mc %s -mcpu=mips32 -mattr=+dsp -triple mips-unknown-linux 2>%t1
1 # RUN: FileCheck %s < %t1
2
3 lbux $7, $10($11)
4
5 .set nodsp
6 lbux $6, $10($11)
7 # CHECK: error: instruction requires a CPU feature not currently enabled
8
9 .set dsp
10 lbux $5, $10($11)
11 # CHECK-NOT: error: instruction requires a CPU feature not currently enabled