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

Side by Side Diff: tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « tools/pnacl-bcanalyzer/Makefile ('k') | tools/pnacl-bccompress/CMakeLists.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===-- pnacl-bcanalyzer.cpp - Bitcode Analyzer -------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This tool is a thin wrapper over NaClBitcodeAnalyzer; see
11 // NaClBitcodeAnalyzer.h for more details.
12 //
13 // Invoke in the following manner:
14 //
15 // pnacl-bcanalyzer [options] - Read frozen PNaCl bitcode from stdin
16 // pnacl-bcanalyzer [options] x.bc - Read frozen PNaCl bitcode from the x.bc
17 // file
18 // Run with -help to see supported options.
19 //
20 //===----------------------------------------------------------------------===//
21
22 #define DEBUG_TYPE "pnacl-bcanalyzer"
23
24 #include "llvm/Bitcode/NaCl/NaClBitcodeAnalyzer.h"
25 #include "llvm/Support/CommandLine.h"
26 #include "llvm/Support/Debug.h"
27 #include "llvm/Support/ManagedStatic.h"
28 #include "llvm/Support/PrettyStackTrace.h"
29 #include "llvm/Support/Signals.h"
30 #include "llvm/Support/raw_ostream.h"
31 using namespace llvm;
32
33
34 static cl::opt<std::string>
35 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
36
37 static cl::opt<bool>
38 OptDumpRecords(
39 "dump-records",
40 cl::desc("Dump contents of records in bitcode, leaving out details, "
41 "instead of displaying record distributions."),
42 cl::init(false));
43
44 static cl::opt<bool>
45 OptDumpDetails(
46 "dump-details",
47 cl::desc("Include details when dumping contents of records in bitcode."),
48 cl::init(false));
49
50 static cl::opt<unsigned> OpsPerLine(
51 "operands-per-line",
52 cl::desc("Number of operands to print per dump line. 0 implies "
53 "all operands will be printed on the same line (default)"),
54 cl::init(0));
55
56 static cl::opt<bool> OrderBlocksByID(
57 "order-blocks-by-id",
58 cl::desc("Print blocks statistics based on block id rather than size"),
59 cl::init(false));
60
61 int main(int argc, char **argv) {
62 // Print a stack trace if we signal out.
63 sys::PrintStackTraceOnErrorSignal();
64 PrettyStackTraceProgram X(argc, argv);
65 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
66 cl::ParseCommandLineOptions(argc, argv, "pnacl-bcanalyzer file analyzer\n");
67
68 if (OptDumpDetails && !OptDumpRecords) {
69 errs() << "Can't dump details unless records are dumped!\n";
70 return 1;
71 }
72
73 AnalysisDumpOptions DumpOptions;
74 DumpOptions.DumpRecords = OptDumpRecords;
75 DumpOptions.DumpDetails = OptDumpDetails;
76 DumpOptions.OpsPerLine = OpsPerLine;
77 DumpOptions.OrderBlocksByID = OrderBlocksByID;
78
79 return AnalyzeBitcodeInFile(InputFilename, outs(), DumpOptions);
80 }
OLDNEW
« no previous file with comments | « tools/pnacl-bcanalyzer/Makefile ('k') | tools/pnacl-bccompress/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698