OLD | NEW |
1 //===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===// | 1 //===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This utility is a simple driver that allows command line hacking on machine | 10 // This utility is a simple driver that allows command line hacking on machine |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 IP->setPrintImmHex(PrintImmHex); | 459 IP->setPrintImmHex(PrintImmHex); |
460 | 460 |
461 // Set up the AsmStreamer. | 461 // Set up the AsmStreamer. |
462 MCCodeEmitter *CE = nullptr; | 462 MCCodeEmitter *CE = nullptr; |
463 MCAsmBackend *MAB = nullptr; | 463 MCAsmBackend *MAB = nullptr; |
464 if (ShowEncoding || T.isOSNaCl()) { // @LOCALMOD | 464 if (ShowEncoding || T.isOSNaCl()) { // @LOCALMOD |
465 CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx); | 465 CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx); |
466 MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU); | 466 MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU); |
467 } | 467 } |
468 auto FOut = llvm::make_unique<formatted_raw_ostream>(*OS); | 468 auto FOut = llvm::make_unique<formatted_raw_ostream>(*OS); |
469 Str.reset(TheTarget->createAsmStreamer( | |
470 Ctx, std::move(FOut), /*asmverbose*/ true, | |
471 /*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst)); | |
472 | 469 |
| 470 if (T.isOSNaCl()) { |
| 471 Str.reset(TheTarget->createNaClAsmStreamer( |
| 472 Ctx, std::move(FOut), /*asmverbose*/ true, |
| 473 /*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst)); |
| 474 if (NoExecStack) |
| 475 Str->InitSections(true); |
| 476 |
| 477 Str->InitSections(NoExecStack); |
| 478 initializeNaClMCStreamer(*Str.get(), Ctx, T); |
| 479 } else { |
| 480 Str.reset(TheTarget->createAsmStreamer( |
| 481 Ctx, std::move(FOut), /*asmverbose*/ true, |
| 482 /*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst)); |
| 483 } |
473 } else if (FileType == OFT_Null) { | 484 } else if (FileType == OFT_Null) { |
474 Str.reset(TheTarget->createNullStreamer(Ctx)); | 485 Str.reset(TheTarget->createNullStreamer(Ctx)); |
475 } else { | 486 } else { |
476 assert(FileType == OFT_ObjectFile && "Invalid file type!"); | 487 assert(FileType == OFT_ObjectFile && "Invalid file type!"); |
477 | 488 |
478 if (!Out->os().supportsSeeking()) { | 489 if (!Out->os().supportsSeeking()) { |
479 BOS = make_unique<buffer_ostream>(Out->os()); | 490 BOS = make_unique<buffer_ostream>(Out->os()); |
480 OS = BOS.get(); | 491 OS = BOS.get(); |
481 } | 492 } |
482 | 493 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 break; | 528 break; |
518 } | 529 } |
519 if (disassemble) | 530 if (disassemble) |
520 Res = Disassembler::disassemble(*TheTarget, TripleName, *STI, *Str, | 531 Res = Disassembler::disassemble(*TheTarget, TripleName, *STI, *Str, |
521 *Buffer, SrcMgr, Out->os()); | 532 *Buffer, SrcMgr, Out->os()); |
522 | 533 |
523 // Keep output if no errors. | 534 // Keep output if no errors. |
524 if (Res == 0) Out->keep(); | 535 if (Res == 0) Out->keep(); |
525 return Res; | 536 return Res; |
526 } | 537 } |
OLD | NEW |