llvm.org GIT mirror llvm / 3ee8fc9
Rationalize the names of passes that print information: -callgraph => print-callgraph -callscc => print-callgraph-sccs -cfgscc => print-cfg-sccs -externalfnconstants => print-externalfnconstants -print => print-function -print-alias-sets (no change) -print-callgraph => dot-callgraph -print-cfg => dot-cfg -print-cfg-only => dot-cfg-only -print-dom-info (no change) -printm => print-module -printusedtypes => print-used-types git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56487 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 11 years ago
14 changed file(s) with 126 addition(s) and 122 deletion(s). Raw diff Collapse all Expand all
7878
-basicaaBasic Alias Analysis (default AA impl)
7979
-basiccgBasic CallGraph Construction
8080
-basicvnBasic Value Numbering (default GVN impl)
81
-callgraphPrint a call graph
82
-callsccPrint SCCs of the Call Graph
83
-cfgsccPrint SCCs of each function CFG
8481
-codegenprepareOptimize for code generation
8582
-count-aaCount Alias Analysis Query Responses
8683
-debug-aaAA use debugger
8784
-domfrontierDominance Frontier Construction
8885
-domtreeDominator Tree Construction
89
-externalfnconstantsPrint external fn callsites passed constants
86
-dot-callgraphPrint Call Graph to 'dot' file
87
-dot-cfgPrint CFG of function to 'dot' file
88
-dot-cfg-onlyPrint CFG of function to 'dot' file (with no function bodies)
9089
-globalsmodref-aaSimple mod/ref analysis for globals
9190
-instcountCounts the various types of Instructions
9291
-intervalsInterval Partition Construction
9796
-no-profileNo Profile Information
9897
-postdomfrontierPost-Dominance Frontier Construction
9998
-postdomtreePost-Dominator Tree Construction
100
-printPrint function to stderr
10199
-print-alias-setsAlias Set Printer
102
-print-callgraphPrint Call Graph to 'dot' file
103
-print-cfgPrint CFG of function to 'dot' file
104
-print-cfg-onlyPrint CFG of function to 'dot' file (with no function bodies)
105
-printmPrint module to stderr
106
-printusedtypesFind Used Types
100
-print-callgraphPrint a call graph
101
-print-callgraph-sccsPrint SCCs of the Call Graph
102
-print-cfg-sccsPrint SCCs of each function CFG
103
-print-externalfnconstantsPrint external fn callsites passed constants
104
-print-functionPrint function to stderr
105
-print-modulePrint module to stderr
106
-print-used-typesFind Used Types
107107
-profile-loaderLoad profile information from llvmprof.out
108108
-scalar-evolutionScalar Evolution Analysis
109109
-targetdataTarget Data Layout
316316
317317
318318
319 Print a call graph
320
321
322

323 This pass, only available in opt, prints the call graph to
324 standard output in a human-readable form.
325

326
327
328
329
330 Print SCCs of the Call Graph
331
332
333

334 This pass, only available in opt, prints the SCCs of the call
335 graph to standard output in a human-readable form.
336

337
338
339
340
341 Print SCCs of each function CFG
342
343
344

345 This pass, only available in opt, prints the SCCs of each
346 function CFG to standard output in a human-readable form.
347

348
349
350
351
352319 Optimize for code generation
353320
354321
411378
412379
413380
414 Print external fn callsites passed constants
415
416
417

418 This pass, only available in opt, prints out call sites to
419 external functions that are called with constant arguments. This can be
420 useful when looking for standard library functions we should constant fold
421 or handle in alias analyses.
381 Print Call Graph to 'dot' file
382
383
384

385 This pass, only available in opt, prints the call graph into a
386 .dot graph. This graph can then be processed with the "dot" tool
387 to convert it to postscript or some other suitable format.
388

389
390
391
392
393 Print CFG of function to 'dot' file
394
395
396

397 This pass, only available in opt, prints the control flow graph
398 into a .dot graph. This graph can then be processed with the
399 "dot" tool to convert it to postscript or some other suitable format.
400

401
402
403
404
405 Print CFG of function to 'dot' file (with no function bodies)
406
407
408

409 This pass, only available in opt, prints the control flow graph
410 into a .dot graph, omitting the function bodies. This graph can
411 then be processed with the "dot" tool to convert it to postscript or some
412 other suitable format.
422413

