Skip to content

Commit 45550b5

Browse files
author
Zaara Syeda
committed
Address review
1 parent 65fdb7b commit 45550b5

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

clang/test/Driver/tocdata-cc1.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mcmodel=medium -mtocdata %s 2>&1 \
2-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
2+
// RUN: | FileCheck %s
33
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
4-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
4+
// RUN: | FileCheck %s
55
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mtocdata %s 2>&1 \
6-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
6+
// RUN: | FileCheck %s
77
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mcmodel=medium -mtocdata %s 2>&1 \
8-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
8+
// RUN: | FileCheck %s
99
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
10-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
10+
// RUN: | FileCheck %s
1111
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mtocdata %s 2>&1 \
12-
// RUN: | FileCheck -check-prefix=CHECK-TOC %s
13-
// CHECK-TOC: "-cc1"{{.*}}" "-mtocdata"
12+
// RUN: | FileCheck %s
13+
// CHECK: "-cc1"{{.*}}" "-mtocdata"

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,9 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
13011301
unsigned Op = MI->getOpcode();
13021302

13031303
// Change the opcode to load address for toc data.
1304-
unsigned NewOp64 = IsAIX ? PPC::LA8 : PPC::ADDI8;
1305-
TmpInst.setOpcode(Op == PPC::ADDItocL8 ? NewOp64 : PPC::LA);
1304+
// ADDItocL is only used for 32-bit toc-data on AIX and will always use LA.
1305+
TmpInst.setOpcode(Op == PPC::ADDItocL8 ? (IsAIX ? PPC::LA8 : PPC::ADDI8)
1306+
: PPC::LA);
13061307

13071308
const MachineOperand &MO = MI->getOperand(2);
13081309
assert((Op == PPC::ADDItocL8)

llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6152,10 +6152,10 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
61526152
// LWZtocL(@sym, ADDIStocHA(%r2, @sym))
61536153
// [64-bit ELF/AIX]
61546154
// LDtocL(@sym, ADDIStocHA8(%x2, @sym))
6155-
// Otherwise we generate:
6155+
// Otherwise for medium code model ELF we generate:
61566156
// ADDItocL8(ADDIStocHA8(%x2, @sym), @sym)
61576157

6158-
// For large code model with TOC data symbols we generate:
6158+
// And finally for AIX with toc-data we generate:
61596159
// [32-bit AIX]
61606160
// ADDItocL(ADDIStocHA(%x2, @sym), @sym)
61616161
// [64-bit AIX]
@@ -6188,6 +6188,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
61886188
return;
61896189
}
61906190

6191+
assert(isPPC64 && "TOC_ENTRY already handled for 32-bit.");
61916192
// Build the address relative to the TOC-pointer.
61926193
ReplaceNode(N, CurDAG->getMachineNode(PPC::ADDItocL8, dl, MVT::i64,
61936194
SDValue(Tmp, 0), GA));

0 commit comments

Comments
 (0)