[flang-commits] [flang] [flang] Emit `fir.global` in the global address space (PR #146653)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Wed Jul 2 02:07:02 PDT 2025
================
@@ -1867,6 +1867,20 @@ fir::factory::deduceOptimalExtents(mlir::ValueRange extents1,
return extents;
}
+uint64_t fir::factory::getGlobalAddressSpace(mlir::DataLayout *dataLayout) {
+ if (dataLayout)
+ if (mlir::Attribute addrSpace = dataLayout->getGlobalMemorySpace())
+ return mlir::cast<mlir::IntegerAttr>(addrSpace).getUInt();
+ return 0;
----------------
ergawy wrote:
This follows the same pattern as `getProgramAddressSpace` earlier in the file. I think `dataLayout` is made optional (through the pointer) to allow for easily testing when modules don't have a data layout attached.
I will see who wrote `getProgramAddressSpace` and add them to the review.
https://github.com/llvm/llvm-project/pull/146653
More information about the flang-commits
mailing list