[enco] Introduce IndirectCopyElimination (#3055)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 8 Mar 2019 07:33:52 +0000 (16:33 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 8 Mar 2019 07:33:52 +0000 (16:33 +0900)
This commit introduces and uses IndirectCopyElimination pass in
compilation.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/Backend.cpp
contrib/enco/core/src/Transforms/IndirectCopyElimination.h

index f08af3e..4eddf50 100644 (file)
@@ -108,6 +108,7 @@ void BackendImpl::compile(coco::Module *m, coco::Data *d)
   pipeline.append(make_unique<IntrinsicSelectionPass>());
   // Insert data ordering if necessary
   pipeline.append(make_unique<DataLayoutConversionPass>());
+  pipeline.append(make_unique<IndirectCopyEliminationPass>());
 
   // Apply transforms in the pipeline
   for (uint32_t n = 0; n < pipeline.size(); ++n)
@@ -126,7 +127,6 @@ void BackendImpl::compile(coco::Module *m, coco::Data *d)
   // that share the same bag as their underlying bag
   assert(!has_inout_bag(code(sess)->module()));
 
-  eliminate_indirect_copy(code(sess));
   reduce_identical_object(code(sess));
   reduce_duplicated_object(code(sess));
 
index 453b163..acfdf56 100644 (file)
@@ -18,6 +18,7 @@
 #define __ENCO_TRANSFORM_INDIRECT_COPY_ELIMINATION_H__
 
 #include "Code.h"
+#include "Pass.h"
 
 namespace enco
 {
@@ -44,6 +45,16 @@ namespace enco
  */
 void eliminate_indirect_copy(enco::Code *code);
 
+struct IndirectCopyEliminationPass final : public enco::Pass
+{
+  PASS_CTOR(IndirectCopyEliminationPass)
+  {
+    // DO NOTHING
+  }
+
+  void run(const SessionID &sess) const override { eliminate_indirect_copy(code(sess)); }
+};
+
 } // namespace enco
 
 #endif // __ENCO_TRANSFORM_INDIRECT_COPY_ELIMINATION_H__