[flang-commits] [flang] [flang][debug] Support derived type components with box types. (PR #109424)

Paul Osmialowski via flang-commits flang-commits at lists.llvm.org
Mon Sep 23 05:16:04 PDT 2024


================
@@ -0,0 +1,39 @@
+//===-- DescriptorOffsets.h -- offsets of descriptors fields ---*- 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 OPTIMIZER_DESCRIPTOR_OFFSETS_H
+#define OPTIMIZER_DESCRIPTOR_OFFSETS_H
+
+#include "flang/Optimizer/CodeGen/DescriptorModel.h"
+
+namespace fir {
+
+/// Calculate offset of any field in the descriptor.
+template <int Field>
+static std::uint64_t getDescComponentOffset(const mlir::DataLayout &dl,
+                                            mlir::MLIRContext *context,
+                                            mlir::Type fieldType) {
+  static_assert(Field > 0 && Field < 8);
----------------
pawosm-arm wrote:

NB, Is there any constant defined that could be used here instead of 8?

https://github.com/llvm/llvm-project/pull/109424


More information about the flang-commits mailing list