423414
424415
556547
557548
558549
559 Print function to stderr
550 Alias Set Printer
551
552
553

Yet to be written.

554
555
556
557
558 Print a call graph
559
560
561

562 This pass, only available in opt, prints the call graph to
563 standard output in a human-readable form.
564

565
566
567
568
569 Print SCCs of the Call Graph
570
571
572

573 This pass, only available in opt, prints the SCCs of the call
574 graph to standard output in a human-readable form.
575

576
577
578
579
580 Print SCCs of each function CFG
581
582
583

584 This pass, only available in opt, prints the SCCs of each
585 function CFG to standard output in a human-readable form.
586

587
588
589
590
591 Print external fn callsites passed constants
592
593
594

595 This pass, only available in opt, prints out call sites to
596 external functions that are called with constant arguments. This can be
597 useful when looking for standard library functions we should constant fold
598 or handle in alias analyses.
599

600
601
602
603
604 Print function to stderr
560605
561606
562607

568613
569614
570615
571 Alias Set Printer
572
573
574

Yet to be written.

575
576
577
578
579 Print Call Graph to 'dot' file
580
581
582

583 This pass, only available in opt, prints the call graph into a
584 .dot graph. This graph can then be processed with the "dot" tool
585 to convert it to postscript or some other suitable format.
586

587
588
589
590
591 Print CFG of function to 'dot' file
592
593
594

595 This pass, only available in opt, prints the control flow graph
596 into a .dot graph. This graph can then be processed with the
597 "dot" tool to convert it to postscript or some other suitable format.
598

599
600
601
602
603 Print CFG of function to 'dot' file (with no function bodies)
604
605
606

607 This pass, only available in opt, prints the control flow graph
608 into a .dot graph, omitting the function bodies. This graph can
609 then be processed with the "dot" tool to convert it to postscript or some
610 other suitable format.
611

612
613
614
615
616 Print module to stderr
616 Print module to stderr
617617
618618
619619

623623
624624
625625
626 Find Used Types
626 Find Used Types
627627
628628
629629

