[PATCH] D77119: [AVR] Fix function pointer address space
Vlastimil Labsky via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 01:04:11 PDT 2020
vlastik created this revision.
vlastik added a reviewer: dylanmckay.
Herald added subscribers: cfe-commits, Jim.
Herald added a project: clang.
Function pointers should be created with program address space.
This fixes function pointers on AVR.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77119
Files:
clang/lib/CodeGen/CodeGenTypes.cpp
Index: clang/lib/CodeGen/CodeGenTypes.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenTypes.cpp
+++ clang/lib/CodeGen/CodeGenTypes.cpp
@@ -595,7 +595,11 @@
llvm::Type *PointeeType = ConvertTypeForMem(ETy);
if (PointeeType->isVoidTy())
PointeeType = llvm::Type::getInt8Ty(getLLVMContext());
- unsigned AS = Context.getTargetAddressSpace(ETy);
+
+ unsigned AS = PointeeType->isFunctionTy()
+ ? getDataLayout().getProgramAddressSpace()
+ : Context.getTargetAddressSpace(ETy);
+
ResultType = llvm::PointerType::get(PointeeType, AS);
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77119.253794.patch
Type: text/x-patch
Size: 637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200331/62fbb418/attachment-0001.bin>
More information about the cfe-commits
mailing list