[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)
commit5772566ed66f8c4c09dcda81e96eb11a303b2140
tree6022c03d45da38c5cb6ec736c5b3e02582d76da8
parent409af508589990413231e9ac567db1289de1b18c
[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.

llvm-svn: 225117
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/test/CodeGen/PowerPC/code-align.ll