Skip to content

Commit d2fd9be

Browse files
author
Hal Finkel
committedAug 30, 2015
[PowerPC] Don't assume ADDISdtprelHA's source is r3
Even through ADDISdtprelHA generally has r3 as its source register, it is possible for the instruction scheduler to move things around such that some other register is the source. We need to print the actual source register, not always r3. Fixes PR24394. The test case will come in a follow-up commit because it depends on MIR target-flags parsing. llvm-svn: 246372
1 parent a59fcfa commit d2fd9be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -947,11 +947,11 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
947947
return;
948948
}
949949
case PPC::ADDISdtprelHA:
950-
// Transform: %Xd = ADDISdtprelHA %X3, <ga:@sym>
951-
// Into: %Xd = ADDIS8 %X3, sym@dtprel@ha
950+
// Transform: %Xd = ADDISdtprelHA %Xs, <ga:@sym>
951+
// Into: %Xd = ADDIS8 %Xs, sym@dtprel@ha
952952
case PPC::ADDISdtprelHA32: {
953-
// Transform: %Rd = ADDISdtprelHA32 %R3, <ga:@sym>
954-
// Into: %Rd = ADDIS %R3, sym@dtprel@ha
953+
// Transform: %Rd = ADDISdtprelHA32 %Rs, <ga:@sym>
954+
// Into: %Rd = ADDIS %Rs, sym@dtprel@ha
955955
const MachineOperand &MO = MI->getOperand(2);
956956
const GlobalValue *GValue = MO.getGlobal();
957957
MCSymbol *MOSymbol = getSymbol(GValue);
@@ -962,7 +962,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
962962
*OutStreamer,
963963
MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
964964
.addReg(MI->getOperand(0).getReg())
965-
.addReg(Subtarget->isPPC64() ? PPC::X3 : PPC::R3)
965+
.addReg(MI->getOperand(1).getReg())
966966
.addExpr(SymDtprel));
967967
return;
968968
}

0 commit comments

Comments
 (0)
Please sign in to comment.