Skip to content

Commit

Permalink
[MIR] Add missing noteNewVirtualRegister callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
optimisan committed Oct 14, 2024
1 parent 5e1c572 commit 4d77407
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/MIRParser/MIParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest,

MRI.setRegClassOrRegBank(Reg, static_cast<RegisterBank *>(nullptr));
MRI.setType(Reg, Ty);
MRI.noteNewVirtualRegister(Reg);
}
}
} else if (consumeIfPresent(MIToken::lparen)) {
Expand Down
9 changes: 5 additions & 4 deletions llvm/lib/CodeGen/MIRParser/MIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,10 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
const yaml::MachineFunction &YamlMF) {
MachineFunction &MF = PFS.MF;
MachineRegisterInfo &RegInfo = MF.getRegInfo();
MachineRegisterInfo &MRI = MF.getRegInfo();
assert(RegInfo.tracksLiveness());
if (!YamlMF.TracksRegLiveness)
RegInfo.invalidateLiveness();
MRI.invalidateLiveness();

SMDiagnostic Error;
// Parse the virtual register information.
Expand Down Expand Up @@ -705,6 +705,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
FlagStringValue.Value + "'");
Info.Flags.push_back(FlagValue);
}
MRI.noteNewVirtualRegister(Info.VReg);
}

// Parse the liveins.
Expand All @@ -720,7 +721,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
return error(Error, LiveIn.VirtualRegister.SourceRange);
VReg = Info->VReg;
}
RegInfo.addLiveIn(Reg, VReg);
MRI.addLiveIn(Reg, VReg);
}

// Parse the callee saved registers (Registers that will
Expand All @@ -733,7 +734,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
return error(Error, RegSource.SourceRange);
CalleeSavedRegisters.push_back(Reg);
}
RegInfo.setCalleeSavedRegs(CalleeSavedRegisters);
MRI.setCalleeSavedRegs(CalleeSavedRegisters);
}

return false;
Expand Down

0 comments on commit 4d77407

Please sign in to comment.