Lines Matching full:constants
1 //===- ConstantHoisting.cpp - Prepare code for expensive constants --------===//
9 // This pass identifies expensive constants to hoist and coalesces them to
13 // First it scans all instructions for integer constants and calculates its
21 // Similar constants are coalesced to reduce register pressure and
27 // The SelectionDAG recognizes such constants as opaque and doesn't perform
30 // This optimization is only applied to integer constants in instructions and
45 #include "llvm/IR/Constants.h"
78 STATISTIC(NumConstantsHoisted, "Number of constants hoisted");
79 STATISTIC(NumConstantsRebased, "Number of constants rebased");
93 cl::desc("Do not rebase if number of dependent constants of a Base is less "
383 // Ignore cheap integer constants. in collectConstantCandidates()
501 /// Scan the instruction for expensive integer constants and record them
511 // The cost of materializing the constants (defined in in collectConstantCandidates()
522 /// Collect all integer constants in the function that cannot be folded
555 // From a list of constants, one needs to picked as the base and the other
556 // constants will be transformed into an offset from that base constant. The
557 // question is which we can pick best? For example, consider these constants
560 // Constants| 2 | 4 | 12 | 42 |
564 // offsets for constants 2 and 4 (i.e. -10 and -8 respectively). If negative
576 // constants, we fall back to the straightforward algorithm otherwise
593 LLVM_DEBUG(dbgs() << "== Maximize constants in range ==\n"); in maximizeConstantsInRange()
635 /// constants with respect to the base constant.
642 // Don't hoist constants that have only one use. in findAndMakeBaseConstant()
653 // Rebase the constants with respect to the base constant. in findAndMakeBaseConstant()
675 // Sort the constants by value and type. This invalidates the mapping! in findBaseConstants()
753 /// Emit materialization code for all rebased constants and update their
847 /// materialization code for derived constants.
865 // First, collect constants depending on this IP of the base. in emitBaseConstants()
882 // If only few constants depend on this IP of base, skip rebasing, in emitBaseConstants()
907 // Emit materialization code for rebased constants depending on this IP. in emitBaseConstants()
945 /// Optimize expensive integer constants in the given function.
963 // Combine constants that can be easily materialized with an add from a common in runImpl()
972 // constants. in runImpl()