diff options
author | Dylan McKay <me@dylanmckay.io> | 2018-02-19 09:56:22 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2018-02-19 09:56:22 +0000 |
commit | a78fde855918e11db6eaf73372988af85b4c61b7 (patch) | |
tree | e6e3fcd6dc48681efe5e39a4ed1bca11ef9c9da0 /test/Assembler | |
parent | 7737462b290ce19c9c6042eda41d4aeaf614c8c8 (diff) |
Add default address space for functions to the data layout (1/3)
Summary:
This adds initial support for letting targets specify which address
spaces their functions should reside in by default.
If a function is created by a frontend, it will get the default address space specified in the DataLayout, unless the frontend explicitly uses a more general `llvm::Function` constructor. Function address spaces will become a part of the bitcode and textual IR forms, as we do not have access to a data layout whilst parsing LL.
It will be possible to write IR that explicitly has `addrspace(n)` on a function. In this case, the function will reside in the specified space, ignoring the default in the DL.
This is the first step towards placing functions into the correct
address space for Harvard architectures.
Full patchset
* Add program address space to data layout D37052
* Require address space to be specified when creating functions D37054
* [clang] Require address space to be specified when creating functions D37057
Reviewers: pcc, arsenm, kparzysz, hfinkel, theraven
Reviewed By: theraven
Subscribers: arichardson, simoncook, rengolin, wdng, uabelho, bjope, asb, llvm-commits
Differential Revision: https://reviews.llvm.org/D37052
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325479 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler')
-rw-r--r-- | test/Assembler/datalayout-program-addrspace.ll | 5 | ||||
-rw-r--r-- | test/Assembler/invalid-datalayout-alloca-addrspace.ll | 2 | ||||
-rw-r--r-- | test/Assembler/invalid-datalayout-program-addrspace.ll | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/test/Assembler/datalayout-program-addrspace.ll b/test/Assembler/datalayout-program-addrspace.ll new file mode 100644 index 00000000000..2f250ebf055 --- /dev/null +++ b/test/Assembler/datalayout-program-addrspace.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +; CHECK: target datalayout = "P1" +target datalayout = "P1" + diff --git a/test/Assembler/invalid-datalayout-alloca-addrspace.ll b/test/Assembler/invalid-datalayout-alloca-addrspace.ll index 9a0e07acf76..f0407da73e4 100644 --- a/test/Assembler/invalid-datalayout-alloca-addrspace.ll +++ b/test/Assembler/invalid-datalayout-alloca-addrspace.ll @@ -1,4 +1,4 @@ ; RUN: not llvm-as < %s 2>&1 | FileCheck %s target datalayout = "A16777216" -; CHECK: Invalid address space, must be a 24bit integer +; CHECK: Invalid address space, must be a 24-bit integer diff --git a/test/Assembler/invalid-datalayout-program-addrspace.ll b/test/Assembler/invalid-datalayout-program-addrspace.ll new file mode 100644 index 00000000000..e636b75dee4 --- /dev/null +++ b/test/Assembler/invalid-datalayout-program-addrspace.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +; CHECK: Invalid address space, must be a 24-bit integer +target datalayout = "P16777216" |