From 055a1e553d885b27c0576266443a327657ae913e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 22 Dec 2020 17:45:34 -0500 Subject: [PATCH] CodeGen: Use Register --- include/llvm/CodeGen/MachineFrameInfo.h | 7 ++++--- lib/Target/RISCV/RISCVFrameLowering.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 5cd7f9cde67..7f0ec0df57c 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -14,6 +14,7 @@ #define LLVM_CODEGEN_MACHINEFRAMEINFO_H #include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/Register.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/DataTypes.h" #include @@ -31,7 +32,7 @@ class AllocaInst; /// Callee saved reg can also be saved to a different register rather than /// on the stack by setting DstReg instead of FrameIdx. class CalleeSavedInfo { - unsigned Reg; + Register Reg; union { int FrameIdx; unsigned DstReg; @@ -58,14 +59,14 @@ public: : Reg(R), FrameIdx(FI), Restored(true), SpilledToReg(false) {} // Accessors. - unsigned getReg() const { return Reg; } + Register getReg() const { return Reg; } int getFrameIdx() const { return FrameIdx; } unsigned getDstReg() const { return DstReg; } void setFrameIdx(int FI) { FrameIdx = FI; SpilledToReg = false; } - void setDstReg(unsigned SpillReg) { + void setDstReg(Register SpillReg) { DstReg = SpillReg; SpilledToReg = true; } diff --git a/lib/Target/RISCV/RISCVFrameLowering.cpp b/lib/Target/RISCV/RISCVFrameLowering.cpp index 3dd68fa36d4..26ff6ddcd04 100644 --- a/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -138,7 +138,7 @@ static int getLibCallID(const MachineFunction &MF, // RISCVRegisterInfo::hasReservedSpillSlot assigns negative frame indexes to // registers which can be saved by libcall. if (CS.getFrameIdx() < 0) - MaxReg = std::max(MaxReg.id(), CS.getReg()); + MaxReg = std::max(MaxReg.id(), CS.getReg().id()); if (MaxReg == RISCV::NoRegister) return -1;