diff options
author | David Green <david.green@arm.com> | 2018-08-22 11:31:39 +0000 |
---|---|---|
committer | David Green <david.green@arm.com> | 2018-08-22 11:31:39 +0000 |
commit | 9dd1d451d9719aa91b3bdd59c0c667983e1baf05 (patch) | |
tree | f3bc770a3ce8a449b97ddd3b29f37efea905a543 /llvm/lib/Target/AArch64/AArch64Subtarget.cpp | |
parent | bb8e64e7f5ad448bf04ba84c995b8a7cbf9bb7e4 (diff) | |
download | bcm5719-llvm-9dd1d451d9719aa91b3bdd59c0c667983e1baf05.tar.gz bcm5719-llvm-9dd1d451d9719aa91b3bdd59c0c667983e1baf05.zip |
[AArch64] Add Tiny Code Model for AArch64
This adds the plumbing for the Tiny code model for the AArch64 backend. This,
instead of loading addresses through the normal ADRP;ADD pair used in the Small
model, uses a single ADR. The 21 bit range of an ADR means that the code and
its statically defined symbols need to be within 1MB of each other.
This makes it mostly interesting for embedded applications where we want to fit
as much as we can in as small a space as possible.
Differential Revision: https://reviews.llvm.org/D49673
llvm-svn: 340397
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64Subtarget.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index 04bb90d30d6..be655e3482c 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -204,7 +204,9 @@ AArch64Subtarget::ClassifyGlobalReference(const GlobalValue *GV, // The small code model's direct accesses use ADRP, which cannot // necessarily produce the value 0 (if the code is above 4GB). - if (useSmallAddressing() && GV->hasExternalWeakLinkage()) + // Same for the tiny code model, where we have a pc relative LDR. + if ((useSmallAddressing() || TM.getCodeModel() == CodeModel::Tiny) && + GV->hasExternalWeakLinkage()) return AArch64II::MO_GOT | Flags; return Flags; |