diff options
author | Dylan McKay <me@dylanmckay.io> | 2018-12-18 09:52:52 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2018-12-18 09:52:52 +0000 |
commit | f920da009e4c27b06ad5b301995db620dd8be1db (patch) | |
tree | 2cd8e1293c8244e64435eefa0fa8a64d977b6556 /llvm/lib/Transforms/IPO/FunctionImport.cpp | |
parent | c94e26c71d1a3c9bd85826e7d62940b2c10114a9 (diff) | |
download | bcm5719-llvm-f920da009e4c27b06ad5b301995db620dd8be1db.tar.gz bcm5719-llvm-f920da009e4c27b06ad5b301995db620dd8be1db.zip |
[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
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index c5490f13d9a..531a7c19e36 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -911,7 +911,8 @@ bool llvm::convertToDeclaration(GlobalValue &GV) { if (GV.getValueType()->isFunctionTy()) NewGV = Function::Create(cast<FunctionType>(GV.getValueType()), - GlobalValue::ExternalLinkage, "", GV.getParent()); + GlobalValue::ExternalLinkage, GV.getAddressSpace(), + "", GV.getParent()); else NewGV = new GlobalVariable(*GV.getParent(), GV.getValueType(), |