Correctly compute live variable information for physical registers

when an implicitely defined register is later used by an alias. For example:

         call foo
         %reg1024 = mov %AL

The call implicitely defines EAX but only AL is used. Before this fix
no information was available on AL. Now EAX and all its aliases except
AL get defined and die at the call instruction whereas AL lives to be
killed by the assignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alkis Evlogimenos
2004-01-13 06:24:30 +00:00
parent 504e8fb74e
commit 19b6486d38
3 changed files with 30 additions and 33 deletions

View File

@ -117,14 +117,6 @@ void LiveVariables::HandlePhysRegUse(unsigned Reg, MachineInstr *MI) {
if (PhysRegInfo[Reg]) {
PhysRegInfo[Reg] = MI;
PhysRegUsed[Reg] = true;
} else {
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
*AliasSet; ++AliasSet) {
if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
PhysRegInfo[*AliasSet] = MI;
PhysRegUsed[*AliasSet] = true;
}
}
}
}
@ -135,20 +127,21 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) {
RegistersKilled.insert(std::make_pair(LastUse, Reg));
else
RegistersDead.insert(std::make_pair(LastUse, Reg));
} else {
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
*AliasSet; ++AliasSet) {
if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
if (PhysRegUsed[*AliasSet])
RegistersKilled.insert(std::make_pair(LastUse, *AliasSet));
else
RegistersDead.insert(std::make_pair(LastUse, *AliasSet));
PhysRegInfo[*AliasSet] = 0; // Kill the aliased register
}
}
}
PhysRegInfo[Reg] = MI;
PhysRegUsed[Reg] = false;
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
*AliasSet; ++AliasSet) {
if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
if (PhysRegUsed[*AliasSet])
RegistersKilled.insert(std::make_pair(LastUse, *AliasSet));
else
RegistersDead.insert(std::make_pair(LastUse, *AliasSet));
}
PhysRegInfo[*AliasSet] = MI;
PhysRegUsed[*AliasSet] = false;
}
}
bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {