From f920da009e4c27b06ad5b301995db620dd8be1db Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Tue, 18 Dec 2018 09:52:52 +0000 Subject: [IPO][AVR] Create new Functions in the default address space specified in the data layout This modifies the IPO pass so that it respects any explicit function address space specified in the data layout. In targets with nonzero program address spaces, all functions should, by default, be placed into the default program address space. This is required for Harvard architectures like AVR. Without this, the functions will be marked as residing in data space, and thus not be callable. This has no effect to any in-tree official backends, as none use an explicit program address space in their data layouts. Patch by Tim Neumann. llvm-svn: 349469 --- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp') diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index b8f68d4..37905da 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -864,10 +864,13 @@ void DevirtModule::tryICallBranchFunnel( Function *JT; if (isa(Slot.TypeID)) { JT = Function::Create(FT, Function::ExternalLinkage, + M.getDataLayout().getProgramAddressSpace(), getGlobalName(Slot, {}, "branch_funnel"), &M); JT->setVisibility(GlobalValue::HiddenVisibility); } else { - JT = Function::Create(FT, Function::InternalLinkage, "branch_funnel", &M); + JT = Function::Create(FT, Function::InternalLinkage, + M.getDataLayout().getProgramAddressSpace(), + "branch_funnel", &M); } JT->addAttribute(1, Attribute::Nest); -- cgit v1.1