llvm.org GIT mirror llvm / 9fbb37e
MC: Move several clients to using AsmParser constructor function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108645 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 9 years ago
3 changed file(s) with 21 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
2121 #include "llvm/MC/MCAsmInfo.h"
2222 #include "llvm/MC/MCStreamer.h"
2323 #include "llvm/MC/MCSymbol.h"
24 #include "llvm/MC/MCParser/AsmParser.h"
2524 #include "llvm/Target/TargetAsmParser.h"
2625 #include "llvm/Target/TargetMachine.h"
2726 #include "llvm/Target/TargetRegistry.h"
7170 // Tell SrcMgr about this buffer, it takes ownership of the buffer.
7271 SrcMgr.AddNewSourceBuffer(Buffer, SMLoc());
7372
74 AsmParser Parser(TM.getTarget(), SrcMgr, OutContext, OutStreamer, *MAI);
75 OwningPtr<TargetAsmParser> TAP(TM.getTarget().createAsmParser(Parser));
73 OwningPtr<MCAsmParser> Parser(createMCAsmParser(TM.getTarget(), SrcMgr,
74 OutContext, OutStreamer,
75 *MAI));
76 OwningPtr TAP(TM.getTarget().createAsmParser(*Parser));
7677 if (!TAP)
7778 report_fatal_error("Inline asm not supported by this streamer because"
7879 " we don't have an asm parser for this target\n");
79 Parser.setTargetParser(*TAP.get());
80 Parser->setTargetParser(*TAP.get());
8081
8182 // Don't implicitly switch to the text section before the asm.
82 int Res = Parser.Run(/*NoInitialTextSection*/ true,
83 /*NoFinalize*/ true);
83 int Res = Parser->Run(/*NoInitialTextSection*/ true,
84 /*NoFinalize*/ true);
8485 if (Res && !HasDiagHandler)
8586 report_fatal_error("Error parsing inline asm\n");
8687 }
2626 #include "llvm/MC/MCInstPrinter.h"
2727 #include "llvm/MC/MCStreamer.h"
2828 #include "llvm/MC/MCParser/AsmLexer.h"
29 #include "llvm/MC/MCParser/AsmParser.h"
3029 #include "llvm/MC/MCParser/MCAsmParser.h"
3130 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
3231 #include "llvm/Support/MemoryBuffer.h"
363362 sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
364363 MCContext context(*AsmInfo);
365364 OwningPtr streamer(createNullStreamer(context));
366 AsmParser genericParser(*Tgt, sourceMgr, context, *streamer, *AsmInfo);
367 OwningPtr TargetParser(Tgt->createAsmParser(genericParser));
368
369 AsmToken OpcodeToken = genericParser.Lex();
370 AsmToken NextToken = genericParser.Lex(); // consume next token, because specificParser expects us to
365 OwningPtr genericParser(createMCAsmParser(*Tgt, sourceMgr,
366 context, *streamer,
367 *AsmInfo));
368 OwningPtr TargetParser(Tgt->createAsmParser(*genericParser));
369
370 AsmToken OpcodeToken = genericParser->Lex();
371 AsmToken NextToken = genericParser->Lex(); // consume next token, because specificParser expects us to
371372
372373 if (OpcodeToken.is(AsmToken::Identifier)) {
373374 instName = OpcodeToken.getString();
1111 //
1212 //===----------------------------------------------------------------------===//
1313
14 #include "llvm/MC/MCParser/AsmLexer.h"
1415 #include "llvm/MC/MCParser/MCAsmLexer.h"
1516 #include "llvm/MC/MCContext.h"
1617 #include "llvm/MC/MCCodeEmitter.h"
1718 #include "llvm/MC/MCInstPrinter.h"
1819 #include "llvm/MC/MCSectionMachO.h"
1920 #include "llvm/MC/MCStreamer.h"
20 #include "llvm/MC/MCParser/AsmParser.h"
2121 #include "llvm/Target/TargetAsmBackend.h"
2222 #include "llvm/Target/TargetAsmParser.h"
2323 #include "llvm/Target/TargetData.h"
311311 Str.reset(createLoggingStreamer(Str.take(), errs()));
312312 }
313313
314 AsmParser Parser(*TheTarget, SrcMgr, Ctx, *Str.get(), *MAI);
315 OwningPtr<TargetAsmParser> TAP(TheTarget->createAsmParser(Parser));
314 OwningPtr<MCAsmParser> Parser(createMCAsmParser(*TheTarget, SrcMgr, Ctx,
315 *Str.get(), *MAI));
316 OwningPtr TAP(TheTarget->createAsmParser(*Parser));
316317 if (!TAP) {
317318 errs() << ProgName
318319 << ": error: this target does not support assembly parsing.\n";
319320 return 1;
320321 }
321322
322 Parser.setTargetParser(*TAP.get());
323
324 int Res = Parser.Run(NoInitialTextSection);
323 Parser->setTargetParser(*TAP.get());
324
325 int Res = Parser->Run(NoInitialTextSection);
325326 delete Out;
326327
327328 // Delete output on errors.