MachineCombiner Pass for selecting faster instruction
authorGerolf Hoflehner <ghoflehner@apple.com>
Sun, 3 Aug 2014 21:35:39 +0000 (21:35 +0000)
committerGerolf Hoflehner <ghoflehner@apple.com>
Sun, 3 Aug 2014 21:35:39 +0000 (21:35 +0000)
commit5e1207e54ca646fe0f6d58e655451380041a4886
tree4a3ccf77d24a3856878c39103aa07bb62311150f
parentf57d63f906e080417437dc42681c9e5ac02501a0
MachineCombiner Pass for selecting faster instruction
 sequence -  target independent framework

 When the DAGcombiner selects instruction sequences
 it could increase the critical path or resource len.

 For example, on arm64 there are multiply-accumulate instructions (madd,
 msub). If e.g. the equivalent  multiply-add sequence is not on the
 crictial path it makes sense to select it instead of  the combined,
 single accumulate instruction (madd/msub). The reason is that the
 conversion from add+mul to the madd could lengthen the critical path
 by the latency of the multiply.

 But the DAGCombiner would always combine and select the madd/msub
 instruction.

 This patch uses machine trace metrics to estimate critical path length
 and resource length of an original instruction sequence vs a combined
 instruction sequence and picks the faster code based on its estimates.

 This patch only commits the target independent framework that evaluates
 and selects code sequences. The machine instruction combiner is turned
 off for all targets and expected to evolve over time by gradually
 handling DAGCombiner pattern in the target specific code.

 This framework lays the groundwork for fixing
 rdar://16319955

llvm-svn: 214666
llvm/include/llvm/CodeGen/MachineCombinerPattern.h [new file with mode: 0644]
llvm/include/llvm/CodeGen/MachineTraceMetrics.h
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/CodeGen/TargetSchedule.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Target/TargetInstrInfo.h
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/CodeGen.cpp
llvm/lib/CodeGen/MachineCombiner.cpp [new file with mode: 0644]
llvm/lib/CodeGen/MachineTraceMetrics.cpp
llvm/lib/CodeGen/TargetSchedule.cpp