diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-11-20 06:21:08 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-11-20 06:21:08 +0000 |
commit | a87a147ee7bb9adb4caea631ff0ba7e66bb9b0b5 (patch) | |
tree | 64257ce0ac3ead38c1335b7b267f2ba54a9d7a2a /lib | |
parent | 3773bef110790fbeeb386b083bdf8ad16bbceb91 (diff) | |
download | external_llvm-a87a147ee7bb9adb4caea631ff0ba7e66bb9b0b5.zip external_llvm-a87a147ee7bb9adb4caea631ff0ba7e66bb9b0b5.tar.gz external_llvm-a87a147ee7bb9adb4caea631ff0ba7e66bb9b0b5.tar.bz2 |
Merging r195152:
------------------------------------------------------------------------
r195152 | jacksprat | 2013-11-19 12:53:28 -0800 (Tue, 19 Nov 2013) | 1 line
reverts 195057 per request
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@195220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 36 | ||||
-rw-r--r-- | lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | 28 | ||||
-rw-r--r-- | lib/Target/Mips/MipsAsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/Target/Mips/MipsTargetStreamer.h | 9 |
5 files changed, 70 insertions, 9 deletions
diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 6e14026..cdae6c2 100644 --- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -193,6 +193,8 @@ class MipsAsmParser : public MCTargetAsmParser { bool isEvaluated(const MCExpr *Expr); bool parseDirectiveSet(); + bool parseDirectiveMipsHackStocg(); + bool parseDirectiveMipsHackELFFlags(); bool parseSetAtDirective(); bool parseSetNoAtDirective(); @@ -2368,6 +2370,34 @@ bool MipsAsmParser::parseDirectiveSet() { 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) { @@ -2458,6 +2488,12 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) { return false; } + if (IDVal == ".mips_hack_stocg") + return parseDirectiveMipsHackStocg(); + + if (IDVal == ".mips_hack_elf_flags") + return parseDirectiveMipsHackELFFlags(); + return true; } diff --git a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp index c81e9c0..5548aaa 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp @@ -141,7 +141,7 @@ createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS, bool isVerboseAsm, bool useLoc, bool useCFI, bool useDwarfDirectory, MCInstPrinter *InstPrint, MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) { - MipsTargetAsmStreamer *S = new MipsTargetAsmStreamer(); + MipsTargetAsmStreamer *S = new MipsTargetAsmStreamer(OS); return llvm::createAsmStreamer(Ctx, S, OS, isVerboseAsm, useLoc, useCFI, useDwarfDirectory, InstPrint, CE, TAB, diff --git a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index 04692a5..5e90bbc 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -20,11 +20,33 @@ using namespace llvm; +static cl::opt<bool> PrintHackDirectives("print-hack-directives", + cl::init(false), cl::Hidden); + // pin vtable to this file void MipsTargetStreamer::anchor() {} -void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) { return; } -void MipsTargetAsmStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) { return; } +MipsTargetAsmStreamer::MipsTargetAsmStreamer(formatted_raw_ostream &OS) + : OS(OS) {} + +void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) { + if (!PrintHackDirectives) + return; + + OS << "\t.mips_hack_elf_flags 0x"; + OS.write_hex(Flags); + OS << '\n'; +} +void MipsTargetAsmStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) { + if (!PrintHackDirectives) + return; + + OS << "\t.mips_hack_stocg "; + OS << Sym->getName(); + OS << ", "; + OS << Val; + OS << '\n'; +} MCELFStreamer &MipsTargetELFStreamer::getStreamer() { return static_cast<MCELFStreamer &>(*Streamer); @@ -36,7 +58,7 @@ void MipsTargetELFStreamer::emitMipsHackELFFlags(unsigned Flags) { } // Set a symbol's STO flags -void MipsTargetELFStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) { +void MipsTargetELFStreamer::emitMipsHackSTOCG(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/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp index f517c0b..45c4398 100644 --- a/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/MipsAsmPrinter.cpp @@ -276,8 +276,8 @@ void MipsAsmPrinter::EmitFunctionEntryLabel() { } if (Subtarget->inMicroMipsMode()) - getTargetStreamer().emitSymSTO(CurrentFnSym, - (unsigned)ELF::STO_MIPS_MICROMIPS); + getTargetStreamer().emitMipsHackSTOCG(CurrentFnSym, + (unsigned)ELF::STO_MIPS_MICROMIPS); OutStreamer.EmitLabel(CurrentFnSym); } diff --git a/lib/Target/Mips/MipsTargetStreamer.h b/lib/Target/Mips/MipsTargetStreamer.h index 4edecc4..96966fd 100644 --- a/lib/Target/Mips/MipsTargetStreamer.h +++ b/lib/Target/Mips/MipsTargetStreamer.h @@ -19,14 +19,17 @@ class MipsTargetStreamer : public MCTargetStreamer { public: virtual void emitMipsHackELFFlags(unsigned Flags) = 0; - virtual void emitSymSTO(MCSymbol *Sym, unsigned Val) = 0; + virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0; }; // This part is for ascii assembly output class MipsTargetAsmStreamer : public MipsTargetStreamer { + formatted_raw_ostream &OS; + public: + MipsTargetAsmStreamer(formatted_raw_ostream &OS); virtual void emitMipsHackELFFlags(unsigned Flags); - virtual void emitSymSTO(MCSymbol *Sym, unsigned Val); + virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val); }; // This part is for ELF object output @@ -34,7 +37,7 @@ class MipsTargetELFStreamer : public MipsTargetStreamer { public: MCELFStreamer &getStreamer(); virtual void emitMipsHackELFFlags(unsigned Flags); - virtual void emitSymSTO(MCSymbol *Sym, unsigned Val); + virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val); }; } |