diff options
author | James Molloy <jmolloy@google.com> | 2019-09-04 12:54:24 +0000 |
---|---|---|
committer | James Molloy <jmolloy@google.com> | 2019-09-04 12:54:24 +0000 |
commit | fef9f59055792e98ca619284a1fae4bfc5f959ef (patch) | |
tree | 3cde3bbfe966101d3c197de3fcca659008eaaafe /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | 92e13f2eabebc60644d36283cc40d2433d035b6e (diff) | |
download | llvm-fef9f59055792e98ca619284a1fae4bfc5f959ef.zip llvm-fef9f59055792e98ca619284a1fae4bfc5f959ef.tar.gz llvm-fef9f59055792e98ca619284a1fae4bfc5f959ef.tar.bz2 |
[ModuloSchedule] Introduce PeelingModuloScheduleExpander
This is the beginnings of a reimplementation of ModuloScheduleExpander. It works
by generating a single-block correct pipelined kernel and then peeling out the
prolog and epilogs.
This patch implements kernel generation as well as a validator that will
confirm the number of phis added is the same as the ModuloScheduleExpander.
Prolog and epilog peeling will come in a different patch.
Differential Revision: https://reviews.llvm.org/D67081
llvm-svn: 370893
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index ff3d2fe..fc16ebf 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -160,6 +160,11 @@ static cl::opt<bool> EmitTestAnnotations( "with the generated schedule for feeding into the " "-modulo-schedule-test pass")); +static cl::opt<bool> ExperimentalCodeGen( + "pipeliner-experimental-cg", cl::Hidden, cl::init(false), + cl::desc( + "Use the experimental peeling code generator for software pipelining")); + namespace llvm { // A command line option to enable the CopyToPhi DAG mutation. @@ -549,8 +554,18 @@ void SwingSchedulerDAG::schedule() { MSTI.annotate(); return; } - ModuloScheduleExpander MSE(MF, MS, LIS, std::move(NewInstrChanges)); - MSE.expand(); + // The experimental code generator can't work if there are InstChanges. + if (ExperimentalCodeGen && NewInstrChanges.empty()) { + PeelingModuloScheduleExpander MSE(MF, MS, &LIS); + // Experimental code generation isn't complete yet, but it can partially + // validate the code it generates against the original + // ModuloScheduleExpander. + MSE.validateAgainstModuloScheduleExpander(); + } else { + ModuloScheduleExpander MSE(MF, MS, LIS, std::move(NewInstrChanges)); + MSE.expand(); + MSE.cleanup(); + } ++NumPipelined; } |