aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
diff options
context:
space:
mode:
authorZaara Syeda <95926691+syzaara@users.noreply.github.com>2024-03-13 10:26:31 -0400
committerGitHub <noreply@github.com>2024-03-13 10:26:31 -0400
commit37b5eb0a0a75bdf69b96b902417906da31c88dc3 (patch)
tree06a49de6a80e4b83201115ec2a4b0280eddd9fe6 /llvm/lib/Target/PowerPC/PPCSubtarget.cpp
parente77324decf74e8203fdee53e53c1866319ebf47c (diff)
downloadllvm-37b5eb0a0a75bdf69b96b902417906da31c88dc3.zip
llvm-37b5eb0a0a75bdf69b96b902417906da31c88dc3.tar.gz
llvm-37b5eb0a0a75bdf69b96b902417906da31c88dc3.tar.bz2
[AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (#67999)
This patch enables support that the XL compiler had for AIX under -qdatalocal/-qdataimported.
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCSubtarget.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
index 5380ec1..884f2f5 100644
--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -185,6 +185,28 @@ bool PPCSubtarget::enableSubRegLiveness() const {
return UseSubRegLiveness;
}
+void PPCSubtarget::tocDataChecks(unsigned PointerSize,
+ const GlobalVariable *GV) const {
+ // TODO: These asserts should be updated as more support for the toc data
+ // transformation is added (struct support, etc.).
+ assert(
+ PointerSize >= GV->getAlign().valueOrOne().value() &&
+ "GlobalVariables with an alignment requirement stricter than TOC entry "
+ "size not supported by the toc data transformation.");
+
+ Type *GVType = GV->getValueType();
+ assert(GVType->isSized() && "A GlobalVariable's size must be known to be "
+ "supported by the toc data transformation.");
+ if (GV->getParent()->getDataLayout().getTypeSizeInBits(GVType) >
+ PointerSize * 8)
+ report_fatal_error(
+ "A GlobalVariable with size larger than a TOC entry is not currently "
+ "supported by the toc data transformation.");
+ if (GV->hasPrivateLinkage())
+ report_fatal_error("A GlobalVariable with private linkage is not "
+ "currently supported by the toc data transformation.");
+}
+
bool PPCSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
// Large code model always uses the TOC even for local symbols.
if (TM.getCodeModel() == CodeModel::Large)