Skip to content

Commit e6fb4e1

Browse files
committed
[PPC] Add a new register XER aliased to CARRY
When "xer" is specified as clobbered register in inline assembler, clang can accept it, but llvm simply ignore it when lowered to machine instructions. It may cause problems later in scheduler. This patch adds a new register XER aliased to CARRY, and adds it to register class CARRYRC. Now PPCTargetLowering::getRegForInlineAsmConstraint can return correct register number for inline asm constraint "{xer}", and scheduler behave correctly. Differential Revision: https://reviews.llvm.org/D41967 llvm-svn: 322591
1 parent 62003fb commit e6fb4e1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/Target/PowerPC/PPCRegisterInfo.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,14 @@ def CTR8 : SPR<9, "ctr">, DwarfRegNum<[66, -2]>;
208208
// VRsave register
209209
def VRSAVE: SPR<256, "vrsave">, DwarfRegNum<[109]>;
210210

211+
def XER: SPR<1, "xer">, DwarfRegNum<[76]>;
212+
211213
// Carry bit. In the architecture this is really bit 0 of the XER register
212214
// (which really is SPR register 1); this is the only bit interesting to a
213215
// compiler.
214-
def CARRY: SPR<1, "ca">, DwarfRegNum<[76]>;
216+
def CARRY: SPR<1, "xer">, DwarfRegNum<[76]> {
217+
let Aliases = [XER];
218+
}
215219

216220
// FP rounding mode: bits 30 and 31 of the FP status and control register
217221
// This is not allocated as a normal register; it appears only in
@@ -351,7 +355,7 @@ def CTRRC8 : RegisterClass<"PPC", [i64], 64, (add CTR8)> {
351355
}
352356

353357
def VRSAVERC : RegisterClass<"PPC", [i32], 32, (add VRSAVE)>;
354-
def CARRYRC : RegisterClass<"PPC", [i32], 32, (add CARRY)> {
358+
def CARRYRC : RegisterClass<"PPC", [i32], 32, (add CARRY, XER)> {
355359
let CopyCost = -1;
356360
}
357361

0 commit comments

Comments
 (0)