mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
Teach coalescer about earlyclobber bits.
Check bits for preferred register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56384 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5e8d9def77
commit
34d8f7559c
@ -1122,9 +1122,12 @@ unsigned RALinScan::getFreePhysReg(LiveInterval *cur) {
|
|||||||
unsigned FreeRegInactiveCount = 0;
|
unsigned FreeRegInactiveCount = 0;
|
||||||
|
|
||||||
// If copy coalescer has assigned a "preferred" register, check if it's
|
// If copy coalescer has assigned a "preferred" register, check if it's
|
||||||
// available first.
|
// available first. Coalescer can create new earlyclobber interferences,
|
||||||
|
// so we need to check that.
|
||||||
if (cur->preference) {
|
if (cur->preference) {
|
||||||
if (prt_->isRegAvail(cur->preference) && RC->contains(cur->preference)) {
|
if (prt_->isRegAvail(cur->preference) &&
|
||||||
|
RC->contains(cur->preference) &&
|
||||||
|
noEarlyClobberConflict(cur, cur->preference)) {
|
||||||
DOUT << "\t\tassigned the preferred register: "
|
DOUT << "\t\tassigned the preferred register: "
|
||||||
<< tri_->getName(cur->preference) << "\n";
|
<< tri_->getName(cur->preference) << "\n";
|
||||||
return cur->preference;
|
return cur->preference;
|
||||||
|
@ -1206,6 +1206,14 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
|
|||||||
DOUT << " and "; DstInt.print(DOUT, tri_);
|
DOUT << " and "; DstInt.print(DOUT, tri_);
|
||||||
DOUT << ": ";
|
DOUT << ": ";
|
||||||
|
|
||||||
|
// If one interval is earlyclobber and the other is overlaps-earlyclobber,
|
||||||
|
// we cannot coalesce them.
|
||||||
|
if ((SrcInt.isEarlyClobber && DstInt.overlapsEarlyClobber) ||
|
||||||
|
(DstInt.isEarlyClobber && SrcInt.overlapsEarlyClobber)) {
|
||||||
|
DOUT << "\t\tCannot join due to earlyclobber.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it is necessary to propagate "isDead" property.
|
// Check if it is necessary to propagate "isDead" property.
|
||||||
if (!isExtSubReg && !isInsSubReg) {
|
if (!isExtSubReg && !isInsSubReg) {
|
||||||
MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, false);
|
MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, false);
|
||||||
@ -1366,6 +1374,10 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
|
|||||||
if (TargetRegisterInfo::isVirtualRegister(DstReg))
|
if (TargetRegisterInfo::isVirtualRegister(DstReg))
|
||||||
RemoveUnnecessaryKills(DstReg, *ResDstInt);
|
RemoveUnnecessaryKills(DstReg, *ResDstInt);
|
||||||
|
|
||||||
|
// Merge the earlyclobber bits.
|
||||||
|
ResDstInt->isEarlyClobber |= ResSrcInt->isEarlyClobber;
|
||||||
|
ResDstInt->overlapsEarlyClobber |= ResSrcInt->overlapsEarlyClobber;
|
||||||
|
|
||||||
if (isInsSubReg)
|
if (isInsSubReg)
|
||||||
// Avoid:
|
// Avoid:
|
||||||
// r1024 = op
|
// r1024 = op
|
||||||
|
Loading…
x
Reference in New Issue
Block a user