Skip to content

Commit 7b6bfbc

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 5d2155c commit 7b6bfbc

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;
@@ -3023,7 +3023,7 @@ bool PPCAIXAsmPrinter::doInitialization(Module &M) {
30233023

30243024
setCsectAlignment(&G);
30253025
std::optional<CodeModel::Model> OptionalCodeModel =
3026-
hasPerGlobalCodeModel(&G);
3026+
getPerGlobalCodeModel(&G);
30273027
if (OptionalCodeModel)
30283028
setOptionalCodeModel(cast<MCSymbolXCOFF>(getSymbol(&G)),
30293029
*OptionalCodeModel);

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,18 @@ void PPCSubtarget::tocDataChecks(unsigned PointerSize,
208208
}
209209

210210
bool PPCSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
211+
if (isAIXABI() && isa<GlobalVariable>(GV)) {
212+
// On AIX the only symbols that aren't indirect are toc-data.
213+
if (cast<GlobalVariable>(GV)->hasAttribute("toc-data"))
214+
return false;
215+
216+
return true;
217+
}
218+
211219
// Large code model always uses the TOC even for local symbols.
212220
if (TM.getCodeModel() == CodeModel::Large)
213221
return true;
214222

215-
// AIX may have a per global code model attribute.
216-
if (isAIXABI() && isa<GlobalVariable>(GV)) {
217-
const GlobalVariable *GVar = cast<GlobalVariable>(GV);
218-
std::optional<CodeModel::Model> OptionalCM = GVar->getCodeModel();
219-
if (OptionalCM && *OptionalCM == CodeModel::Large)
220-
return true;
221-
}
222-
223223
if (TM.shouldAssumeDSOLocal(GV))
224224
return false;
225225
return true;

0 commit comments

Comments
 (0)