llvm.org GIT mirror llvm / 5dee8da
[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 Toma Tabacu 4 years ago
5 changed file(s) with 72 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
257257 bool parseSetMips16Directive();
258258 bool parseSetNoMips16Directive();
259259 bool parseSetFpDirective();
260 bool parseSetOddSPRegDirective();
261 bool parseSetNoOddSPRegDirective();
260262 bool parseSetPopDirective();
261263 bool parseSetPushDirective();
262264 bool parseSetSoftFloatDirective();
40974099 return false;
40984100 }
40994101
4102 bool MipsAsmParser::parseSetOddSPRegDirective() {
4103 MCAsmParser &Parser = getParser();
4104
4105 Parser.Lex(); // Eat "oddspreg".
4106 if (getLexer().isNot(AsmToken::EndOfStatement)) {
4107 reportParseError("unexpected token, expected end of statement");
4108 return false;
4109 }
4110
4111 clearFeatureBits(Mips::FeatureNoOddSPReg, "nooddspreg");
4112 getTargetStreamer().emitDirectiveSetOddSPReg();
4113 return false;
4114 }
4115
4116 bool MipsAsmParser::parseSetNoOddSPRegDirective() {
4117 MCAsmParser &Parser = getParser();
4118
4119 Parser.Lex(); // Eat "nooddspreg".
4120 if (getLexer().isNot(AsmToken::EndOfStatement)) {
4121 reportParseError("unexpected token, expected end of statement");
4122 return false;
4123 }
4124
4125 setFeatureBits(Mips::FeatureNoOddSPReg, "nooddspreg");
4126 getTargetStreamer().emitDirectiveSetNoOddSPReg();
4127 return false;
4128 }
4129
41004130 bool MipsAsmParser::parseSetPopDirective() {
41014131 MCAsmParser &Parser = getParser();
41024132 SMLoc Loc = getLexer().getLoc();
44594489 return parseSetArchDirective();
44604490 } else if (Tok.getString() == "fp") {
44614491 return parseSetFpDirective();
4492 } else if (Tok.getString() == "oddspreg") {
4493 return parseSetOddSPRegDirective();
4494 } else if (Tok.getString() == "nooddspreg") {
4495 return parseSetNoOddSPRegDirective();
44624496 } else if (Tok.getString() == "pop") {
44634497 return parseSetPopDirective();
44644498 } else if (Tok.getString() == "push") {
102102 MipsABIFlagsSection::FpABIKind Value) {
103103 forbidModuleDirective();
104104 }
105 void MipsTargetStreamer::emitDirectiveSetOddSPReg() { forbidModuleDirective(); }
106 void MipsTargetStreamer::emitDirectiveSetNoOddSPReg() {
107 forbidModuleDirective();
108 }
105109
106110 MipsTargetAsmStreamer::MipsTargetAsmStreamer(MCStreamer &S,
107111 formatted_raw_ostream &OS)
387391 MipsTargetStreamer::emitDirectiveModuleOddSPReg();
388392
389393 OS << "\t.module\t" << (ABIFlagsSection.OddSPReg ? "" : "no") << "oddspreg\n";
394 }
395
396 void MipsTargetAsmStreamer::emitDirectiveSetOddSPReg() {
397 MipsTargetStreamer::emitDirectiveSetOddSPReg();
398 OS << "\t.set\toddspreg\n";
399 }
400
401 void MipsTargetAsmStreamer::emitDirectiveSetNoOddSPReg() {
402 MipsTargetStreamer::emitDirectiveSetNoOddSPReg();
403 OS << "\t.set\tnooddspreg\n";
390404 }
391405
392406 // This part is for ELF object output.
8383 virtual void emitDirectiveModuleFP();
8484 virtual void emitDirectiveModuleOddSPReg();
8585 virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
86 virtual void emitDirectiveSetOddSPReg();
87 virtual void emitDirectiveSetNoOddSPReg();
8688
8789 void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
8890 void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
190192 void emitDirectiveModuleFP() override;
191193 void emitDirectiveModuleOddSPReg() override;
192194 void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
195 void emitDirectiveSetOddSPReg() override;
196 void emitDirectiveSetNoOddSPReg() override;
193197 };
194198
195199 // This part is for ELF object output
0 # RUN: not llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32 -mattr=+nooddspreg 2>%t1
1 # RUN: FileCheck %s < %t1
2
3 .set oddspreg
4 sub.s $f1, $f2, $f2
5 # CHECK-NOT: :[[@LINE-1]]:{{[0-9]+}}: error: -mno-odd-spreg prohibits the use of odd FPU registers
6
7 .set nooddspreg
8 sub.s $f1, $f2, $f2
9 # CHECK: :[[@LINE-1]]:9: error: -mno-odd-spreg prohibits the use of odd FPU registers
0 # RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -mattr=+nooddspreg | \
1 # RUN: FileCheck %s
2
3 .set oddspreg
4 sub.s $f1, $f2, $f2
5 .set nooddspreg
6
7 # CHECK: .set oddspreg
8 # CHECK: sub.s $f1, $f2, $f2
9 # CHECK: .set nooddspreg