llvm-6502/test/CodeGen
Juergen Ributzka fb282c68b7 Add Constant Hoisting Pass
This pass identifies expensive constants to hoist and coalesces them to
better prepare it for SelectionDAG-based code generation. This works around the
limitations of the basic-block-at-a-time approach.

First it scans all instructions for integer constants and calculates its
cost. If the constant can be folded into the instruction (the cost is
TCC_Free) or the cost is just a simple operation (TCC_BASIC), then we don't
consider it expensive and leave it alone. This is the default behavior and
the default implementation of getIntImmCost will always return TCC_Free.

If the cost is more than TCC_BASIC, then the integer constant can't be folded
into the instruction and it might be beneficial to hoist the constant.
Similar constants are coalesced to reduce register pressure and
materialization code.

When a constant is hoisted, it is also hidden behind a bitcast to force it to
be live-out of the basic block. Otherwise the constant would be just
duplicated and each basic block would have its own copy in the SelectionDAG.
The SelectionDAG recognizes such constants as opaque and doesn't perform
certain transformations on them, which would create a new expensive constant.

This optimization is only applied to integer constants in instructions and
simple (this means not nested) constant cast experessions. For example:
%0 = load i64* inttoptr (i64 big_constant to i64*)

Reviewed by Eric

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200022 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-24 18:23:08 +00:00
..
AArch64 [AArch64 NEON] Fix a bug in implementing register copy bwtween FPR16. 2014-01-24 07:53:04 +00:00
ARM Add Constant Hoisting Pass 2014-01-24 18:23:08 +00:00
CPP Begin adding docs and IR-level support for the inalloca attribute 2013-12-19 02:14:12 +00:00
Generic Move test to x86 directory. 2014-01-23 19:32:19 +00:00
Hexagon Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
Inputs Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
Mips Fix known typos 2014-01-24 17:20:08 +00:00
MSP430 Fix known typos 2014-01-24 17:20:08 +00:00
NVPTX [NVPTX] Add missing patterns for div.approx with immediate denominator 2014-01-21 14:40:05 +00:00
PowerPC Fix pointer info on PPC byval stores 2014-01-21 20:15:58 +00:00
R600 R600: Disable the BFE pattern 2014-01-23 18:49:33 +00:00
SPARC Implement atomicrmw operations in 32 and 64 bits for SPARCv9. 2014-01-24 06:23:31 +00:00
SystemZ Fix known typos 2014-01-24 17:20:08 +00:00
Thumb CodeGen: Stop treating vectors as aggregates 2014-01-21 22:46:46 +00:00
Thumb2 [Thumbv8] Fix the value of BLXOperandIndex of isV8EligibleForIT 2014-01-23 19:55:33 +00:00
X86 Add Constant Hoisting Pass 2014-01-24 18:23:08 +00:00
XCore Fix broken CHECK lines. 2014-01-11 21:06:00 +00:00