[flang-commits] [flang] [Flang][MLIR] Add basic initial support for alloca and program address space handling in FIR->LLVMIR codegen (PR #77518)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Wed Jan 10 01:35:57 PST 2024
================
@@ -67,8 +68,41 @@ static constexpr unsigned defaultAlign = 8;
static constexpr unsigned kAttrPointer = CFI_attribute_pointer;
static constexpr unsigned kAttrAllocatable = CFI_attribute_allocatable;
-static inline mlir::Type getLlvmPtrType(mlir::MLIRContext *context) {
- return mlir::LLVM::LLVMPointerType::get(context);
+static inline unsigned getAllocaAddressSpace(mlir::ModuleOp module) {
+ if (mlir::Attribute addrSpace =
+ mlir::DataLayout(module).getAllocaMemorySpace())
+ return addrSpace.cast<mlir::IntegerAttr>().getUInt();
+
+ return 0u;
----------------
ergawy wrote:
Can you replace `0u` with a `constexpr` variable here an below? Just to document the meaning of the constant.
https://github.com/llvm/llvm-project/pull/77518
More information about the flang-commits
mailing list