summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp43
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp5
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h6
3 files changed, 12 insertions, 42 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 5ee7d0ac4e2..2acf701b43c 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -355,7 +355,6 @@ class MipsAsmParser : public MCTargetAsmParser {
bool parseSetAssignment();
- bool parseDataDirective(unsigned Size, SMLoc L);
bool parseDirectiveGpWord();
bool parseDirectiveGpDWord();
bool parseDirectiveDtpRelWord();
@@ -487,6 +486,9 @@ public:
MCAsmParserExtension::Initialize(parser);
parser.addAliasForDirective(".asciiz", ".asciz");
+ parser.addAliasForDirective(".hword", ".2byte");
+ parser.addAliasForDirective(".word", ".4byte");
+ parser.addAliasForDirective(".dword", ".8byte");
// Initialize the set of available features.
setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
@@ -7357,31 +7359,6 @@ bool MipsAsmParser::parseDirectiveSet() {
return parseSetAssignment();
}
-/// parseDataDirective
-/// ::= .word [ expression (, expression)* ]
-bool MipsAsmParser::parseDataDirective(unsigned Size, SMLoc L) {
- MCAsmParser &Parser = getParser();
- if (getLexer().isNot(AsmToken::EndOfStatement)) {
- while (true) {
- const MCExpr *Value;
- if (getParser().parseExpression(Value))
- return true;
-
- getParser().getStreamer().EmitValue(Value, Size);
-
- if (getLexer().is(AsmToken::EndOfStatement))
- break;
-
- if (getLexer().isNot(AsmToken::Comma))
- return Error(L, "unexpected token, expected comma");
- Parser.Lex();
- }
- }
-
- Parser.Lex();
- return false;
-}
-
/// parseDirectiveGpWord
/// ::= .gpword local_sym
bool MipsAsmParser::parseDirectiveGpWord() {
@@ -7961,10 +7938,6 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
parseDirectiveCpRestore(DirectiveID.getLoc());
return false;
}
- if (IDVal == ".dword") {
- parseDataDirective(8, DirectiveID.getLoc());
- return false;
- }
if (IDVal == ".ent") {
StringRef SymbolName;
@@ -8212,16 +8185,6 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
return false;
}
- if (IDVal == ".word") {
- parseDataDirective(4, DirectiveID.getLoc());
- return false;
- }
-
- if (IDVal == ".hword") {
- parseDataDirective(2, DirectiveID.getLoc());
- return false;
- }
-
if (IDVal == ".option") {
parseDirectiveOption();
return false;
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
index 13cf5ba86c7..7b9a02503ce 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
@@ -86,6 +86,11 @@ void MipsELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
Labels.clear();
}
+void MipsELFStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
+ MCELFStreamer::EmitIntValue(Value, Size);
+ Labels.clear();
+}
+
void MipsELFStreamer::EmitMipsOptionRecords() {
for (const auto &I : MipsOptionRecords)
I->EmitMipsOptionRecord();
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
index 8ffca340193..d141f5d77c6 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
@@ -54,9 +54,11 @@ public:
void SwitchSection(MCSection *Section,
const MCExpr *Subsection = nullptr) override;
- /// Overriding this function allows us to dismiss all labels that are
- /// candidates for marking as microMIPS when .word directive is emitted.
+ /// Overriding these functions allows us to dismiss all labels that are
+ /// candidates for marking as microMIPS when .word/.long/.4byte etc
+ /// directives are emitted.
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override;
+ void EmitIntValue(uint64_t Value, unsigned Size) override;
/// Emits all the option records stored up until the point it's called.
void EmitMipsOptionRecords();
OpenPOWER on IntegriCloud