llvm.org GIT mirror llvm / a8a118b
Improve pass documentation and comments. Patch by Matthijs Kooijman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50861 91177308-0d34-0410-b5e6-96231b3b80d8 Gordon Henriksen 11 years ago
6 changed file(s) with 138 addition(s) and 104 deletion(s). Raw diff Collapse all Expand all
115115
-argpromotionPromote 'by reference' arguments to scalars
116116
-block-placementProfile Guided Basic Block Placement
117117
-break-crit-edgesBreak critical edges in CFG
118
-ceeCorrelated Expression Elimination
118
-codegenpreparePrepare a function for code generation
119119
-condpropConditional Propagation
120120
-constmergeMerge Duplicate Global Constants
121121
-constpropSimple constant propagation
141141
-internalizeInternalize Global Symbols
142142
-ipconstpropInterprocedural constant propagation
143143
-ipsccpInterprocedural Sparse Conditional Constant Propagation
144
-jump-threadingThread control through conditional blocks
144145
-lcssaLoop-Closed SSA Form Pass
145146
-licmLoop Invariant Code Motion
147
-loop-deletionDead Loop Deletion Pass
146148
-loop-extractExtract loops into new functions
147149
-loop-extract-singleExtract at most one loop into a new function
148150
-loop-index-splitIndex Split Loops
151153
-loop-unrollUnroll loops
152154
-loop-unswitchUnswitch loops
153155
-loopsimplifyCanonicalize natural loops
154
-lower-packedlowers packed operations to operations on smaller packed datatypes
155156
-lowerallocsLower allocations from instructions to calls
156
-lowergcLower GC intrinsics, for GCless code generators
157157
-lowerinvokeLower invoke and unwind, for unwindless code generators
158
-lowerselectLower select instructions to branches
159158
-lowersetjmpLower Set Jump
160159
-lowerswitchLower SwitchInst's to branches
161160
-mem2regPromote Memory to Register
161
-memcpyoptOptimize use of memcpy and friends
162162
-mergereturnUnify function exit nodes
163163
-predsimplifyPredicate Simplifier
164164
-prune-ehRemove unused exception handling info
170170
-simplify-libcallsSimplify well-known library calls
171171
-simplifycfgSimplify the CFG
172172
-stripStrip all symbols from a module
173
-strip-dead-prototypesRemove unused function declarations
174
-sretpromotionPromote sret arguments
173175
-tailcallelimTail Call Elimination
174176
-tailduplicateTail Duplication
175177
738740
739741
740742
741 Correlated Expression Elimination
742
743
744

Correlated Expression Elimination propagates information from conditional

745 branches to blocks dominated by destinations of the branch. It propagates
746 information from the condition check itself into the body of the branch,
747 allowing transformations like these for example:

748
749

                  
                
750 if (i == 7)
751 ... 4*i; // constant propagation
752
753 M = i+1; N = j+1;
754 if (i == j)
755 X = M-N; // = M-M == 0;
756
757
758

This is called Correlated Expression Elimination because we eliminate or

759 simplify expressions that are correlated with the direction of a branch. In
760 this way we use static information to give us some information about the
761 dynamic value of a variable.>
743 Prepare a function for code generation>
744
745
746 This pass munges the code in the input function to better prepare it for
747 SelectionDAG-based code generation. This works around limitations in it's
748 basic-block-at-a-time approach. It should eventually be removed.
762749
763750
764751
11771164

11781165 An interprocedural variant of Sparse Conditional Constant
11791166 Propagation.
1167

1168
1169
1170
1171
1172 Thread control through conditional blocks
1173
1174
1175

1176 Jump threading tries to find distinct threads of control flow running through
1177 a basic block. This pass looks at blocks that have multiple predecessors and
1178 multiple successors. If one or more of the predecessors of the block can be
1179 proven to always cause a jump to one of the successors, we forward the edge
1180 from the predecessor to the successor by duplicating the contents of this
1181 block.
1182

1183

1184 An example of when this can occur is code like this:
1185