66 //
77 //===----------------------------------------------------------------------===//
88 //
9 // This file defines a '-print-cfg' analysis pass, which emits the
9 // This file defines a '-dot-cfg' analysis pass, which emits the
1010 // cfg..dot file for each function in the program, with a graph of the
1111 // CFG for that function.
1212 //
164164
165165 char CFGPrinter::ID = 0;
166166 static RegisterPass
167 P1("print-cfg", "Print CFG of function to 'dot' file", false, true);
167 P1("dot-cfg", "Print CFG of function to 'dot' file", false, true);
168168
169169 namespace {
170170 struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
187187
188188 char CFGOnlyPrinter::ID = 0;
189189 static RegisterPass
190 P2("print-cfg-only",
190 P2("dot-cfg-only",
191191 "Print CFG of function to 'dot' file (with no function bodies)", false, true);
192192
193193 /// viewCFG - This function is meant for use from the debugger. You can just
2222
2323 char FindUsedTypes::ID = 0;
2424 static RegisterPass
25 X("printusedtypes", "Find Used Types", false, true);
25 X("print-used-types", "Find Used Types", false, true);
2626
2727 // IncorporateType - Incorporate one type and all of its subtypes into the
2828 // collection of used types.
4040
4141 char PrintModulePass::ID = 0;
4242 static RegisterPass
43 X("printm", "Print module to stderr");
43 X("print-module", "Print module to stderr");
4444 char PrintFunctionPass::ID = 0;
4545 static RegisterPass
46 Y("print","Print function to stderr");
46 Y("print-function","Print function to stderr");
4747
4848
4949 //===----------------------------------------------------------------------===//
None ; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function 'callee'} | count 2
0 ; RUN: llvm-as < %s | opt -print-callgraph -disable-output |& \
1 ; RUN: grep {Calls function 'callee'} | count 2
12
23 define internal void @callee(...) {
34 entry:
None ; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function}
0 ; RUN: llvm-as < %s | opt -print-callgraph -disable-output |& \
1 ; RUN: grep {Calls function}
12
23 @a = global void ()* @f ; [#uses=0]
34
0 ; Call graph construction crash: Not handling indirect calls right
11 ;
2 ; RUN: llvm-as < %s | opt -analyze -callgraph >& /dev/null
2 ; RUN: llvm-as < %s | opt -analyze -print-callgraph >& /dev/null
33 ;
44
55 %FunTy = type i32 (i32)
None ;RUN: llvm-as < %s | opt -analyze -print-cfg-only -disable-output 2>/dev/null
0 ;RUN: llvm-as < %s | opt -analyze -dot-cfg-only -disable-output 2>/dev/null
11 ;PR 1497
22
33 define void @foo() {
None ; RUN: llvm-as < %s | opt -block-placement -disable-output -print 2> /dev/null
0 ; RUN: llvm-as < %s | opt -block-placement -disable-output -print-function 2> /dev/null
11
22 define i32 @test() {
33 br i1 true, label %X, label %Y
None ; RUN: llvm-as < %s | opt -inline -disable-output -print 2> /dev/null
0 ; RUN: llvm-as < %s | opt -inline -disable-output -print-function 2> /dev/null
11
22 define i32 @func(i32 %i) {
33 ret i32 %i
None ; RUN: llvm-as < %s | opt -prune-eh -inline -callgraph -disable-output |& \
1 ; RUN: grep {Calls.*ce3806g__fxio__put__put_int64__4.1339} | count 2
0 ; RUN: llvm-as < %s | opt -prune-eh -inline -print-callgraph \
1 ; RUN: -disable-output |& \
2 ; RUN: grep {Calls.*ce3806g__fxio__put__put_int64__4.1339} | count 2
23 %struct.FRAME.ce3806g = type { %struct.string___XUB, %struct.string___XUB, %struct.string___XUB, %struct.string___XUB }
34 %struct.FRAME.ce3806g__fxio__put__4 = type { i32, i32, i32, %struct.system__file_control_block__pstring*, i32, i32, i8 }
45 %struct.RETURN = type { i8, i32 }
6464
6565 char ExternalFunctionsPassedConstants::ID = 0;
6666 RegisterPass
67 P1("externalfnconstants", "Print external fn callsites passed constants");
67 P1("print-externalfnconstants",
68 "Print external fn callsites passed constants");
6869
6970 struct CallGraphPrinter : public ModulePass {
7071 static char ID; // Pass ID, replacement for typeid
8283
8384 char CallGraphPrinter::ID = 0;
8485 RegisterPass
85 P2("callgraph", "Print a call graph");
86 P2("print-callgraph", "Print a call graph");
8687 }
7878 };
7979
8080 char CallGraphPrinter::ID = 0;
81 RegisterPass P2("print-callgraph",
81 RegisterPass P2("dot-callgraph",
8282 "Print Call Graph to 'dot' file");
8383 }
8484
1313 //
1414 // (1) As a reference for how to use the scc_iterator.
1515 // (2) To print out the SCCs for a CFG or a CallGraph:
16 // analyze -cfgscc to print the SCCs in each CFG of a module.
17 // analyze -cfgscc -stats to print the #SCCs and the maximum SCC size.
18 // analyze -cfgscc -debug > /dev/null to watch the algorithm in action.
16 // analyze -print-cfg-sccs to print the SCCs in each CFG of a module.
17 // analyze -print-cfg-sccs -stats to print the #SCCs and the maximum SCC size.
18 // analyze -print-cfg-sccs -debug > /dev/null to watch the algorithm in action.
1919 //
2020 // and similarly:
21 // analyze -callscc [-stats] [-debug] to print SCCs in the CallGraph
21 // analyze -print-callgraph-sccs [-stats] [-debug] to print SCCs in the CallGraph
2222 //
2323 // (3) To test the scc_iterator.
2424 //
6363
6464 char CFGSCC::ID = 0;
6565 RegisterPass
66 Y("cfgscc", "Print SCCs of each function CFG");
66 Y("print-cfg-sccs", "Print SCCs of each function CFG");
6767
6868 char CallGraphSCC::ID = 0;
6969 RegisterPass
70 Z("callscc", "Print SCCs of the Call Graph");
70 Z("print-callgraph-sccs", "Print SCCs of the Call Graph");
7171 }
7272
7373 bool CFGSCC::runOnFunction(Function &F) {