AsmPrinter/Dwarf*: Use llvm::Register instead of unsigned

This commit is contained in:
Fangrui Song 2020-11-06 21:00:28 -08:00
parent b1878b4641
commit ee4769687d
4 changed files with 11 additions and 9 deletions

View File

@ -181,7 +181,7 @@ void DebugLocDwarfExpression::emitBaseTypeRef(uint64_t Idx) {
}
bool DebugLocDwarfExpression::isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) {
llvm::Register MachineReg) {
// This information is not available while emitting .debug_loc entries.
return false;
}

View File

@ -97,7 +97,8 @@ void DwarfExpression::addAnd(unsigned Mask) {
}
bool DwarfExpression::addMachineReg(const TargetRegisterInfo &TRI,
unsigned MachineReg, unsigned MaxSize) {
llvm::Register MachineReg,
unsigned MaxSize) {
if (!llvm::Register::isPhysicalRegister(MachineReg)) {
if (isFrameRegister(TRI, MachineReg)) {
DwarfRegs.push_back(Register::createRegister(-1, nullptr));
@ -248,7 +249,7 @@ void DwarfExpression::addConstantFP(const APFloat &APF, const AsmPrinter &AP) {
bool DwarfExpression::addMachineRegExpression(const TargetRegisterInfo &TRI,
DIExpressionCursor &ExprCursor,
unsigned MachineReg,
llvm::Register MachineReg,
unsigned FragmentOffsetInBits) {
auto Fragment = ExprCursor.getFragmentInfo();
if (!addMachineReg(TRI, MachineReg, Fragment ? Fragment->SizeInBits : ~1U)) {

View File

@ -218,7 +218,7 @@ protected:
/// Return whether the given machine register is the frame register in the
/// current function.
virtual bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) = 0;
llvm::Register MachineReg) = 0;
/// Emit a DW_OP_reg operation. Note that this is only legal inside a DWARF
/// register location description.
@ -245,7 +245,7 @@ protected:
/// multiple subregisters that alias the register.
///
/// \return false if no DWARF register exists for MachineReg.
bool addMachineReg(const TargetRegisterInfo &TRI, unsigned MachineReg,
bool addMachineReg(const TargetRegisterInfo &TRI, llvm::Register MachineReg,
unsigned MaxSize = ~1U);
/// Emit a DW_OP_piece or DW_OP_bit_piece operation for a variable fragment.
@ -325,7 +325,8 @@ public:
/// \return false if no DWARF register exists
/// for MachineReg.
bool addMachineRegExpression(const TargetRegisterInfo &TRI,
DIExpressionCursor &Expr, unsigned MachineReg,
DIExpressionCursor &Expr,
llvm::Register MachineReg,
unsigned FragmentOffsetInBits = 0);
/// Begin emission of an entry value dwarf operation. The entry value's
@ -388,7 +389,7 @@ class DebugLocDwarfExpression final : public DwarfExpression {
void commitTemporaryBuffer() override;
bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) override;
llvm::Register MachineReg) override;
public:
DebugLocDwarfExpression(unsigned DwarfVersion, BufferByteStreamer &BS,
@ -418,7 +419,7 @@ class DIEDwarfExpression final : public DwarfExpression {
void commitTemporaryBuffer() override;
bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) override;
llvm::Register MachineReg) override;
public:
DIEDwarfExpression(const AsmPrinter &AP, DwarfCompileUnit &CU, DIELoc &DIE);

View File

@ -83,7 +83,7 @@ unsigned DIEDwarfExpression::getTemporaryBufferSize() {
void DIEDwarfExpression::commitTemporaryBuffer() { OutDIE.takeValues(TmpDIE); }
bool DIEDwarfExpression::isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) {
llvm::Register MachineReg) {
return MachineReg == TRI.getFrameRegister(*AP.MF);
}