Commit 4bb50445 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Subroutine invocation needs to load memref arguments (classical types)



(similar to the classical extern kernel invocation)

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent e9e0624a
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1206,7 +1206,16 @@ antlrcpp::Any qasm3_expression_generator::visitExpressionTerminator(
        qasm3_expression_generator param_exp_generator(builder, symbol_table,
                                                       file_name);
        param_exp_generator.visit(expression);
        operands.push_back(param_exp_generator.current_value);
        auto arg = param_exp_generator.current_value;
        if (arg.getType().isa<mlir::MemRefType>()) {
          auto element_type =
              arg.getType().cast<mlir::MemRefType>().getElementType();
          if (!(element_type.isa<mlir::IntegerType>() &&
                element_type.getIntOrFloatBitWidth() == 1)) {
            arg = builder.create<mlir::LoadOp>(location, arg);
          }
        }
        operands.push_back(arg);
      }

      // Here we add all global variables