Skip to content

Commit 9e5eb9a

Browse files
committed
Address third reound of review comments.
- Fixed some spelling mistakes in comments. - renamed function that retreives the per global code model. - updated the AIX specific code in isGVIndirectSymbol.
1 parent 4be525f commit 9e5eb9a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,8 +2691,8 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForTOCEntry(
26912691
return XCOFF::XMC_TC;
26922692

26932693
// Use large code model toc entries for ehinfo symbols as they are
2694-
// never refrenced directly. The runtime loads their TOC entries
2695-
// address from the trace-back table.
2694+
// never refrenced directly. The runtime loads their TOC entry
2695+
// addresses from the trace-back table.
26962696
if (XSym->isEHInfo())
26972697
return XCOFF::XMC_TE;
26982698

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static CodeModel::Model getCodeModel(const PPCSubtarget &S,
478478
const TargetMachine &TM,
479479
const MachineOperand &MO) {
480480
CodeModel::Model ModuleModel = TM.getCodeModel();
481-
// Per global code model is only support on AIX.
481+
// Per global code model is only supported on AIX.
482482
if (!S.isAIXABI())
483483
return ModuleModel;
484484

@@ -502,7 +502,7 @@ static CodeModel::Model getCodeModel(const PPCSubtarget &S,
502502
}
503503

504504
static std::optional<CodeModel::Model>
505-
hasPerGlobalCodeModel(const GlobalValue *GV) {
505+
getPerGlobalCodeModel(const GlobalValue *GV) {
506506
// Symbols that aren't global variables cannot have the attribute.
507507
if (!isa<GlobalVariable>(GV))
508508
return std::nullopt;
@@ -3021,7 +3021,7 @@ bool PPCAIXAsmPrinter::doInitialization(Module &M) {
30213021

30223022
setCsectAlignment(&G);
30233023
std::optional<CodeModel::Model> OptionalCodeModel =
3024-
hasPerGlobalCodeModel(&G);
3024+
getPerGlobalCodeModel(&G);
30253025
if (OptionalCodeModel)
30263026
setOptionalCodeModel(cast<MCSymbolXCOFF>(getSymbol(&G)),
30273027
*OptionalCodeModel);

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,18 @@ bool PPCSubtarget::enableSubRegLiveness() const {
186186
}
187187

188188
bool PPCSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
189+
if (isAIXABI() && isa<GlobalVariable>(GV)) {
190+
// On AIX the only symbols that aren't indirect are toc-data.
191+
if (cast<GlobalVariable>(GV)->hasAttribute("toc-data"))
192+
return false;
193+
194+
return true;
195+
}
196+
189197
// Large code model always uses the TOC even for local symbols.
190198
if (TM.getCodeModel() == CodeModel::Large)
191199
return true;
192200

193-
// AIX may have a per global code model attribute.
194-
if (isAIXABI() && isa<GlobalVariable>(GV)) {
195-
const GlobalVariable *GVar = cast<GlobalVariable>(GV);
196-
std::optional<CodeModel::Model> OptionalCM = GVar->getCodeModel();
197-
if (OptionalCM && *OptionalCM == CodeModel::Large)
198-
return true;
199-
}
200-
201201
if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
202202
return false;
203203
return true;

0 commit comments

Comments
 (0)