File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1780,6 +1780,14 @@ class TargetInfo : public TransferrableTargetInfo,
17801780 return 0 ;
17811781 }
17821782
1783+ // / \returns Target specific address space for indirect (e.g. sret) arguments.
1784+ // / If such an address space exists, it must be convertible to and from the
1785+ // / alloca address space. If it does not, std::nullopt is returned and the
1786+ // / alloca address space will be used.
1787+ virtual std::optional<unsigned > getIndirectArgAddressSpace () const {
1788+ return std::nullopt ;
1789+ }
1790+
17831791 // / \returns If a target requires an address within a target specific address
17841792 // / space \p AddressSpace to be converted in order to be used, then return the
17851793 // / corresponding target specific DWARF address space.
Original file line number Diff line number Diff line change @@ -1672,9 +1672,11 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) {
16721672
16731673 // Add type for sret argument.
16741674 if (IRFunctionArgs.hasSRetArg ()) {
1675- unsigned AddressSpace = CGM.getDataLayout ().getAllocaAddrSpace ();
1675+ auto AddressSpace = CGM.getTarget ().getIndirectArgAddressSpace ();
1676+ if (!AddressSpace)
1677+ AddressSpace = getDataLayout ().getAllocaAddrSpace ();
16761678 ArgTypes[IRFunctionArgs.getSRetArgNo ()] =
1677- llvm::PointerType::get (getLLVMContext (), AddressSpace);
1679+ llvm::PointerType::get (getLLVMContext (), * AddressSpace);
16781680 }
16791681
16801682 // Add type for inalloca argument.
You can’t perform that action at this time.
0 commit comments