mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[PowerPC] Don't use a non-allocatable register to implement the 'cc' alias
GCC accepts 'cc' as an alias for 'cr0', and we need to do the same when processing inline asm constraints. This had previously been implemented using a non-allocatable register, named 'cc', that was listed as an alias of 'cr0', but the infrastructure does not seem to support this properly (neither the register allocator nor the scheduler properly accounts for the alias). Instead, we can just process this as a naming alias inside of the inline asm constraint-processing code, so we'll do that instead. There are two regression tests, one where the post-RA scheduler did the wrong thing with the non-allocatable alias, and one where the register allocator did the wrong thing. Fixes PR21742. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223708 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8959,6 +8959,12 @@ PPCTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
|
||||
&PPC::G8RCRegClass);
|
||||
}
|
||||
|
||||
// GCC accepts 'cc' as an alias for 'cr0', and we need to do the same.
|
||||
if (!R.second && StringRef("{cc}").equals_lower(Constraint)) {
|
||||
R.first = PPC::CR0;
|
||||
R.second = &PPC::CRRCRegClass;
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
|
@@ -188,11 +188,6 @@ def CR6 : CR<6, "cr6", [CR6LT, CR6GT, CR6EQ, CR6UN]>, DwarfRegNum<[74, 74]>;
|
||||
def CR7 : CR<7, "cr7", [CR7LT, CR7GT, CR7EQ, CR7UN]>, DwarfRegNum<[75, 75]>;
|
||||
}
|
||||
|
||||
// An alias for "cr0" used by GCC.
|
||||
def CC : PPCReg<"cc">, DwarfRegAlias<CR0> {
|
||||
let Aliases = [CR0];
|
||||
}
|
||||
|
||||
// Link register
|
||||
def LR : SPR<8, "lr">, DwarfRegNum<[-2, 65]>;
|
||||
//let Aliases = [LR] in
|
||||
@@ -306,7 +301,3 @@ def CARRYRC : RegisterClass<"PPC", [i32], 32, (add CARRY)> {
|
||||
let CopyCost = -1;
|
||||
}
|
||||
|
||||
def CCRC : RegisterClass<"PPC", [i32], 32, (add CC)> {
|
||||
let isAllocatable = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user