Skip to content

Commit

Permalink
pr: Add assign conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Jan 15, 2025
1 parent dfedda3 commit 19cbd7d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/vast/Conversion/Parser/ToParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,24 @@ namespace vast::conv {
}
};

struct AssignConversion
: one_to_one_conversion_pattern< hl::AssignOp, pr::Assign >
{
using op_t = hl::AssignOp;
using base = one_to_one_conversion_pattern< op_t, pr::Assign >;
using base::base;

using adaptor_t = typename op_t::Adaptor;

logical_result matchAndRewrite(
op_t op, adaptor_t adaptor, conversion_rewriter &rewriter
) const override {
auto args = realized_operand_values(adaptor.getOperands(), rewriter);
rewriter.replaceOpWithNewOp< pr::Assign >(op, std::vector< mlir_type >(), args);
return mlir::success();
}
};

struct ExprConversion
: parser_conversion_pattern_base< hl::ExprOp >
{
Expand Down Expand Up @@ -643,6 +661,7 @@ namespace vast::conv {
ToNoParse< hl::MulFOp >, ToNoParse< hl::DivFOp >,
ToNoParse< hl::RemFOp >,
// Other operations
AssignConversion,
ExprConversion,
FuncConversion,
ParamConversion,
Expand Down

0 comments on commit 19cbd7d

Please sign in to comment.