OSDN Git Service

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)
commitb0b708854ec3cd8047b4659d2ef881bc7d1b582c
tree8277d400f43dc808d6be115068f1d4e408c819f6
parent83eaeba2a89c07fd445760d2bd7221b150550f52
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214666 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/MachineCombinerPattern.h [new file with mode: 0644]
include/llvm/CodeGen/MachineTraceMetrics.h
include/llvm/CodeGen/Passes.h
include/llvm/CodeGen/TargetSchedule.h
include/llvm/InitializePasses.h
include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/CMakeLists.txt
lib/CodeGen/CodeGen.cpp
lib/CodeGen/MachineCombiner.cpp [new file with mode: 0644]
lib/CodeGen/MachineTraceMetrics.cpp
lib/CodeGen/TargetSchedule.cpp