mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-23 01:25:32 +00:00
[mips] [IAS] Add support for the .set oddspreg/nooddspreg directives.
Differential Revision: http://reviews.llvm.org/D10657 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241052 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -258,6 +258,8 @@ class MipsAsmParser : public MCTargetAsmParser {
|
|||||||
bool parseSetMips16Directive();
|
bool parseSetMips16Directive();
|
||||||
bool parseSetNoMips16Directive();
|
bool parseSetNoMips16Directive();
|
||||||
bool parseSetFpDirective();
|
bool parseSetFpDirective();
|
||||||
|
bool parseSetOddSPRegDirective();
|
||||||
|
bool parseSetNoOddSPRegDirective();
|
||||||
bool parseSetPopDirective();
|
bool parseSetPopDirective();
|
||||||
bool parseSetPushDirective();
|
bool parseSetPushDirective();
|
||||||
bool parseSetSoftFloatDirective();
|
bool parseSetSoftFloatDirective();
|
||||||
@@ -4098,6 +4100,34 @@ bool MipsAsmParser::parseSetFpDirective() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MipsAsmParser::parseSetOddSPRegDirective() {
|
||||||
|
MCAsmParser &Parser = getParser();
|
||||||
|
|
||||||
|
Parser.Lex(); // Eat "oddspreg".
|
||||||
|
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||||
|
reportParseError("unexpected token, expected end of statement");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearFeatureBits(Mips::FeatureNoOddSPReg, "nooddspreg");
|
||||||
|
getTargetStreamer().emitDirectiveSetOddSPReg();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MipsAsmParser::parseSetNoOddSPRegDirective() {
|
||||||
|
MCAsmParser &Parser = getParser();
|
||||||
|
|
||||||
|
Parser.Lex(); // Eat "nooddspreg".
|
||||||
|
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||||
|
reportParseError("unexpected token, expected end of statement");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFeatureBits(Mips::FeatureNoOddSPReg, "nooddspreg");
|
||||||
|
getTargetStreamer().emitDirectiveSetNoOddSPReg();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MipsAsmParser::parseSetPopDirective() {
|
bool MipsAsmParser::parseSetPopDirective() {
|
||||||
MCAsmParser &Parser = getParser();
|
MCAsmParser &Parser = getParser();
|
||||||
SMLoc Loc = getLexer().getLoc();
|
SMLoc Loc = getLexer().getLoc();
|
||||||
@@ -4460,6 +4490,10 @@ bool MipsAsmParser::parseDirectiveSet() {
|
|||||||
return parseSetArchDirective();
|
return parseSetArchDirective();
|
||||||
} else if (Tok.getString() == "fp") {
|
} else if (Tok.getString() == "fp") {
|
||||||
return parseSetFpDirective();
|
return parseSetFpDirective();
|
||||||
|
} else if (Tok.getString() == "oddspreg") {
|
||||||
|
return parseSetOddSPRegDirective();
|
||||||
|
} else if (Tok.getString() == "nooddspreg") {
|
||||||
|
return parseSetNoOddSPRegDirective();
|
||||||
} else if (Tok.getString() == "pop") {
|
} else if (Tok.getString() == "pop") {
|
||||||
return parseSetPopDirective();
|
return parseSetPopDirective();
|
||||||
} else if (Tok.getString() == "push") {
|
} else if (Tok.getString() == "push") {
|
||||||
|
@@ -103,6 +103,10 @@ void MipsTargetStreamer::emitDirectiveSetFp(
|
|||||||
MipsABIFlagsSection::FpABIKind Value) {
|
MipsABIFlagsSection::FpABIKind Value) {
|
||||||
forbidModuleDirective();
|
forbidModuleDirective();
|
||||||
}
|
}
|
||||||
|
void MipsTargetStreamer::emitDirectiveSetOddSPReg() { forbidModuleDirective(); }
|
||||||
|
void MipsTargetStreamer::emitDirectiveSetNoOddSPReg() {
|
||||||
|
forbidModuleDirective();
|
||||||
|
}
|
||||||
|
|
||||||
MipsTargetAsmStreamer::MipsTargetAsmStreamer(MCStreamer &S,
|
MipsTargetAsmStreamer::MipsTargetAsmStreamer(MCStreamer &S,
|
||||||
formatted_raw_ostream &OS)
|
formatted_raw_ostream &OS)
|
||||||
@@ -390,6 +394,16 @@ void MipsTargetAsmStreamer::emitDirectiveModuleOddSPReg() {
|
|||||||
OS << "\t.module\t" << (ABIFlagsSection.OddSPReg ? "" : "no") << "oddspreg\n";
|
OS << "\t.module\t" << (ABIFlagsSection.OddSPReg ? "" : "no") << "oddspreg\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MipsTargetAsmStreamer::emitDirectiveSetOddSPReg() {
|
||||||
|
MipsTargetStreamer::emitDirectiveSetOddSPReg();
|
||||||
|
OS << "\t.set\toddspreg\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void MipsTargetAsmStreamer::emitDirectiveSetNoOddSPReg() {
|
||||||
|
MipsTargetStreamer::emitDirectiveSetNoOddSPReg();
|
||||||
|
OS << "\t.set\tnooddspreg\n";
|
||||||
|
}
|
||||||
|
|
||||||
// This part is for ELF object output.
|
// This part is for ELF object output.
|
||||||
MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
|
MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
|
||||||
const MCSubtargetInfo &STI)
|
const MCSubtargetInfo &STI)
|
||||||
|
@@ -84,6 +84,8 @@ public:
|
|||||||
virtual void emitDirectiveModuleFP();
|
virtual void emitDirectiveModuleFP();
|
||||||
virtual void emitDirectiveModuleOddSPReg();
|
virtual void emitDirectiveModuleOddSPReg();
|
||||||
virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
|
virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
|
||||||
|
virtual void emitDirectiveSetOddSPReg();
|
||||||
|
virtual void emitDirectiveSetNoOddSPReg();
|
||||||
|
|
||||||
void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
|
void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
|
||||||
void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
|
void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
|
||||||
@@ -191,6 +193,8 @@ public:
|
|||||||
void emitDirectiveModuleFP() override;
|
void emitDirectiveModuleFP() override;
|
||||||
void emitDirectiveModuleOddSPReg() override;
|
void emitDirectiveModuleOddSPReg() override;
|
||||||
void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
|
void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
|
||||||
|
void emitDirectiveSetOddSPReg() override;
|
||||||
|
void emitDirectiveSetNoOddSPReg() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This part is for ELF object output
|
// This part is for ELF object output
|
||||||
|
10
test/MC/Mips/set-oddspreg-nooddspreg-error.s
Normal file
10
test/MC/Mips/set-oddspreg-nooddspreg-error.s
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# RUN: not llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32 -mattr=+nooddspreg 2>%t1
|
||||||
|
# RUN: FileCheck %s < %t1
|
||||||
|
|
||||||
|
.set oddspreg
|
||||||
|
sub.s $f1, $f2, $f2
|
||||||
|
# CHECK-NOT: :[[@LINE-1]]:{{[0-9]+}}: error: -mno-odd-spreg prohibits the use of odd FPU registers
|
||||||
|
|
||||||
|
.set nooddspreg
|
||||||
|
sub.s $f1, $f2, $f2
|
||||||
|
# CHECK: :[[@LINE-1]]:9: error: -mno-odd-spreg prohibits the use of odd FPU registers
|
10
test/MC/Mips/set-oddspreg-nooddspreg.s
Normal file
10
test/MC/Mips/set-oddspreg-nooddspreg.s
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -mattr=+nooddspreg | \
|
||||||
|
# RUN: FileCheck %s
|
||||||
|
|
||||||
|
.set oddspreg
|
||||||
|
sub.s $f1, $f2, $f2
|
||||||
|
.set nooddspreg
|
||||||
|
|
||||||
|
# CHECK: .set oddspreg
|
||||||
|
# CHECK: sub.s $f1, $f2, $f2
|
||||||
|
# CHECK: .set nooddspreg
|
Reference in New Issue
Block a user