Skip to content

Commit

Permalink
conv:tomem: Make StripParamLValuesPass work on external function with…
Browse files Browse the repository at this point in the history
…out named parameters.
  • Loading branch information
xlauko committed Sep 18, 2024
1 parent 48e6057 commit c7bf438
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/vast/Conversion/ToMem/StripParamLValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ namespace vast::conv {
{
using base = ConversionPassMixin< StripParamLValuesPass, StripParamLValuesBase >;

static bool is_lvalue_type(mlir_value val) {
return !mlir::isa< hl::LValueType >(val.getType());
static bool is_not_lvalue_type(mlir_type ty) {
return !mlir::isa< hl::LValueType >(ty);
}

static conversion_target create_conversion_target(mcontext_t &mctx) {
conversion_target trg(mctx);

trg.markUnknownOpDynamicallyLegal([] (operation op) {
if (auto fn = mlir::dyn_cast< mlir::FunctionOpInterface >(op))
return rns::all_of(fn.getArguments(), is_lvalue_type);
if (auto fn = mlir::dyn_cast< mlir::FunctionOpInterface >(op)) {
auto fty = mlir::cast< core::FunctionType >(fn.getFunctionType());
return rns::all_of(fty.getInputs(), is_not_lvalue_type);
}
return true;
});

Expand Down

0 comments on commit c7bf438

Please sign in to comment.