Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ constexpr llvm::StringRef getOptionalAttrName() { return "fir.optional"; }
/// Attribute to mark Fortran entities with the TARGET attribute.
static constexpr llvm::StringRef getTargetAttrName() { return "fir.target"; }

/// Attribute to mark Fortran entities with the ASYNCHRONOUS attribute.
static constexpr llvm::StringRef getAsynchronousAttrName() {
return "fir.asynchronous";
}

/// Attribute to mark Fortran entities with the VOLATILE attribute.
static constexpr llvm::StringRef getVolatileAttrName() {
return "fir.volatile";
}

/// Attribute to mark that a function argument is a character dummy procedure.
/// Character dummy procedure have special ABI constraints.
static constexpr llvm::StringRef getCharacterProcedureDummyAttrName() {
Expand Down
6 changes: 5 additions & 1 deletion flang/lib/Lower/CallInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,12 @@ class Fortran::lower::CallInterfaceImpl {
addMLIRAttr(fir::getContiguousAttrName());
if (obj.attrs.test(Attrs::Value))
isValueAttr = true; // TODO: do we want an mlir::Attribute as well?
if (obj.attrs.test(Attrs::Volatile))
if (obj.attrs.test(Attrs::Volatile)) {
TODO(loc, "VOLATILE in procedure interface");
addMLIRAttr(fir::getVolatileAttrName());
}
if (obj.attrs.test(Attrs::Asynchronous))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you also update the comment on line 1110

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. I've updated and moved the comment.

addMLIRAttr(fir::getAsynchronousAttrName());
if (obj.attrs.test(Attrs::Target))
addMLIRAttr(fir::getTargetAttrName());
if (obj.cudaDataAttr)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/select-rank.f90
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ subroutine test_branching(x)
! CHECK: }

! CHECK-LABEL: func.func @_QPtest_rank_star_attributes(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>> {fir.bindc_name = "x", fir.optional, fir.target}) {
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>> {fir.asynchronous, fir.bindc_name = "x", fir.optional, fir.target}) {
! CHECK: %[[VAL_1:.*]] = fir.dummy_scope : !fir.dscope
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_1]] {fortran_attrs = #fir.var_attrs<asynchronous, optional, target>, uniq_name = "_QFtest_rank_star_attributesEx"} : (!fir.box<!fir.array<*:f32>>, !fir.dscope) -> (!fir.box<!fir.array<*:f32>>, !fir.box<!fir.array<*:f32>>)
! CHECK: %[[VAL_3:.*]] = arith.constant 2 : i8
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Lower/attributes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ subroutine foo2(x, i)
subroutine foo3(x)
real, optional, contiguous :: x(:)
end subroutine

! CHECK-LABEL: func @_QPfoo4
! CHECK-SAME: %arg0: !fir.ref<f32> {fir.bindc_name = "x", fir.target}
! CHECK-SAME: %arg1: !fir.ref<f32> {fir.asynchronous, fir.bindc_name = "y"}
subroutine foo4(x, y)
real, target :: x
real, asynchronous :: y
end subroutine
Loading