diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-28 08:36:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 08:36:49 +0200 |
commit | 9df71d7673b5c98e1032d01be83724a45b42fafc (patch) | |
tree | cf5f0c837110b4a753e71b0532d8e5ee6d487411 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 519e0bb094bd9444b64ac62f2e8192543fdb94b9 (diff) | |
download | llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.zip llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.tar.gz llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.tar.bz2 |
[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)
Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 957b283..1eec346 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -641,7 +641,7 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, // We also need alignment here. // FIXME: this is getting the alignment of the character, not the // alignment of the global! - Align Alignment = GO->getParent()->getDataLayout().getPreferredAlign( + Align Alignment = GO->getDataLayout().getPreferredAlign( cast<GlobalVariable>(GO)); Name += ".str"; @@ -1359,7 +1359,7 @@ MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal( // FIXME: Alignment check should be handled by section classifier. if (Kind.isMergeable1ByteCString() && - GO->getParent()->getDataLayout().getPreferredAlign( + GO->getDataLayout().getPreferredAlign( cast<GlobalVariable>(GO)) < Align(32)) return CStringSection; @@ -1367,7 +1367,7 @@ MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal( // externally visible label, this runs into issues with certain linker // versions. if (Kind.isMergeable2ByteCString() && !GO->hasExternalLinkage() && - GO->getParent()->getDataLayout().getPreferredAlign( + GO->getDataLayout().getPreferredAlign( cast<GlobalVariable>(GO)) < Align(32)) return UStringSection; |