[CodeGen] Generic Hardware Loop Support
authorSam Parker <sam.parker@arm.com>
Fri, 7 Jun 2019 07:35:30 +0000 (07:35 +0000)
committerSam Parker <sam.parker@arm.com>
Fri, 7 Jun 2019 07:35:30 +0000 (07:35 +0000)
commitc5ef502ee8160c37823d21e622b2575a5504e815
tree7e3f2f79313f58bfd1afd5c6ade9790feed72b12
parent04b418f2460153969ccf7e72a2ee90aad6c8fd35
[CodeGen] Generic Hardware Loop Support

Patch which introduces a target-independent framework for generating
hardware loops at the IR level. Most of the code has been taken from
PowerPC CTRLoops and PowerPC has been ported over to use this generic
pass. The target dependent parts have been moved into
TargetTransformInfo, via isHardwareLoopProfitable, with
HardwareLoopInfo introduced to transfer information from the backend.

Three generic intrinsics have been introduced:
- void @llvm.set_loop_iterations
  Takes as a single operand, the number of iterations to be executed.
- i1 @llvm.loop_decrement(anyint)
  Takes the maximum number of elements processed in an iteration of
  the loop body and subtracts this from the total count. Returns
  false when the loop should exit.
- anyint @llvm.loop_decrement_reg(anyint, anyint)
  Takes the number of elements remaining to be processed as well as
  the maximum numbe of elements processed in an iteration of the loop
  body. Returns the updated number of elements remaining.

llvm-svn: 362774
24 files changed:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/CodeGen.cpp
llvm/lib/CodeGen/HardwareLoops.cpp [new file with mode: 0644]
llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCInstr64Bit.td
llvm/lib/Target/PowerPC/PPCInstrInfo.td
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
llvm/test/CodeGen/PowerPC/ctrloop-intrin.ll
llvm/test/CodeGen/PowerPC/ppc-passname.ll
llvm/test/Transforms/HardwareLoops/scalar-while.ll [new file with mode: 0644]
llvm/test/Transforms/HardwareLoops/unscevable.ll [new file with mode: 0644]
llvm/tools/llc/llc.cpp
llvm/tools/opt/opt.cpp