[flang] Add ability to have special allocator for descriptor data (#100690)
This patch enhances the descriptor with the ability to have specialized allocator. The allocators are registered in a dedicated registry and the index of the desired allocator is stored in the descriptor. The default allocator, std::malloc, is registered at index 0. In order to have this allocator index in the descriptor, the f18Addendum field is repurposed to be able to hold the presence flag for the addendum (lsb) and the allocator index. Since this is a change in the semantic and name of the 7th field of the descriptor, the CFI_VERSION is bumped to the date of the initial change. This patch only adds the ability to have this features as part of the descriptor but does not add specific allocator yet. CUDA fortran will be the first user of this feature to allocate descriptor data in the different type of device memory base on the CUDA attribute. --------- Co-authored-by: Slava Zakharin <szakharin@nvidia.com>
This commit is contained in:
parent
2177a1767b
commit
6df4e7c25f
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
/* 18.5.4 */
|
||||
#define CFI_VERSION 20180515
|
||||
#define CFI_VERSION 20240719
|
||||
|
||||
#define CFI_MAX_RANK 15
|
||||
typedef unsigned char CFI_rank_t;
|
||||
@ -146,7 +146,9 @@ extern "C++" template <typename T> struct FlexibleArray : T {
|
||||
CFI_rank_t rank; /* [0 .. CFI_MAX_RANK] */ \
|
||||
CFI_type_t type; \
|
||||
CFI_attribute_t attribute; \
|
||||
unsigned char f18Addendum;
|
||||
/* This encodes both the presence of the f18Addendum and the index of the \
|
||||
* allocator used to managed memory of the data hold by the descriptor. */ \
|
||||
unsigned char extra;
|
||||
|
||||
typedef struct CFI_cdesc_t {
|
||||
_CFI_CDESC_T_HEADER_MEMBERS
|
||||
|
@ -55,7 +55,7 @@ namespace fir {
|
||||
// <@type_desc_3, 20>, // rank
|
||||
// <@type_desc_3, 21>, // type
|
||||
// <@type_desc_3, 22>, // attribute
|
||||
// <@type_desc_3, 23>} // f18Addendum
|
||||
// <@type_desc_3, 23>} // extra
|
||||
// }
|
||||
// llvm.tbaa_type_desc @type_desc_5 {
|
||||
// id = "CFI_cdesc_t_dim1",
|
||||
@ -65,7 +65,7 @@ namespace fir {
|
||||
// <@type_desc_3, 20>, // rank
|
||||
// <@type_desc_3, 21>, // type
|
||||
// <@type_desc_3, 22>, // attribute
|
||||
// <@type_desc_3, 23>, // f18Addendum
|
||||
// <@type_desc_3, 23>, // extra
|
||||
// <@type_desc_3, 24>, // dim[0].lower_bound
|
||||
// <@type_desc_3, 32>, // dim[0].extent
|
||||
// <@type_desc_3, 40>} // dim[0].sm
|
||||
@ -78,7 +78,7 @@ namespace fir {
|
||||
// <@type_desc_3, 20>, // rank
|
||||
// <@type_desc_3, 21>, // type
|
||||
// <@type_desc_3, 22>, // attribute
|
||||
// <@type_desc_3, 23>, // f18Addendum
|
||||
// <@type_desc_3, 23>, // extra
|
||||
// <@type_desc_3, 24>, // dim[0].lower_bound
|
||||
// <@type_desc_3, 32>, // dim[0].extent
|
||||
// <@type_desc_3, 40>, // dim[0].sm
|
||||
|
@ -29,7 +29,7 @@ static constexpr unsigned kVersionPosInBox = 2;
|
||||
static constexpr unsigned kRankPosInBox = 3;
|
||||
static constexpr unsigned kTypePosInBox = 4;
|
||||
static constexpr unsigned kAttributePosInBox = 5;
|
||||
static constexpr unsigned kF18AddendumPosInBox = 6;
|
||||
static constexpr unsigned kExtraPosInBox = 6;
|
||||
static constexpr unsigned kDimsPosInBox = 7;
|
||||
static constexpr unsigned kOptTypePtrPosInBox = 8;
|
||||
static constexpr unsigned kOptRowTypePosInBox = 9;
|
||||
|
@ -92,8 +92,8 @@ private:
|
||||
// The storage for this object follows the last used dim[] entry in a
|
||||
// Descriptor (CFI_cdesc_t) generic descriptor. Space matters here, since
|
||||
// descriptors serve as POINTER and ALLOCATABLE components of derived type
|
||||
// instances. The presence of this structure is implied by the flag
|
||||
// CFI_cdesc_t.f18Addendum, and the number of elements in the len_[]
|
||||
// instances. The presence of this structure is encoded in the
|
||||
// CFI_cdesc_t.extra field, and the number of elements in the len_[]
|
||||
// array is determined by derivedType_->LenParameters().
|
||||
class DescriptorAddendum {
|
||||
public:
|
||||
@ -339,14 +339,14 @@ public:
|
||||
const SubscriptValue *, const int *permutation = nullptr) const;
|
||||
|
||||
RT_API_ATTRS DescriptorAddendum *Addendum() {
|
||||
if (raw_.f18Addendum != 0) {
|
||||
if (HasAddendum()) {
|
||||
return reinterpret_cast<DescriptorAddendum *>(&GetDimension(rank()));
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
RT_API_ATTRS const DescriptorAddendum *Addendum() const {
|
||||
if (raw_.f18Addendum != 0) {
|
||||
if (HasAddendum()) {
|
||||
return reinterpret_cast<const DescriptorAddendum *>(
|
||||
&GetDimension(rank()));
|
||||
} else {
|
||||
@ -420,6 +420,27 @@ public:
|
||||
|
||||
void Dump(FILE * = stdout) const;
|
||||
|
||||
// Value of the addendum presence flag.
|
||||
#define _CFI_ADDENDUM_FLAG 1
|
||||
// Number of bits needed to be shifted when manipulating the allocator index.
|
||||
#define _CFI_ALLOCATOR_IDX_SHIFT 1
|
||||
// Allocator index mask.
|
||||
#define _CFI_ALLOCATOR_IDX_MASK 0b00001110
|
||||
|
||||
RT_API_ATTRS inline bool HasAddendum() const {
|
||||
return raw_.extra & _CFI_ADDENDUM_FLAG;
|
||||
}
|
||||
RT_API_ATTRS inline void SetHasAddendum() {
|
||||
raw_.extra |= _CFI_ADDENDUM_FLAG;
|
||||
}
|
||||
RT_API_ATTRS inline int GetAllocIdx() const {
|
||||
return (raw_.extra & _CFI_ALLOCATOR_IDX_MASK) >> _CFI_ALLOCATOR_IDX_SHIFT;
|
||||
}
|
||||
RT_API_ATTRS inline void SetAllocIdx(int pos) {
|
||||
raw_.extra &= ~_CFI_ALLOCATOR_IDX_MASK; // Clear the allocator index bits.
|
||||
raw_.extra |= (pos << _CFI_ALLOCATOR_IDX_SHIFT);
|
||||
}
|
||||
|
||||
private:
|
||||
ISO::CFI_cdesc_t raw_;
|
||||
};
|
||||
|
@ -1241,9 +1241,10 @@ struct EmboxCommonConversion : public fir::FIROpConversion<OP> {
|
||||
descriptor =
|
||||
insertField(rewriter, loc, descriptor, {kAttributePosInBox},
|
||||
this->genI32Constant(loc, rewriter, getCFIAttr(boxTy)));
|
||||
|
||||
const bool hasAddendum = fir::boxHasAddendum(boxTy);
|
||||
descriptor =
|
||||
insertField(rewriter, loc, descriptor, {kF18AddendumPosInBox},
|
||||
insertField(rewriter, loc, descriptor, {kExtraPosInBox},
|
||||
this->genI32Constant(loc, rewriter, hasAddendum ? 1 : 0));
|
||||
|
||||
if (hasAddendum) {
|
||||
|
@ -177,7 +177,7 @@ bool LLVMTypeConverter::requiresExtendedDesc(mlir::Type boxElementType) const {
|
||||
// the addendum defined in descriptor.h.
|
||||
mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box,
|
||||
int rank) const {
|
||||
// (base_addr*, elem_len, version, rank, type, attribute, f18Addendum, [dim]
|
||||
// (base_addr*, elem_len, version, rank, type, attribute, extra, [dim]
|
||||
llvm::SmallVector<mlir::Type> dataDescFields;
|
||||
mlir::Type ele = box.getEleTy();
|
||||
// remove fir.heap/fir.ref/fir.ptr
|
||||
@ -206,9 +206,9 @@ mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box,
|
||||
// attribute
|
||||
dataDescFields.push_back(
|
||||
getDescFieldTypeModel<kAttributePosInBox>()(&getContext()));
|
||||
// f18Addendum
|
||||
// extra
|
||||
dataDescFields.push_back(
|
||||
getDescFieldTypeModel<kF18AddendumPosInBox>()(&getContext()));
|
||||
getDescFieldTypeModel<kExtraPosInBox>()(&getContext()));
|
||||
// [dims]
|
||||
if (rank == unknownRank()) {
|
||||
if (auto seqTy = mlir::dyn_cast<SequenceType>(ele))
|
||||
|
@ -107,6 +107,7 @@ add_subdirectory(Float128Math)
|
||||
|
||||
set(sources
|
||||
ISO_Fortran_binding.cpp
|
||||
allocator-registry.cpp
|
||||
allocatable.cpp
|
||||
array-constructor.cpp
|
||||
assign.cpp
|
||||
@ -178,6 +179,7 @@ include(AddFlangOffloadRuntime)
|
||||
set(supported_files
|
||||
ISO_Fortran_binding.cpp
|
||||
allocatable.cpp
|
||||
allocator-registry.cpp
|
||||
array-constructor.cpp
|
||||
assign.cpp
|
||||
buffer.cpp
|
||||
|
@ -86,7 +86,7 @@ static inline RT_API_ATTRS void EstablishDescriptor(CFI_cdesc_t *descriptor,
|
||||
descriptor->rank = rank;
|
||||
descriptor->type = type;
|
||||
descriptor->attribute = attribute;
|
||||
descriptor->f18Addendum = 0;
|
||||
descriptor->extra = 0;
|
||||
std::size_t byteSize{elem_len};
|
||||
constexpr std::size_t lower_bound{0};
|
||||
if (base_addr) {
|
||||
|
42
flang/runtime/allocator-registry.cpp
Normal file
42
flang/runtime/allocator-registry.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
//===-- runtime/allocator-registry.cpp ------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "allocator-registry.h"
|
||||
#include "terminator.h"
|
||||
|
||||
namespace Fortran::runtime {
|
||||
|
||||
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
|
||||
RT_OFFLOAD_VAR_GROUP_BEGIN
|
||||
RT_VAR_ATTRS AllocatorRegistry allocatorRegistry;
|
||||
RT_OFFLOAD_VAR_GROUP_END
|
||||
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
|
||||
|
||||
RT_OFFLOAD_API_GROUP_BEGIN
|
||||
RT_API_ATTRS void AllocatorRegistry::Register(int pos, Allocator_t allocator) {
|
||||
// pos 0 is reserved for the default allocator and is registered in the
|
||||
// struct ctor.
|
||||
INTERNAL_CHECK(pos > 0 && pos < MAX_ALLOCATOR);
|
||||
allocators[pos] = allocator;
|
||||
}
|
||||
|
||||
RT_API_ATTRS AllocFct AllocatorRegistry::GetAllocator(int pos) {
|
||||
INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR);
|
||||
AllocFct f{allocators[pos].alloc};
|
||||
INTERNAL_CHECK(f != nullptr);
|
||||
return f;
|
||||
}
|
||||
|
||||
RT_API_ATTRS FreeFct AllocatorRegistry::GetDeallocator(int pos) {
|
||||
INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR);
|
||||
FreeFct f{allocators[pos].free};
|
||||
INTERNAL_CHECK(f != nullptr);
|
||||
return f;
|
||||
}
|
||||
RT_OFFLOAD_API_GROUP_END
|
||||
} // namespace Fortran::runtime
|
55
flang/runtime/allocator-registry.h
Normal file
55
flang/runtime/allocator-registry.h
Normal file
@ -0,0 +1,55 @@
|
||||
//===-- runtime/allocator-registry.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef FORTRAN_RUNTIME_ALLOCATOR_H_
|
||||
#define FORTRAN_RUNTIME_ALLOCATOR_H_
|
||||
|
||||
#include "flang/Common/api-attrs.h"
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
#define MAX_ALLOCATOR 5
|
||||
|
||||
namespace Fortran::runtime {
|
||||
|
||||
using AllocFct = void *(*)(std::size_t);
|
||||
using FreeFct = void (*)(void *);
|
||||
|
||||
typedef struct Allocator_t {
|
||||
AllocFct alloc{nullptr};
|
||||
FreeFct free{nullptr};
|
||||
} Allocator_t;
|
||||
|
||||
#ifdef RT_DEVICE_COMPILATION
|
||||
static RT_API_ATTRS void *MallocWrapper(std::size_t size) {
|
||||
return std::malloc(size);
|
||||
}
|
||||
static RT_API_ATTRS void FreeWrapper(void *p) { return std::free(p); }
|
||||
#endif
|
||||
|
||||
struct AllocatorRegistry {
|
||||
#ifdef RT_DEVICE_COMPILATION
|
||||
RT_API_ATTRS constexpr AllocatorRegistry()
|
||||
: allocators{{&MallocWrapper, &FreeWrapper}} {}
|
||||
#else
|
||||
constexpr AllocatorRegistry() { allocators[0] = {&std::malloc, &std::free}; };
|
||||
#endif
|
||||
RT_API_ATTRS void Register(int, Allocator_t);
|
||||
RT_API_ATTRS AllocFct GetAllocator(int pos);
|
||||
RT_API_ATTRS FreeFct GetDeallocator(int pos);
|
||||
|
||||
Allocator_t allocators[MAX_ALLOCATOR];
|
||||
};
|
||||
|
||||
RT_OFFLOAD_VAR_GROUP_BEGIN
|
||||
extern RT_VAR_ATTRS AllocatorRegistry allocatorRegistry;
|
||||
RT_OFFLOAD_VAR_GROUP_END
|
||||
|
||||
} // namespace Fortran::runtime
|
||||
|
||||
#endif // FORTRAN_RUNTIME_ALLOCATOR_H_
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "flang/Runtime/descriptor.h"
|
||||
#include "ISO_Fortran_util.h"
|
||||
#include "allocator-registry.h"
|
||||
#include "derived.h"
|
||||
#include "memory.h"
|
||||
#include "stat.h"
|
||||
@ -50,7 +51,9 @@ RT_API_ATTRS void Descriptor::Establish(TypeCode t, std::size_t elementBytes,
|
||||
GetDimension(j).SetByteStride(0);
|
||||
}
|
||||
}
|
||||
raw_.f18Addendum = addendum;
|
||||
if (addendum) {
|
||||
SetHasAddendum();
|
||||
}
|
||||
DescriptorAddendum *a{Addendum()};
|
||||
RUNTIME_CHECK(terminator, addendum == (a != nullptr));
|
||||
if (a) {
|
||||
@ -162,7 +165,9 @@ RT_API_ATTRS int Descriptor::Allocate() {
|
||||
// Zero size allocation is possible in Fortran and the resulting
|
||||
// descriptor must be allocated/associated. Since std::malloc(0)
|
||||
// result is implementation defined, always allocate at least one byte.
|
||||
void *p{byteSize ? std::malloc(byteSize) : std::malloc(1)};
|
||||
|
||||
AllocFct alloc{allocatorRegistry.GetAllocator(GetAllocIdx())};
|
||||
void *p{alloc(byteSize ? byteSize : 1)};
|
||||
if (!p) {
|
||||
return CFI_ERROR_MEM_ALLOCATION;
|
||||
}
|
||||
@ -204,7 +209,8 @@ RT_API_ATTRS int Descriptor::Deallocate() {
|
||||
if (!descriptor.base_addr) {
|
||||
return CFI_ERROR_BASE_ADDR_NULL;
|
||||
} else {
|
||||
std::free(descriptor.base_addr);
|
||||
FreeFct free{allocatorRegistry.GetDeallocator(GetAllocIdx())};
|
||||
free(descriptor.base_addr);
|
||||
descriptor.base_addr = nullptr;
|
||||
return CFI_SUCCESS;
|
||||
}
|
||||
@ -290,7 +296,9 @@ void Descriptor::Dump(FILE *f) const {
|
||||
std::fprintf(f, " rank %d\n", static_cast<int>(raw_.rank));
|
||||
std::fprintf(f, " type %d\n", static_cast<int>(raw_.type));
|
||||
std::fprintf(f, " attribute %d\n", static_cast<int>(raw_.attribute));
|
||||
std::fprintf(f, " addendum %d\n", static_cast<int>(raw_.f18Addendum));
|
||||
std::fprintf(f, " extra %d\n", static_cast<int>(raw_.extra));
|
||||
std::fprintf(f, " addendum %d\n", static_cast<int>(HasAddendum()));
|
||||
std::fprintf(f, " alloc_idx %d\n", static_cast<int>(GetAllocIdx()));
|
||||
for (int j{0}; j < raw_.rank; ++j) {
|
||||
std::fprintf(f, " dim[%d] lower_bound %jd\n", j,
|
||||
static_cast<std::intmax_t>(raw_.dim[j].lower_bound));
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: tco -o - %s | FileCheck %s
|
||||
|
||||
// Global box initialization (test must come first because llvm globals are emitted first).
|
||||
// CHECK-LABEL: @globalx = internal global { ptr, i64, i32, i8, i8, i8, i8 } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 9, i8 2, i8 0 }
|
||||
// CHECK-LABEL: @globalx = internal global { ptr, i64, i32, i8, i8, i8, i8 } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 9, i8 2, i8 0 }
|
||||
fir.global internal @globalx : !fir.box<!fir.heap<i32>> {
|
||||
%c0 = arith.constant 0 : index
|
||||
%0 = fir.convert %c0 : (index) -> !fir.heap<i32>
|
||||
@ -9,7 +9,7 @@ fir.global internal @globalx : !fir.box<!fir.heap<i32>> {
|
||||
fir.has_value %1 : !fir.box<!fir.heap<i32>>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @globaly = internal global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 2, i8 0,{{.*}}[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]
|
||||
// CHECK-LABEL: @globaly = internal global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 2, i8 0,{{.*}}[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]
|
||||
fir.global internal @globaly : !fir.box<!fir.heap<!fir.array<?xf32>>> {
|
||||
%c0 = arith.constant 0 : index
|
||||
%0 = fir.convert %c0 : (index) -> !fir.heap<!fir.array<?xf32>>
|
||||
@ -27,7 +27,7 @@ func.func private @ga(%b : !fir.box<!fir.array<?xf32>>)
|
||||
// CHECK: (ptr %[[ARG:.*]])
|
||||
func.func @f(%a : !fir.ref<f32>) {
|
||||
// CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8 }
|
||||
// CHECK: %[[INS0:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 27, i8 0, i8 0 }, ptr %[[ARG]], 0
|
||||
// CHECK: %[[INS0:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 27, i8 0, i8 0 }, ptr %[[ARG]], 0
|
||||
// CHECK: store {{.*}} %[[INS0]], {{.*}} %[[DESC]]
|
||||
%b = fir.embox %a : (!fir.ref<f32>) -> !fir.box<f32>
|
||||
|
||||
@ -44,7 +44,7 @@ func.func @fa(%a : !fir.ref<!fir.array<100xf32>>) {
|
||||
%c1 = arith.constant 1 : index
|
||||
%c100 = arith.constant 100 : index
|
||||
%d = fir.shape %c100 : (index) -> !fir.shape<1>
|
||||
// CHECK: %[[INS70:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 0, i8 0, {{.*}} }, ptr %{{.*}}, 0
|
||||
// CHECK: %[[INS70:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 0, i8 0, {{.*}} }, ptr %{{.*}}, 0
|
||||
%b = fir.embox %c(%d) : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
|
||||
// CHECK: call void @ga(
|
||||
fir.call @ga(%b) : (!fir.box<!fir.array<?xf32>>) -> ()
|
||||
@ -58,7 +58,7 @@ func.func @fa(%a : !fir.ref<!fir.array<100xf32>>) {
|
||||
func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.char<1,?>> {
|
||||
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
|
||||
// CHECK: insertvalue {{.*}} undef, i64 %[[size]], 1
|
||||
// CHECK: insertvalue {{.*}} i32 20180515, 2
|
||||
// CHECK: insertvalue {{.*}} i32 20240719, 2
|
||||
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
|
||||
%x = fir.embox %arg0 typeparams %arg1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
|
||||
// CHECK: store {{.*}}, ptr %[[res]]
|
||||
@ -71,7 +71,7 @@ func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.
|
||||
// CHECK-SAME: ptr %[[arg0:.*]], i64 %[[arg1:.*]])
|
||||
func.func @b2(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,5>>>, %arg1 : index) -> !fir.box<!fir.array<?x!fir.char<1,5>>> {
|
||||
%1 = fir.shape %arg1 : (index) -> !fir.shape<1>
|
||||
// CHECK: insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), i32 20180515, i8 1, i8 40, i8 0, i8 0, {{.*}} }, i64 %[[arg1]], 7, 0, 1
|
||||
// CHECK: insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), i32 20240719, i8 1, i8 40, i8 0, i8 0, {{.*}} }, i64 %[[arg1]], 7, 0, 1
|
||||
// CHECK: insertvalue {{.*}} %{{.*}}, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), 7, 0, 2
|
||||
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
|
||||
%2 = fir.embox %arg0(%1) : (!fir.ref<!fir.array<?x!fir.char<1,5>>>, !fir.shape<1>) -> !fir.box<!fir.array<?x!fir.char<1,5>>>
|
||||
@ -86,7 +86,7 @@ func.func @b3(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,?>>>, %arg1 : index, %ar
|
||||
%1 = fir.shape %arg2 : (index) -> !fir.shape<1>
|
||||
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
|
||||
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
|
||||
// CHECK: insertvalue {{.*}} i32 20180515, 2
|
||||
// CHECK: insertvalue {{.*}} i32 20240719, 2
|
||||
// CHECK: insertvalue {{.*}} i64 %[[arg2]], 7, 0, 1
|
||||
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
|
||||
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
|
||||
@ -103,7 +103,7 @@ func.func @b4(%arg0 : !fir.ref<!fir.array<7x!fir.char<1,?>>>, %arg1 : index) ->
|
||||
%1 = fir.shape %c_7 : (index) -> !fir.shape<1>
|
||||
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
|
||||
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
|
||||
// CHECK: insertvalue {{.*}} i32 20180515, 2
|
||||
// CHECK: insertvalue {{.*}} i32 20240719, 2
|
||||
// CHECK: insertvalue {{.*}} i64 7, 7, 0, 1
|
||||
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
|
||||
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
|
||||
@ -147,7 +147,7 @@ func.func @box6(%0 : !fir.ref<!fir.array<?x?x?x?xf32>>, %1 : index, %2 : index)
|
||||
// CHECK: %[[sdp2:.*]] = sdiv i64 %[[dp2]], 2
|
||||
// CHECK: %[[cmp:.*]] = icmp sgt i64 %[[sdp2]], 0
|
||||
// CHECK: %[[extent:.*]] = select i1 %[[cmp]], i64 %[[sdp2]], i64 0
|
||||
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 2, i8 27, i8 0, i8 0, [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 undef, i64 undef], [3 x i64] undef] }, i64 %[[extent]], 7, 0, 1
|
||||
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 2, i8 27, i8 0, i8 0, [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 undef, i64 undef], [3 x i64] undef] }, i64 %[[extent]], 7, 0, 1
|
||||
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %{{.*}}, i64 mul (i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i64 200), 7, 0, 2
|
||||
// CHECK: %[[op25:.*]] = add i64 25000, %[[i100p40]]
|
||||
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %{{.*}}, i64 1, 7, 1, 0
|
||||
|
@ -1653,7 +1653,7 @@ func.func @embox0(%arg0: !fir.ref<!fir.array<100xi32>>) {
|
||||
// CHECK: %[[I64_ELEM_SIZE:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64
|
||||
// CHECK: %[[DESC:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
|
||||
// CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[I64_ELEM_SIZE]], %[[DESC]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
|
||||
// CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[CFI_VERSION]], %[[DESC0]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
|
||||
// CHECK: %[[RANK:.*]] = llvm.mlir.constant(0 : i32) : i32
|
||||
// CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8
|
||||
@ -1785,11 +1785,10 @@ func.func @embox1(%arg0: !fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) {
|
||||
// CHECK-NO-COMDAT: llvm.mlir.global linkonce constant @_QMtest_dinitE.dt.tseq() {addr_space = 0 : i32} : i8
|
||||
// CHECK-LABEL: llvm.func @embox1
|
||||
// CHECK: %[[TYPE_CODE:.*]] = llvm.mlir.constant(42 : i32) : i32
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %{{.*}} = llvm.insertvalue %[[VERSION]], %{{.*}}[2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[TYPE_CODE_I8:.*]] = llvm.trunc %[[TYPE_CODE]] : i32 to i8
|
||||
// CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_I8]], %{{.*}}[4] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>
|
||||
// CHECK: %[[F18ADDENDUM:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
// CHECK: %[[F18ADDENDUM_I8:.*]] = llvm.trunc %[[F18ADDENDUM]] : i32 to i8
|
||||
// CHECK: %{{.*}} = llvm.insertvalue %[[F18ADDENDUM_I8]], %{{.*}}[6] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>
|
||||
// CHECK: %[[TDESC:.*]] = llvm.mlir.addressof @_QMtest_dinitE.dt.tseq : !llvm.ptr
|
||||
// CHECK: %{{.*}} = llvm.insertvalue %[[TDESC]], %{{.*}}[7] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>
|
||||
|
||||
@ -1879,7 +1878,7 @@ func.func @xembox0(%arg0: !fir.ref<!fir.array<?xi32>>) {
|
||||
// CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64
|
||||
// CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
// CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8
|
||||
@ -1981,7 +1980,7 @@ func.func private @_QPxb(!fir.box<!fir.array<?x?xf64>>)
|
||||
// CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64
|
||||
// CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[RANK:.*]] = llvm.mlir.constant(2 : i32) : i32
|
||||
// CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8
|
||||
@ -2065,7 +2064,7 @@ func.func private @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>)
|
||||
// CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64
|
||||
// CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)>
|
||||
// CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
// CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8
|
||||
@ -2368,7 +2367,7 @@ func.func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
||||
//CHECK: %[[ELEM_SIZE_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64
|
||||
//CHECK: %[[RBOX:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
|
||||
//CHECK: %[[RBOX_TMP1:.*]] = llvm.insertvalue %[[ELEM_SIZE_I64]], %[[RBOX]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
|
||||
//CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
//CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
//CHECK: %[[RBOX_TMP2:.*]] = llvm.insertvalue %[[CFI_VERSION]], %[[RBOX_TMP1]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
|
||||
//CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
//CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8
|
||||
|
@ -46,7 +46,7 @@
|
||||
// CHECK: %[[VAL_36_BYTESIZE:.*]] = llvm.mul %[[VAL_35]], %[[VAL_31_LEN]] : i64
|
||||
// CHECK: %[[VAL_37:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_38:.*]] = llvm.insertvalue %[[VAL_36_BYTESIZE]], %[[VAL_37]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[VAL_40:.*]] = llvm.insertvalue %[[VAL_39]], %[[VAL_38]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_41:.*]] = llvm.mlir.constant(2 : i32) : i32
|
||||
// CHECK: %[[VAL_42:.*]] = llvm.trunc %[[VAL_41]] : i32 to i8
|
||||
@ -142,7 +142,7 @@ func.func @test_char4(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?x!fir.cha
|
||||
// CHECK: %[[VAL_36_BYTESIZE:.*]] = llvm.mul %[[VAL_35]], %[[VAL_16_BYTESIZE]] : i64
|
||||
// CHECK: %[[VAL_37:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_38:.*]] = llvm.insertvalue %[[VAL_36_BYTESIZE]], %[[VAL_37]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[VAL_40:.*]] = llvm.insertvalue %[[VAL_39]], %[[VAL_38]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
|
||||
// CHECK: %[[VAL_41:.*]] = llvm.mlir.constant(2 : i32) : i32
|
||||
// CHECK: %[[VAL_42:.*]] = llvm.trunc %[[VAL_41]] : i32 to i8
|
||||
|
@ -13,7 +13,7 @@ func.func @_QPtest_slice() {
|
||||
// CHECK: %[[a2:.*]] = alloca [20 x i32], i64 1, align 4
|
||||
// CHECK: %[[a3:.*]] = getelementptr [20 x i32], ptr %[[a2]], i64 0, i64 0
|
||||
// CHECK: %[[a4:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
|
||||
// CHECK: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]]
|
||||
// CHECK: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]]
|
||||
// CHECK: [i64 1, i64 5, i64 mul (i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i64 2)]] }, ptr %[[a3]], 0
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[a4]], ptr %[[a1]], align 8
|
||||
// CHECK: call void @_QPtest_callee(ptr %[[a1]])
|
||||
@ -40,7 +40,7 @@ func.func @_QPtest_dt_slice() {
|
||||
// CHECK: %[[a3:.*]] = alloca [20 x %_QFtest_dt_sliceTt], i64 1, align 8
|
||||
// CHECK: %[[a4:.*]] = getelementptr [20 x %_QFtest_dt_sliceTt], ptr %[[a3]], i64 0, i64 0, i32 0
|
||||
// CHECK: %[[a5:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
|
||||
// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]]
|
||||
// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]]
|
||||
// CHECK-SAME: [i64 1, i64 5, i64 mul
|
||||
// CHECK-SAME: (i64 ptrtoint (ptr getelementptr (%_QFtest_dt_sliceTt, ptr null, i32 1) to i64), i64 2)]] }
|
||||
// CHECK-SAME: , ptr %[[a4]], 0
|
||||
@ -75,7 +75,7 @@ func.func @emboxSubstring(%arg0: !fir.ref<!fir.array<2x3x!fir.char<1,4>>>) {
|
||||
%1 = fir.slice %c1, %c2, %c1, %c1, %c3, %c1 substr %c1_i64, %c2_i64 : (index, index, index, index, index, index, i64, i64) -> !fir.slice<2>
|
||||
%2 = fir.embox %arg0(%0) [%1] : (!fir.ref<!fir.array<2x3x!fir.char<1,4>>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box<!fir.array<?x?x!fir.char<1,?>>>
|
||||
// CHECK: %[[addr:.*]] = getelementptr [3 x [2 x [4 x i8]]], ptr %[[arg0]], i64 0, i64 0, i64 0, i64 1
|
||||
// CHECK: insertvalue {[[descriptorType:.*]]} { ptr undef, i64 mul (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 2), i32 20180515, i8 2, i8 40, i8 0, i8 0
|
||||
// CHECK: insertvalue {[[descriptorType:.*]]} { ptr undef, i64 mul (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 2), i32 20240719, i8 2, i8 40, i8 0, i8 0
|
||||
// CHECK-SAME: [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 2, i64 4], [3 x i64] [i64 1, i64 3, i64 8]] }
|
||||
// CHECK-SAME: ptr %[[addr]], 0
|
||||
|
||||
@ -98,7 +98,7 @@ func.func @fir_dev_issue_1416(%arg0: !fir.ref<!fir.array<40x?xf32>>, %low: index
|
||||
// CHECK: %[[offset:.*]] = add i64 %[[mul]], 0
|
||||
// CHECK: %[[addr:.*]] = getelementptr [40 x float], ptr %0, i64 %[[offset]], i64 0
|
||||
// CHECK: %[[box:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
|
||||
// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 0, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 40, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]] }, ptr %[[addr]], 0
|
||||
// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 0, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 40, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]] }, ptr %[[addr]], 0
|
||||
%3 = fir.embox %arg0(%1) [%2] : (!fir.ref<!fir.array<40x?xf32>>, !fir.shapeshift<2>, !fir.slice<2>) -> !fir.box<!fir.array<?xf32>>
|
||||
fir.call @do_something(%3) : (!fir.box<!fir.array<?xf32>>) -> ()
|
||||
return
|
||||
|
@ -18,5 +18,5 @@ func.func @test_embox(%addr: !fir.ref<!some_freestyle_type>) {
|
||||
// CHECK-SAME: ptr %[[ADDR:.*]])
|
||||
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
|
||||
// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (%some_not_mangled_type, ptr null, i32 1) to i64),
|
||||
// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 0, i8 1, ptr null, [1 x i64] zeroinitializer },
|
||||
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr null, [1 x i64] zeroinitializer },
|
||||
// CHECK-SAME: ptr %[[ADDR]], 0
|
||||
|
@ -13,7 +13,7 @@ func.func @_QMpolymorphic_testPtest_allocate_unlimited_polymorphic_non_derived()
|
||||
// CHECK-LABEL: define void @_QMpolymorphic_testPtest_allocate_unlimited_polymorphic_non_derived(){{.*}}{
|
||||
// CHECK: %[[MEM:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
|
||||
// CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, i64 1
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 0, i32 20180515, i8 0, i8 -1, i8 1, i8 1, ptr null, [1 x i64] zeroinitializer }, ptr %[[MEM]]
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 0, i32 20240719, i8 0, i8 -1, i8 1, i8 1, ptr null, [1 x i64] zeroinitializer }, ptr %[[MEM]]
|
||||
// CHECK: %[[LOADED:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[MEM]], align 8
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOADED]], ptr %[[DESC]]
|
||||
// CHECK: ret void
|
||||
@ -64,7 +64,7 @@ func.func @_QMpolymorphic_testPtest_embox() {
|
||||
|
||||
// CHECK-LABEL: @_QMpolymorphic_testPtest_embox()
|
||||
// CHECK: %[[ALLOCA_DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } { ptr @_QFEy, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, {{.*}}, ptr %[[ALLOCA_DESC]]
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } { ptr @_QFEy, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, {{.*}}, ptr %[[ALLOCA_DESC]]
|
||||
// CHECK: %[[LOADED_DESC:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %[[ALLOCA_DESC]], align 8
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } %[[LOADED_DESC]], ptr @_QFEx, align 8
|
||||
|
||||
@ -155,7 +155,7 @@ func.func @_QQmain() {
|
||||
// CHECK-LABEL: define void @_QQmain(){{.*}}{
|
||||
// CHECK: %[[CLASS_NONE:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
|
||||
// CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, i64 1
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1E.dt.t.2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1E.dt.t.2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8
|
||||
// CHECK: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[CLASS_NONE]]
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[DESC]]
|
||||
// CHECK: call void @_QMmod1Psub1(ptr %[[DESC]])
|
||||
@ -195,4 +195,4 @@ func.func @_QQembox_input_type(%arg0 : !fir.ref<!fir.type<_QMmod1Tp2{v:!fir.arra
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @_QQembox_input_type
|
||||
// CHECK: %{{.*}} = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr undef, i64 ptrtoint (ptr getelementptr (%_QMmod1Tp2, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 42, i8 0, i8 1, ptr @_QMmod1E.dt.p2, [1 x i64] zeroinitializer }, ptr %{{.*}}, 0
|
||||
// CHECK: %{{.*}} = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr undef, i64 ptrtoint (ptr getelementptr (%_QMmod1Tp2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr @_QMmod1E.dt.p2, [1 x i64] zeroinitializer }, ptr %{{.*}}, 0
|
||||
|
@ -20,4 +20,4 @@ fir.global @pointer_char4_init : !fir.box<!fir.ptr<!fir.char<4,10>>> {
|
||||
fir.has_value %2 : !fir.box<!fir.ptr<!fir.char<4,10>>>
|
||||
}
|
||||
// CHECK-LABEL: @pointer_char4_init
|
||||
// CHECK-SAME: { ptr @char4, i64 ptrtoint (ptr getelementptr ([10 x i32], ptr null, i32 1) to i64), i32 20180515, i8 0, i8 44, i8 1, i8 0 }
|
||||
// CHECK-SAME: { ptr @char4, i64 ptrtoint (ptr getelementptr ([10 x i32], ptr null, i32 1) to i64), i32 20240719, i8 0, i8 44, i8 1, i8 0 }
|
||||
|
@ -121,7 +121,7 @@ func.func @test_rebox_4(%arg0: !fir.box<!fir.array<?x!fir.char<1,?>>>) {
|
||||
// CHECK: %[[STRIDE:.*]] = load i64, ptr %[[STRIDE_GEP]]
|
||||
// CHECK: %[[BASE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %[[INPUT]], i32 0, i32 0
|
||||
// CHECK: %[[BASE:.*]] = load ptr, ptr %[[BASE_GEP]]
|
||||
// CHECK: %[[NEWBOX1:.*]] = insertvalue {{{.*}}} { ptr undef, i64 ptrtoint (ptr getelementptr ([10 x i8], ptr null, i32 1) to i64), i32 20180515, i8 1, i8 40, i8 1, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 undef, i64 undef]] }, i64 %[[EXTENT]], 7, 0, 1
|
||||
// CHECK: %[[NEWBOX1:.*]] = insertvalue {{{.*}}} { ptr undef, i64 ptrtoint (ptr getelementptr ([10 x i8], ptr null, i32 1) to i64), i32 20240719, i8 1, i8 40, i8 1, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 undef, i64 undef]] }, i64 %[[EXTENT]], 7, 0, 1
|
||||
// CHECK: %[[NEWBOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX1]], i64 %[[STRIDE]], 7, 0, 2
|
||||
// CHECK: %[[NEWBOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX2]], ptr %[[BASE]], 0
|
||||
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX3]], ptr %[[NEWBOX_STORAGE]]
|
||||
|
@ -54,7 +54,7 @@ module {
|
||||
// CHECK: %[[VAL_23:.*]] = llvm.load %[[VAL_22]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i32
|
||||
// CHECK: %[[VAL_24:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_25:.*]] = llvm.insertvalue %[[VAL_21]], %[[VAL_24]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_26:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VAL_26:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[VAL_27:.*]] = llvm.insertvalue %[[VAL_26]], %[[VAL_25]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_28:.*]] = llvm.mlir.constant(0 : i32) : i32
|
||||
// CHECK: %[[VAL_29:.*]] = llvm.trunc %[[VAL_28]] : i32 to i8
|
||||
@ -154,7 +154,7 @@ module {
|
||||
// CHECK: %[[VAL_27:.*]] = llvm.load %[[VAL_26]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr
|
||||
// CHECK: %[[VAL_28:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_29:.*]] = llvm.insertvalue %[[VAL_23]], %[[VAL_28]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_30:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VAL_30:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[VAL_31:.*]] = llvm.insertvalue %[[VAL_30]], %[[VAL_29]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_32:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
// CHECK: %[[VAL_33:.*]] = llvm.trunc %[[VAL_32]] : i32 to i8
|
||||
@ -206,7 +206,7 @@ module {
|
||||
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(-1 : i32) : i32
|
||||
// CHECK: %[[VAL_4:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_5:.*]] = llvm.insertvalue %[[VAL_2]], %[[VAL_4]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(20180515 : i32) : i32
|
||||
// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(20240719 : i32) : i32
|
||||
// CHECK: %[[VAL_7:.*]] = llvm.insertvalue %[[VAL_6]], %[[VAL_5]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>
|
||||
// CHECK: %[[VAL_8:.*]] = llvm.mlir.constant(1 : i32) : i32
|
||||
// CHECK: %[[VAL_9:.*]] = llvm.trunc %[[VAL_8]] : i32 to i8
|
||||
|
@ -14,7 +14,7 @@ fir.global internal @_QFfooEx : !fir.box<!fir.heap<!sometype>> {
|
||||
}
|
||||
// CHECK: @_QFfooEx = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
|
||||
// CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsometype, ptr null, i32 1) to i64),
|
||||
// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.sometype, [1 x i64] zeroinitializer }
|
||||
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.sometype, [1 x i64] zeroinitializer }
|
||||
|
||||
!some_pdt_type = !fir.type<_QFfooTsome_pdt_typeK42K43{num:i32,values:!fir.box<!fir.ptr<!fir.array<?x?xf32>>>}>
|
||||
fir.global internal @_QFfooE.dt.some_pdt_type.42.43 constant : i8
|
||||
@ -26,4 +26,4 @@ fir.global internal @_QFfooEx2 : !fir.box<!fir.heap<!some_pdt_type>> {
|
||||
}
|
||||
// CHECK: @_QFfooEx2 = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
|
||||
// CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsome_pdt_typeK42K43, ptr null, i32 1) to i64),
|
||||
// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.some_pdt_type.42.43, [1 x i64] zeroinitializer }
|
||||
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.some_pdt_type.42.43, [1 x i64] zeroinitializer }
|
||||
|
@ -643,7 +643,7 @@ end
|
||||
! LLVM: %[[TYPE_CODE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %{{.*}}, i32 0, i32 4
|
||||
! LLVM: %[[TYPE_CODE:.*]] = load i32, ptr %[[TYPE_CODE_GEP]]
|
||||
! LLVM: %[[BOX0:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } undef, i64 %[[ELE_SIZE]], 1
|
||||
! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20180515, 2
|
||||
! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20240719, 2
|
||||
! LLVM: %[[BOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX1]], i8 0, 3
|
||||
! LLVM: %[[TYPE_CODE_TRUNC:.*]] = trunc i32 %[[TYPE_CODE]] to i8
|
||||
! LLVM: %[[BOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX2]], i8 %[[TYPE_CODE_TRUNC]], 4
|
||||
@ -664,7 +664,7 @@ end
|
||||
! LLVM: %[[TYPE_CODE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %{{.*}}, i32 0, i32 4
|
||||
! LLVM: %[[TYPE_CODE:.*]] = load i32, ptr %[[TYPE_CODE_GEP]]
|
||||
! LLVM: %[[BOX0:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } undef, i64 %[[ELE_SIZE]], 1
|
||||
! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20180515, 2
|
||||
! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20240719, 2
|
||||
! LLVM: %[[BOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX1]], i8 0, 3
|
||||
! LLVM: %[[TYPE_CODE_TRUNC:.*]] = trunc i32 %[[TYPE_CODE]] to i8
|
||||
! LLVM: %[[BOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX2]], i8 %[[TYPE_CODE_TRUNC]], 4
|
||||
@ -681,7 +681,7 @@ end
|
||||
! allocatable.
|
||||
|
||||
! LLVM-LABEL: define void @_QMpolyPtest_deallocate()
|
||||
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyE.dt.p1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]]
|
||||
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyE.dt.p1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]]
|
||||
! LLVM: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[ALLOCA1]]
|
||||
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[ALLOCA2:[0-9]*]]
|
||||
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %[[ALLOCA2]], ptr @_QMpolyE.dt.p1, i32 0, i32 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user