[Mips] Support for MicroMips STO refactoring.
No true functional changes.
Change the "hack" name of emitMipsHackSTOCG to emitSymSTO.
Remove demonstration code in AsmParser for emitMipsHackSTOCG and
emitMipsHackELFFlags. The STO field is in an ELF symbol and is not
an explicit directive. That said, we are missing the compliment call
in AsmParser and that will need to be addressed soon.
XFAIL dummy tests for emitMipsHackELFFlags and emitMipsHackELFFlags.
These will built out with following patches.
llvm-svn: 195067
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index cdae6c2..6e14026 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -193,8 +193,6 @@
bool isEvaluated(const MCExpr *Expr);
bool parseDirectiveSet();
- bool parseDirectiveMipsHackStocg();
- bool parseDirectiveMipsHackELFFlags();
bool parseSetAtDirective();
bool parseSetNoAtDirective();
@@ -2370,34 +2368,6 @@
return true;
}
-bool MipsAsmParser::parseDirectiveMipsHackStocg() {
- MCAsmParser &Parser = getParser();
- StringRef Name;
- if (Parser.parseIdentifier(Name))
- reportParseError("expected identifier");
-
- MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
- if (getLexer().isNot(AsmToken::Comma))
- return TokError("unexpected token");
- Lex();
-
- int64_t Flags = 0;
- if (Parser.parseAbsoluteExpression(Flags))
- return TokError("unexpected token");
-
- getTargetStreamer().emitMipsHackSTOCG(Sym, Flags);
- return false;
-}
-
-bool MipsAsmParser::parseDirectiveMipsHackELFFlags() {
- int64_t Flags = 0;
- if (Parser.parseAbsoluteExpression(Flags))
- return TokError("unexpected token");
-
- getTargetStreamer().emitMipsHackELFFlags(Flags);
- return false;
-}
-
/// parseDirectiveWord
/// ::= .word [ expression (, expression)* ]
bool MipsAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
@@ -2488,12 +2458,6 @@
return false;
}
- if (IDVal == ".mips_hack_stocg")
- return parseDirectiveMipsHackStocg();
-
- if (IDVal == ".mips_hack_elf_flags")
- return parseDirectiveMipsHackELFFlags();
-
return true;
}
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index 998a575..16f65b4 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -20,9 +20,6 @@
using namespace llvm;
-static cl::opt<bool> PrintHackDirectives("print-hack-directives",
- cl::init(false), cl::Hidden);
-
// pin vtable to this file
void MipsTargetStreamer::anchor() {}
@@ -30,22 +27,12 @@
: OS(OS) {}
void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) {
- if (!PrintHackDirectives)
- return;
+ return;
- OS << "\t.mips_hack_elf_flags 0x";
- OS.write_hex(Flags);
- OS << '\n';
}
-void MipsTargetAsmStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) {
- if (!PrintHackDirectives)
- return;
+void MipsTargetAsmStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) {
+ return;
- OS << "\t.mips_hack_stocg ";
- OS << Sym->getName();
- OS << ", ";
- OS << Val;
- OS << '\n';
}
MipsTargetELFStreamer::MipsTargetELFStreamer() {}
@@ -60,7 +47,7 @@
}
// Set a symbol's STO flags
-void MipsTargetELFStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) {
+void MipsTargetELFStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) {
MCSymbolData &Data = getStreamer().getOrCreateSymbolData(Sym);
// The "other" values are stored in the last 6 bits of the second byte
// The traditional defines for STO values assume the full byte and thus
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 45c4398..f517c0b 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -276,8 +276,8 @@
}
if (Subtarget->inMicroMipsMode())
- getTargetStreamer().emitMipsHackSTOCG(CurrentFnSym,
- (unsigned)ELF::STO_MIPS_MICROMIPS);
+ getTargetStreamer().emitSymSTO(CurrentFnSym,
+ (unsigned)ELF::STO_MIPS_MICROMIPS);
OutStreamer.EmitLabel(CurrentFnSym);
}
diff --git a/llvm/lib/Target/Mips/MipsTargetStreamer.h b/llvm/lib/Target/Mips/MipsTargetStreamer.h
index a3908ce..c1f9e40 100644
--- a/llvm/lib/Target/Mips/MipsTargetStreamer.h
+++ b/llvm/lib/Target/Mips/MipsTargetStreamer.h
@@ -18,7 +18,7 @@
virtual void anchor();
public:
virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
- virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
+ virtual void emitSymSTO(MCSymbol *Sym, unsigned Val) = 0;
};
// This part is for ascii assembly output
@@ -28,7 +28,7 @@
public:
MipsTargetAsmStreamer(formatted_raw_ostream &OS);
virtual void emitMipsHackELFFlags(unsigned Flags);
- virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
+ virtual void emitSymSTO(MCSymbol *Sym, unsigned Val);
};
// This part is for ELF object output
@@ -37,7 +37,7 @@
MCELFStreamer &getStreamer();
MipsTargetELFStreamer();
virtual void emitMipsHackELFFlags(unsigned Flags);
- virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
+ virtual void emitSymSTO(MCSymbol *Sym, unsigned Val);
};
}