[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 07:48:45 PST 2024
================
@@ -2520,7 +2520,9 @@ void PPCAIXAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
// If the Global Variable has the toc-data attribute, it needs to be emitted
// when we emit the .toc section.
if (GV->hasAttribute("toc-data")) {
- TOCDataGlobalVars.push_back(GV);
+ unsigned PointerSize = GV->getParent()->getDataLayout().getPointerSize();
----------------
diggerlin wrote:
if we run
`if (G.hasAttribute("toc-data"))
(Subtarget->tocDataChecks(G.getParent()->getDataLayout().getPointerSize(), &G));`
in the function `PPCAIXAsmPrinter::doInitialization(Module &M)`,
we do not need to do `tocDataChecks` in the function `static bool hasTocDataAttr(SDValue Val, unsigned PointerSize, const PPCSubtarget *Subtarget) ` and here
The function `hasTocDataAttr` is run for each PPCISD::TOC_ENTRY node, if a toc variable is referenced several time by the `PPCISD::TOC_ENTRY` in user application the function `tocDataChecks` will be called several times for the same variable and the `tocDataCheck` is not a small function.
https://github.com/llvm/llvm-project/pull/67999
More information about the cfe-commits
mailing list