From c1a1378f0dec71e2c32847e80677a73dec74fba9 Mon Sep 17 00:00:00 2001 From: long-long-float Date: Sun, 23 Aug 2020 16:52:11 +0900 Subject: [PATCH] Move makeValueBinaryOpFromLocal to ValueExpr.* --- src/optimization/Combiner.cpp | 6 ------ src/optimization/ValueExpr.cpp | 6 ++++++ src/optimization/ValueExpr.h | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/optimization/Combiner.cpp b/src/optimization/Combiner.cpp index 0d2a37de..46481fdd 100644 --- a/src/optimization/Combiner.cpp +++ b/src/optimization/Combiner.cpp @@ -1127,12 +1127,6 @@ InstructionWalker optimizations::combineArithmeticOperations( return it; } -std::shared_ptr makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right) -{ - return std::make_shared( - std::make_shared(left), binOp, std::make_shared(right)); -} - // try to convert shl to mul and return it as ValueExpr std::shared_ptr shlToMul(Value& value, const intermediate::Operation* op) { diff --git a/src/optimization/ValueExpr.cpp b/src/optimization/ValueExpr.cpp index 5e4058b6..f661710f 100644 --- a/src/optimization/ValueExpr.cpp +++ b/src/optimization/ValueExpr.cpp @@ -148,6 +148,12 @@ std::string ValueBinaryOp::to_string() const return "(" + left->to_string() + " " + opStr + " " + right->to_string() + ")"; } +std::shared_ptr optimizations::makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right) +{ + return std::make_shared( + std::make_shared(left), binOp, std::make_shared(right)); +} + bool ValueTerm::operator==(const ValueExpr& other) const { if(auto otherTerm = dynamic_cast(&other)) diff --git a/src/optimization/ValueExpr.h b/src/optimization/ValueExpr.h index 81499506..e1f2ce9d 100644 --- a/src/optimization/ValueExpr.h +++ b/src/optimization/ValueExpr.h @@ -72,6 +72,8 @@ namespace vc4c std::shared_ptr right; }; + std::shared_ptr makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right); + class ValueTerm : public ValueExpr { public: