mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
[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
This commit is contained in:
@@ -192,6 +192,7 @@ class MipsAsmParser : public MCTargetAsmParser {
|
|||||||
bool parseSetNoMacroDirective();
|
bool parseSetNoMacroDirective();
|
||||||
bool parseSetMsaDirective();
|
bool parseSetMsaDirective();
|
||||||
bool parseSetNoMsaDirective();
|
bool parseSetNoMsaDirective();
|
||||||
|
bool parseSetNoDspDirective();
|
||||||
bool parseSetReorderDirective();
|
bool parseSetReorderDirective();
|
||||||
bool parseSetNoReorderDirective();
|
bool parseSetNoReorderDirective();
|
||||||
bool parseSetNoMips16Directive();
|
bool parseSetNoMips16Directive();
|
||||||
@@ -2654,6 +2655,20 @@ bool MipsAsmParser::parseSetNoMsaDirective() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MipsAsmParser::parseSetNoDspDirective() {
|
||||||
|
Parser.Lex(); // Eat "nodsp".
|
||||||
|
|
||||||
|
// If this is not the end of the statement, report an error.
|
||||||
|
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||||
|
reportParseError("unexpected token, expected end of statement");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearFeatureBits(Mips::FeatureDSP, "dsp");
|
||||||
|
getTargetStreamer().emitDirectiveSetNoDsp();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MipsAsmParser::parseSetNoMips16Directive() {
|
bool MipsAsmParser::parseSetNoMips16Directive() {
|
||||||
Parser.Lex();
|
Parser.Lex();
|
||||||
// If this is not the end of the statement, report an error.
|
// If this is not the end of the statement, report an error.
|
||||||
@@ -3037,6 +3052,8 @@ bool MipsAsmParser::parseDirectiveSet() {
|
|||||||
return parseSetFeature(Mips::FeatureMips64r6);
|
return parseSetFeature(Mips::FeatureMips64r6);
|
||||||
} else if (Tok.getString() == "dsp") {
|
} else if (Tok.getString() == "dsp") {
|
||||||
return parseSetFeature(Mips::FeatureDSP);
|
return parseSetFeature(Mips::FeatureDSP);
|
||||||
|
} else if (Tok.getString() == "nodsp") {
|
||||||
|
return parseSetNoDspDirective();
|
||||||
} else if (Tok.getString() == "msa") {
|
} else if (Tok.getString() == "msa") {
|
||||||
return parseSetMsaDirective();
|
return parseSetMsaDirective();
|
||||||
} else if (Tok.getString() == "nomsa") {
|
} else if (Tok.getString() == "nomsa") {
|
||||||
|
@@ -74,6 +74,7 @@ void MipsTargetStreamer::emitDirectiveSetMips64R6() { forbidModuleDirective(); }
|
|||||||
void MipsTargetStreamer::emitDirectiveSetPop() {}
|
void MipsTargetStreamer::emitDirectiveSetPop() {}
|
||||||
void MipsTargetStreamer::emitDirectiveSetPush() {}
|
void MipsTargetStreamer::emitDirectiveSetPush() {}
|
||||||
void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
|
||||||
|
void MipsTargetStreamer::emitDirectiveSetNoDsp() { forbidModuleDirective(); }
|
||||||
void MipsTargetStreamer::emitDirectiveCpload(unsigned RegNo) {}
|
void MipsTargetStreamer::emitDirectiveCpload(unsigned RegNo) {}
|
||||||
void MipsTargetStreamer::emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
|
void MipsTargetStreamer::emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
|
||||||
const MCSymbol &Sym, bool IsReg) {
|
const MCSymbol &Sym, bool IsReg) {
|
||||||
@@ -247,6 +248,11 @@ void MipsTargetAsmStreamer::emitDirectiveSetDsp() {
|
|||||||
MipsTargetStreamer::emitDirectiveSetDsp();
|
MipsTargetStreamer::emitDirectiveSetDsp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MipsTargetAsmStreamer::emitDirectiveSetNoDsp() {
|
||||||
|
OS << "\t.set\tnodsp\n";
|
||||||
|
MipsTargetStreamer::emitDirectiveSetNoDsp();
|
||||||
|
}
|
||||||
|
|
||||||
void MipsTargetAsmStreamer::emitDirectiveSetPop() { OS << "\t.set\tpop\n"; }
|
void MipsTargetAsmStreamer::emitDirectiveSetPop() { OS << "\t.set\tpop\n"; }
|
||||||
|
|
||||||
void MipsTargetAsmStreamer::emitDirectiveSetPush() { OS << "\t.set\tpush\n"; }
|
void MipsTargetAsmStreamer::emitDirectiveSetPush() { OS << "\t.set\tpush\n"; }
|
||||||
|
@@ -62,6 +62,7 @@ public:
|
|||||||
virtual void emitDirectiveSetMips64R2();
|
virtual void emitDirectiveSetMips64R2();
|
||||||
virtual void emitDirectiveSetMips64R6();
|
virtual void emitDirectiveSetMips64R6();
|
||||||
virtual void emitDirectiveSetDsp();
|
virtual void emitDirectiveSetDsp();
|
||||||
|
virtual void emitDirectiveSetNoDsp();
|
||||||
virtual void emitDirectiveSetPop();
|
virtual void emitDirectiveSetPop();
|
||||||
virtual void emitDirectiveSetPush();
|
virtual void emitDirectiveSetPush();
|
||||||
|
|
||||||
@@ -165,6 +166,7 @@ public:
|
|||||||
void emitDirectiveSetMips64R2() override;
|
void emitDirectiveSetMips64R2() override;
|
||||||
void emitDirectiveSetMips64R6() override;
|
void emitDirectiveSetMips64R6() override;
|
||||||
void emitDirectiveSetDsp() override;
|
void emitDirectiveSetDsp() override;
|
||||||
|
void emitDirectiveSetNoDsp() override;
|
||||||
void emitDirectiveSetPop() override;
|
void emitDirectiveSetPop() override;
|
||||||
void emitDirectiveSetPush() override;
|
void emitDirectiveSetPush() override;
|
||||||
|
|
||||||
|
12
test/MC/Mips/set-nodsp.s
Normal file
12
test/MC/Mips/set-nodsp.s
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# RUN: not llvm-mc %s -mcpu=mips32 -mattr=+dsp -triple mips-unknown-linux 2>%t1
|
||||||
|
# RUN: FileCheck %s < %t1
|
||||||
|
|
||||||
|
lbux $7, $10($11)
|
||||||
|
|
||||||
|
.set nodsp
|
||||||
|
lbux $6, $10($11)
|
||||||
|
# CHECK: error: instruction requires a CPU feature not currently enabled
|
||||||
|
|
||||||
|
.set dsp
|
||||||
|
lbux $5, $10($11)
|
||||||
|
# CHECK-NOT: error: instruction requires a CPU feature not currently enabled
|
Reference in New Issue
Block a user