1186
1187
                  
                
1188 >if () { ...
1189 X = 4;
1190 }
1191 if (X < 3) {
1192
1193

1194 In this case, the unconditional branch at the end of the first if can be
1195 revectored to the false side of the second if.
11801196

11811197
11821198
12451261 variable.
12461262
12471263
1264
1265
1266 Dead Loop Deletion Pass
1267
1268
1269

1270 This file implements the Dead Loop Deletion Pass. This pass is responsible
1271 for eliminating loops with non-infinite computable trip counts that have no
1272 side effects or volatile instructions, and do not contribute to the
1273 computation of the function's return value.
1274

1275
12481276
12491277
12501278
13891417
13901418
13911419
1392 lowers packed operations to operations on smaller packed datatypes
1393
1394
1395

1396 Lowers operations on vector datatypes into operations on more primitive vector
1397 datatypes, and finally to scalar operations.
1398

1399
1400
1401
1402
14031420 Lower allocations from instructions to calls
14041421
14051422
14121429 This is a target-dependent tranformation because it depends on the size of
14131430 data types and alignment constraints.
14141431

1415
1416
1417
1418
1419 Lower GC intrinsics, for GCless code generators
1420
1421
1422

1423 This file implements lowering for the llvm.gc* intrinsics for targets
1424 that do not natively support them (which includes the C backend). Note that
1425 the code generated is not as efficient as it would be for targets that
1426 natively support the GC intrinsics, but it is useful for getting new targets
1427 up-and-running quickly.
1428

1429
1430

1431 This pass implements the code transformation described in this paper:
1432

1433
1434

1435 "Accurate Garbage Collection in an Uncooperative Environment"
1436 Fergus Henderson, ISMM, 2002
1437

14381432
14391433
14401434
14751469 be done after the lowerinvoke pass has run (like generation of native code).
14761470 This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't
14771471 support the invoke instruction yet" lowering pass.
1478

1479
1480
1481
1482
1483 Lower select instructions to branches
1484
1485
1486

1487 Lowers select instructions into conditional branches for targets that do not
1488 have conditional moves or that have not implemented the select instruction
1489 yet.
1490

1491
1492

1493 Note that this pass could be improved. In particular it turns every select
1494 instruction into a new conditional branch, even though some common cases have
1495 select instructions on the same predicate next to each other. It would be
1496 better to use the same branch for the whole group of selects.
14971472

14981473
14991474
15561531
15571532
15581533
1534 Optimize use of memcpy and friend
1535
1536
1537

1538 This pass performs various transformations related to eliminating memcpy
1539 calls, or transforming sets of stores into memset's.
1540

1541
1542
1543
1544
15591545 Unify function exit nodes
15601546
15611547
17481734 only be used in situations where the strip utility would be used,
17491735 such as reducing code size or making it harder to reverse engineer code.
17501736

1737
1738
1739
1740
1741 Remove unused function declarations
1742
1743
1744

1745 This pass loops over all of the functions in the input module, looking for
1746 dead declarations and removes them. Dead declarations are declarations of
1747 functions for which no implementation is available (i.e., declarations for
1748 unused library functions).
1749

1750
1751
1752
1753
1754 Promote sret arguments
1755
1756
1757

1758 This pass finds functions that return a struct (using a pointer to the struct
1759 as the first argument of the function, marked with the 'sret' attribute) and
1760 replaces them with a new function that simply returns each of the elements of
1761 that struct (using multiple return values).
1762

1763
1764

1765 This pass works under a number of conditions:
1766

1767
1768
1769
  • The returned struct must not contain other structs
  • 1770
  • The returned struct must only be used to load values from
  • 1771
  • The placeholder struct passed in is the result of an alloca
  • 1772
    17511773
    17521774
    17531775
    None //===-- StripDeadPrototypes.cpp - Removed unused function declarations ----===//
    0 //===-- StripDeadPrototypes.cpp - Remove unused function declarations ----===//
    11 //
    22 // The LLVM Compiler Infrastructure
    33 //
    77 //===----------------------------------------------------------------------===//
    88 //
    99 // This pass loops over all of the functions in the input module, looking for
    10 // dead declarations and removes them.
    10 // dead declarations and removes them. Dead declarations are declarations of
    11 // functions for which no implementation is available (i.e., declarations for
    12 // unused library functions).
    1113 //
    1214 //===----------------------------------------------------------------------===//
    1315
    None //===-- StructRetPromotion.cpp - Promote sret arguments -000000------------===//
    0 //===-- StructRetPromotion.cpp - Promote sret arguments ------------------===//
    11 //
    22 // The LLVM Compiler Infrastructure
    33 //
    66 //
    77 //===----------------------------------------------------------------------===//
    88 //
    9 // TODO : Describe this pass.
    9 // This pass finds functions that return a struct (using a pointer to the struct
    10 // as the first argument of the function, marked with the 'sret' attribute) and
    11 // replaces them with a new function that simply returns each of the elements of
    12 // that struct (using multiple return values).
    13 //
    14 // This pass works under a number of conditions:
    15 // 1. The returned struct must not contain other structs
    16 // 2. The returned struct must only be used to load values from
    17 // 3. The placeholder struct passed in is the result of an alloca
    18 //
    1019 //===----------------------------------------------------------------------===//
    1120
    1221 #define DEBUG_TYPE "sretpromotion"
    77 //===----------------------------------------------------------------------===//
    88 //
    99 // This pass munges the code in the input function to better prepare it for
    10 // SelectionDAG-based code generation. This works around limitations in it's
    11 // basic-block-at-a-time approach. It should eventually be removed.
    10 // SelectionDAG-based code generation. This works around limitations in it's
    11 // basic-block-at-a-time approach. It should eventually be removed.
    1212 //
    1313 //===----------------------------------------------------------------------===//
    1414
    77 //===----------------------------------------------------------------------===//
    88 //
    99 // This file implements the Jump Threading pass.
    10 //
    11 // Jump threading tries to find distinct threads of control flow running through
    12 // a basic block. This pass looks at blocks that have multiple predecessors and
    13 // multiple successors. If one or more of the predecessors of the block can be
    14 // proven to always cause a jump to one of the successors, we forward the edge
    15 // from the predecessor to the successor by duplicating the contents of this
    16 // block.
    17 //
    18 // An example of when this can occur is code like this:
    19 //
    20 // if () { ...
    21 // X = 4;
    22 // }
    23 // if (X < 3) {
    24 //
    25 // In this case, the unconditional branch at the end of the first if can be
    26 // revectored to the false side of the second if.
    1027 //
    1128 //===----------------------------------------------------------------------===//
    1229
    3249 cl::init(6), cl::Hidden);
    3350
    3451 namespace {
    35 /// This pass performs 'jump threading', which looks at blocks that have
    36 /// multiple predecessors and multiple successors. If one or more of the
    37 /// predecessors of the block can be proven to always jump to one of the
    38 /// successors, we forward the edge from the predecessor to the successor by
    39 /// duplicating the contents of this block.
    40 ///
    41 /// An example of when this can occur is code like this:
    42 ///
    43 /// if () { ...
    44 /// X = 4;
    45 /// }
    46 /// if (X < 3) {
    47 ///
    48 /// In this case, the unconditional branch at the end of the first if can be
    49 /// revectored to the false side of the second if.
    50 ///
    5152 class VISIBILITY_HIDDEN JumpThreading : public FunctionPass {
    5253 public:
    5354 static char ID; // Pass identification
    66 //
    77 //===----------------------------------------------------------------------===//
    88 //
    9 // This file implements the Dead Loop Elimination Pass. This pass is
    10 // responsible for eliminating loops with non-infinite computable trip counts
    11 // that have no side effects or volatile instructions, and do not contribute
    12 // to the computation of the function's return value.
    9 // This file implements the Dead Loop Deletion Pass. This pass is responsible
    10 // for eliminating loops with non-infinite computable trip counts that have no
    11 // side effects or volatile instructions, and do not contribute to the
    12 // computation of the function's return value.
    1313 //
    1414 //===----------------------------------------------------------------------===//
    1515