[PowerPC/BlockPlacement] Allow target to provide a per-loop alignment preference
authorHal Finkel <hfinkel@anl.gov>
Sat, 3 Jan 2015 17:58:24 +0000 (17:58 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sat, 3 Jan 2015 17:58:24 +0000 (17:58 +0000)
commite05b232c20fb179d89acd469bea1cb6d1ea6c81f
tree62d425e93bf070626cb3d1412e291e4140af3213
parenta1d22cc78923d1450592a9e5823bbb68ee47786f
[PowerPC/BlockPlacement] Allow target to provide a per-loop alignment preference

The existing code provided for specifying a global loop alignment preference.
However, the preferred loop alignment might depend on the loop itself. For
recent POWER cores, loops between 5 and 8 instructions should have 32-byte
alignment (while the others are better with 16-byte alignment) so that the
entire loop will fit in one i-cache line.

To support this, getPrefLoopAlignment has been made virtual, and can be
provided with an optional MachineLoop* so the target can inspect the loop
before answering the query. The default behavior, as before, is to return the
value set with setPrefLoopAlignment. MachineBlockPlacement now queries the
target for each loop instead of only once per function. There should be no
functional change for other targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225117 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/MachineBlockPlacement.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
test/CodeGen/PowerPC/code-align.ll