Skip to content

Commit 65fdb7b

Browse files
author
Zaara Syeda
committed
Address review comments and remove mcmodel warning for mtocdata
1 parent 3306996 commit 65fdb7b

File tree

4 files changed

+11
-26
lines changed

4 files changed

+11
-26
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,6 @@ def warn_drv_unsupported_gpopt : Warning<
599599
"ignoring '-mgpopt' option as it cannot be used with %select{|the implicit"
600600
" usage of }0-mabicalls">,
601601
InGroup<UnsupportedGPOpt>;
602-
def warn_drv_unsupported_tocdata: Warning<
603-
"ignoring '-mtocdata' as it is only supported for -mcmodel=small">,
604-
InGroup<OptionIgnored>;
605602
def warn_drv_unsupported_sdata : Warning<
606603
"ignoring '-msmall-data-limit=' with -mcmodel=large for -fpic or RV64">,
607604
InGroup<OptionIgnored>;

clang/lib/Driver/ToolChains/AIX.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,6 @@ static void addTocDataOptions(const llvm::opt::ArgList &Args,
479479
return false;
480480
}();
481481

482-
// Currently only supported for small code model.
483-
if (TOCDataGloballyinEffect &&
484-
(Args.getLastArgValue(options::OPT_mcmodel_EQ) == "large" ||
485-
Args.getLastArgValue(options::OPT_mcmodel_EQ) == "medium")) {
486-
D.Diag(clang::diag::warn_drv_unsupported_tocdata);
487-
return;
488-
}
489-
490482
enum TOCDataSetting {
491483
AddressInTOC = 0, // Address of the symbol stored in the TOC.
492484
DataInTOC = 1 // Symbol defined in the TOC.

clang/test/Driver/tocdata-cc1.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mcmodel=medium -mtocdata %s 2>&1 \
2-
// RUN: | FileCheck -check-prefix=CHECK-NOTOC %s
2+
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
33
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
4-
// RUN: | FileCheck -check-prefix=CHECK-NOTOC %s
4+
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
55
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mtocdata %s 2>&1 \
66
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
77
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mcmodel=medium -mtocdata %s 2>&1 \
8-
// RUN: | FileCheck -check-prefix=CHECK-NOTOC %s
8+
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
99
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
10-
// RUN: | FileCheck -check-prefix=CHECK-NOTOC %s
10+
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
1111
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mtocdata %s 2>&1 \
1212
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
13-
// CHECK-NOTOC: warning: ignoring '-mtocdata' as it is only supported for -mcmodel=small
14-
// CHECK-NOTOC-NOT: "-cc1"{{.*}}" "-mtocdata"
1513
// CHECK-TOC: "-cc1"{{.*}}" "-mtocdata"
16-
// CHECK-TOC-NOT: warning: ignoring '-mtocdata' as it is only supported for -mcmodel=small

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,21 +1157,20 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
11571157

11581158
MCSymbolRefExpr::VariantKind VK = GetVKForMO(MO);
11591159

1160-
// If the symbol does not have the toc-data attribute, then we create the
1161-
// TOC entry on AIX. If the toc-data attribute is used, the TOC entry
1162-
// contains the data rather than the address of the MOSymbol.
11631160
// Map the global address operand to be a reference to the TOC entry we
11641161
// will synthesize later. 'TOCEntry' is a label used to reference the
11651162
// storage allocated in the TOC which contains the address of 'MOSymbol'.
1163+
// If the symbol does not have the toc-data attribute, then we create the
1164+
// TOC entry on AIX. If the toc-data attribute is used, the TOC entry
1165+
// contains the data rather than the address of the MOSymbol.
11661166
if (![](const MachineOperand &MO) {
11671167
if (!MO.isGlobal())
11681168
return false;
11691169

1170-
if (const GlobalVariable *GV =
1171-
dyn_cast<GlobalVariable>(MO.getGlobal()))
1172-
return GV->hasAttribute("toc-data");
1173-
1174-
return false;
1170+
const GlobalVariable *GV = dyn_cast<GlobalVariable>(MO.getGlobal());
1171+
if (!GV)
1172+
return false;
1173+
return GV->hasAttribute("toc-data");
11751174
}(MO)) {
11761175
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol, getTOCEntryTypeForMO(MO), VK);
11771176
}

0 commit comments

Comments
 (0)