[Mips] TargetStreamer Support for .abicalls and .set pic0.

This patch adds .abicalls and .set pic0 support which
affects the ELF ABI and its flags. In addition the patch uses
a common interface for both the MipsTargetSteamer and
MipsObjectStreamer that both the integrated and standalone
assemblers will use for the output for these directives.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jack Carter
2014-01-06 23:27:31 +00:00
parent 284c8bc4b0
commit 063564c4c5
9 changed files with 137 additions and 12 deletions

View File

@@ -196,6 +196,7 @@ class MipsAsmParser : public MCTargetAsmParser {
bool parseDirectiveSet();
bool parseDirectiveMipsHackStocg();
bool parseDirectiveMipsHackELFFlags();
bool parseDirectiveOption();
bool parseSetAtDirective();
bool parseSetNoAtDirective();
@@ -2468,6 +2469,35 @@ bool MipsAsmParser::parseDirectiveGpWord() {
return false;
}
bool MipsAsmParser::parseDirectiveOption() {
// Get the option token.
AsmToken Tok = Parser.getTok();
// At the moment only identifiers are supported.
if (Tok.isNot(AsmToken::Identifier)) {
Error(Parser.getTok().getLoc(), "unexpected token in .option directive");
Parser.eatToEndOfStatement();
return false;
}
StringRef Option = Tok.getIdentifier();
if (Option == "pic0") {
getTargetStreamer().emitDirectiveOptionPic0();
Parser.Lex();
if (Parser.getTok().isNot(AsmToken::EndOfStatement)) {
Error(Parser.getTok().getLoc(),
"unexpected token in .option pic0 directive");
Parser.eatToEndOfStatement();
}
return false;
}
// Unknown option.
Warning(Parser.getTok().getLoc(), "unknown option in .option directive");
Parser.eatToEndOfStatement();
return false;
}
bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
StringRef IDVal = DirectiveID.getString();
@@ -2523,6 +2553,19 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
if (IDVal == ".mips_hack_elf_flags")
return parseDirectiveMipsHackELFFlags();
if (IDVal == ".option")
return parseDirectiveOption();
if (IDVal == ".abicalls") {
getTargetStreamer().emitDirectiveAbiCalls();
if (Parser.getTok().isNot(AsmToken::EndOfStatement)) {
Error(Parser.getTok().getLoc(), "unexpected token in directive");
// Clear line
Parser.eatToEndOfStatement();
}
return false;
}
return true;
}