Skip to content

Commit c1a1378

Browse files
Move makeValueBinaryOpFromLocal to ValueExpr.*
1 parent cc9087c commit c1a1378

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/optimization/Combiner.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,12 +1127,6 @@ InstructionWalker optimizations::combineArithmeticOperations(
11271127
return it;
11281128
}
11291129

1130-
std::shared_ptr<ValueExpr> makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right)
1131-
{
1132-
return std::make_shared<ValueBinaryOp>(
1133-
std::make_shared<ValueTerm>(left), binOp, std::make_shared<ValueTerm>(right));
1134-
}
1135-
11361130
// try to convert shl to mul and return it as ValueExpr
11371131
std::shared_ptr<ValueExpr> shlToMul(Value& value, const intermediate::Operation* op)
11381132
{

src/optimization/ValueExpr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ std::string ValueBinaryOp::to_string() const
148148
return "(" + left->to_string() + " " + opStr + " " + right->to_string() + ")";
149149
}
150150

151+
std::shared_ptr<ValueExpr> optimizations::makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right)
152+
{
153+
return std::make_shared<ValueBinaryOp>(
154+
std::make_shared<ValueTerm>(left), binOp, std::make_shared<ValueTerm>(right));
155+
}
156+
151157
bool ValueTerm::operator==(const ValueExpr& other) const
152158
{
153159
if(auto otherTerm = dynamic_cast<const ValueTerm*>(&other))

src/optimization/ValueExpr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ namespace vc4c
7272
std::shared_ptr<ValueExpr> right;
7373
};
7474

75+
std::shared_ptr<ValueExpr> makeValueBinaryOpFromLocal(Value& left, ValueBinaryOp::BinaryOp binOp, Value& right);
76+
7577
class ValueTerm : public ValueExpr
7678
{
7779
public:

0 commit comments

Comments
 (0)