diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-08-07 12:03:36 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-08-07 12:03:36 +0000 |
commit | 449344315fb74f1aba709380ff86c764bad3e1a9 (patch) | |
tree | 15c4e330599c1fc3c116c4fc850cf8bf4281d369 /llvm/lib/Target | |
parent | 124889243a3c3620fd7e39bad99bbd1fcbda1a0f (diff) | |
download | bcm5719-llvm-449344315fb74f1aba709380ff86c764bad3e1a9.tar.gz bcm5719-llvm-449344315fb74f1aba709380ff86c764bad3e1a9.zip |
[mips] Add assembler support for .set msa/nomsa directive.
Summary:
These directives are used to toggle whether the assembler accepts MSA-specific instructions or not.
Patch by Matheus Almeida and Toma Tabacu.
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D4783
llvm-svn: 215099
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 30 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/MipsTargetStreamer.h | 4 |
3 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index aaffb718b3c..ca2032b11c6 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -167,6 +167,8 @@ class MipsAsmParser : public MCTargetAsmParser { bool parseSetNoAtDirective(); bool parseSetMacroDirective(); bool parseSetNoMacroDirective(); + bool parseSetMsaDirective(); + bool parseSetNoMsaDirective(); bool parseSetReorderDirective(); bool parseSetNoReorderDirective(); bool parseSetNoMips16Directive(); @@ -2487,6 +2489,30 @@ bool MipsAsmParser::parseSetNoMacroDirective() { return false; } +bool MipsAsmParser::parseSetMsaDirective() { + Parser.Lex(); + + // If this is not the end of the statement, report an error. + if (getLexer().isNot(AsmToken::EndOfStatement)) + return reportParseError("unexpected token in statement"); + + setFeatureBits(Mips::FeatureMSA, "msa"); + getTargetStreamer().emitDirectiveSetMsa(); + return false; +} + +bool MipsAsmParser::parseSetNoMsaDirective() { + Parser.Lex(); + + // If this is not the end of the statement, report an error. + if (getLexer().isNot(AsmToken::EndOfStatement)) + return reportParseError("unexpected token in statement"); + + clearFeatureBits(Mips::FeatureMSA, "msa"); + getTargetStreamer().emitDirectiveSetNoMsa(); + return false; +} + bool MipsAsmParser::parseSetNoMips16Directive() { Parser.Lex(); // If this is not the end of the statement, report an error. @@ -2782,6 +2808,10 @@ bool MipsAsmParser::parseDirectiveSet() { return parseSetFeature(Mips::FeatureMips64r6); } else if (Tok.getString() == "dsp") { return parseSetFeature(Mips::FeatureDSP); + } else if (Tok.getString() == "msa") { + return parseSetMsaDirective(); + } else if (Tok.getString() == "nomsa") { + return parseSetNoMsaDirective(); } else { // It is just an identifier, look for an assignment. parseSetAssignment(); diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index 0f02107b81a..7a8230fdebf 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -38,6 +38,8 @@ void MipsTargetStreamer::emitDirectiveSetReorder() {} void MipsTargetStreamer::emitDirectiveSetNoReorder() {} void MipsTargetStreamer::emitDirectiveSetMacro() {} void MipsTargetStreamer::emitDirectiveSetNoMacro() {} +void MipsTargetStreamer::emitDirectiveSetMsa() { setCanHaveModuleDir(false); } +void MipsTargetStreamer::emitDirectiveSetNoMsa() { setCanHaveModuleDir(false); } void MipsTargetStreamer::emitDirectiveSetAt() {} void MipsTargetStreamer::emitDirectiveSetNoAt() {} void MipsTargetStreamer::emitDirectiveEnd(StringRef Name) {} @@ -118,6 +120,16 @@ void MipsTargetAsmStreamer::emitDirectiveSetNoMacro() { setCanHaveModuleDir(false); } +void MipsTargetAsmStreamer::emitDirectiveSetMsa() { + OS << "\t.set\tmsa\n"; + MipsTargetStreamer::emitDirectiveSetMsa(); +} + +void MipsTargetAsmStreamer::emitDirectiveSetNoMsa() { + OS << "\t.set\tnomsa\n"; + MipsTargetStreamer::emitDirectiveSetNoMsa(); +} + void MipsTargetAsmStreamer::emitDirectiveSetAt() { OS << "\t.set\tat\n"; setCanHaveModuleDir(false); diff --git a/llvm/lib/Target/Mips/MipsTargetStreamer.h b/llvm/lib/Target/Mips/MipsTargetStreamer.h index 67ac7578b88..8253c622563 100644 --- a/llvm/lib/Target/Mips/MipsTargetStreamer.h +++ b/llvm/lib/Target/Mips/MipsTargetStreamer.h @@ -30,6 +30,8 @@ public: virtual void emitDirectiveSetNoReorder(); virtual void emitDirectiveSetMacro(); virtual void emitDirectiveSetNoMacro(); + virtual void emitDirectiveSetMsa(); + virtual void emitDirectiveSetNoMsa(); virtual void emitDirectiveSetAt(); virtual void emitDirectiveSetNoAt(); virtual void emitDirectiveEnd(StringRef Name); @@ -114,6 +116,8 @@ public: void emitDirectiveSetNoReorder() override; void emitDirectiveSetMacro() override; void emitDirectiveSetNoMacro() override; + void emitDirectiveSetMsa() override; + void emitDirectiveSetNoMsa() override; void emitDirectiveSetAt() override; void emitDirectiveSetNoAt() override; void emitDirectiveEnd(StringRef Name) override; |