Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1642)

Side by Side Diff: src/llvm2ice.cpp

Issue 277033003: Modify pnacl subzero to be able to read pnacl bitcode files. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pydir/utils.py ('k') | szdiff.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
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 file defines a driver that uses LLVM capabilities to parse a 10 // This file defines a driver that uses LLVM capabilities to parse a
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), 570 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"),
571 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), 571 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"),
572 clEnumValN(Ice::IceV_RegManager, "rmgr", "Register manager status"), 572 clEnumValN(Ice::IceV_RegManager, "rmgr", "Register manager status"),
573 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), 573 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"),
574 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), 574 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"),
575 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), 575 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"),
576 clEnumValN(Ice::IceV_Timing, "time", "Pass timing details"), 576 clEnumValN(Ice::IceV_Timing, "time", "Pass timing details"),
577 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), 577 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"),
578 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); 578 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd));
579 static cl::opt<std::string> IRFilename(cl::Positional, cl::desc("<IR file>"), 579 static cl::opt<std::string> IRFilename(cl::Positional, cl::desc("<IR file>"),
580 cl::Required); 580 cl::init("-"));
581 static cl::opt<std::string> OutputFilename("o", 581 static cl::opt<std::string> OutputFilename("o",
582 cl::desc("Override output filename"), 582 cl::desc("Override output filename"),
583 cl::init("-"), 583 cl::init("-"),
584 cl::value_desc("filename")); 584 cl::value_desc("filename"));
585 static cl::opt<std::string> 585 static cl::opt<std::string>
586 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"), 586 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"),
587 cl::init(""), cl::value_desc("prefix")); 587 cl::init(""), cl::value_desc("prefix"));
588 static cl::opt<bool> 588 static cl::opt<bool>
589 DisableInternal("external", 589 DisableInternal("external",
590 cl::desc("Disable 'internal' linkage type for testing")); 590 cl::desc("Disable 'internal' linkage type for testing"));
591 static cl::opt<bool> 591 static cl::opt<bool>
592 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); 592 DisableTranslation("notranslate", cl::desc("Disable Subzero translation"));
593 593
594 static cl::opt<bool> SubzeroTimingEnabled( 594 static cl::opt<bool> SubzeroTimingEnabled(
595 "timing", cl::desc("Enable breakdown timing of Subzero translation")); 595 "timing", cl::desc("Enable breakdown timing of Subzero translation"));
596 596
597 static cl::opt<NaClFileFormat>
598 InputFileFormat(
599 "bitcode-format",
600 cl::desc("Define format of input file:"),
601 cl::values(
602 clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"),
603 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"),
604 clEnumValEnd),
605 cl::init(LLVMFormat));
606
597 int main(int argc, char **argv) { 607 int main(int argc, char **argv) {
598 cl::ParseCommandLineOptions(argc, argv); 608 cl::ParseCommandLineOptions(argc, argv);
599 609
600 // Parse the input LLVM IR file into a module. 610 // Parse the input LLVM IR file into a module.
601 SMDiagnostic Err; 611 SMDiagnostic Err;
602 Module *Mod; 612 Module *Mod;
603 613
604 { 614 {
605 Ice::Timer T; 615 Ice::Timer T;
606 Mod = ParseIRFile(IRFilename, Err, getGlobalContext()); 616 Mod = NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext());
607 617
608 if (SubzeroTimingEnabled) { 618 if (SubzeroTimingEnabled) {
609 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() 619 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec()
610 << " sec\n"; 620 << " sec\n";
611 } 621 }
612 } 622 }
613 623
614 if (!Mod) { 624 if (!Mod) {
615 Err.print(argv[0], errs()); 625 Err.print(argv[0], errs());
616 return 1; 626 return 1;
(...skipping 29 matching lines...) Expand all
646 << " sec\n"; 656 << " sec\n";
647 } 657 }
648 658
649 if (DisableTranslation) { 659 if (DisableTranslation) {
650 Func->dump(); 660 Func->dump();
651 } 661 }
652 } 662 }
653 663
654 return 0; 664 return 0;
655 } 665 }
OLDNEW
« no previous file with comments | « pydir/utils.py ('k') | szdiff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698