From 6b94777be5118377152eef8e4e21c4d0fe4e5bef Mon Sep 17 00:00:00 2001 From: Neumann Hon Date: Wed, 25 Aug 2021 11:24:02 -0400 Subject: [PATCH] [SystemZ] [NFC] Replace SpecialRegisters field with a unique_ptr instead of a raw pointer. This patch replaces the SpecialRegisters field with a unique_ptr instead of a raw pointer. This is better practice, and allows us to remove the definition of the dtor for the SystemZSubtarget class. Reviewed By: uweigand, Kai Differential Revision: https://reviews.llvm.org/D108639 --- llvm/lib/Target/SystemZ/SystemZSubtarget.cpp | 2 -- llvm/lib/Target/SystemZ/SystemZSubtarget.h | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp index bfcdee2..13e54a6 100644 --- a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp +++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp @@ -91,8 +91,6 @@ SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU, InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this), TSInfo(), FrameLowering() {} -SystemZSubtarget::~SystemZSubtarget() { delete getSpecialRegisters(); } - bool SystemZSubtarget::enableSubRegLiveness() const { return UseSubRegLiveness; } diff --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.h b/llvm/lib/Target/SystemZ/SystemZSubtarget.h index f6c155d..4f7156a 100644 --- a/llvm/lib/Target/SystemZ/SystemZSubtarget.h +++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.h @@ -77,7 +77,7 @@ protected: private: Triple TargetTriple; - SystemZCallingConventionRegisters *SpecialRegisters; + std::unique_ptr SpecialRegisters; SystemZInstrInfo InstrInfo; SystemZTargetLowering TLInfo; SystemZSelectionDAGInfo TSInfo; @@ -91,11 +91,9 @@ public: SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM); - ~SystemZSubtarget(); - SystemZCallingConventionRegisters *getSpecialRegisters() const { assert(SpecialRegisters && "Unsupported SystemZ calling convention"); - return SpecialRegisters; + return SpecialRegisters.get(); } const TargetFrameLowering *getFrameLowering() const override { -- 2.7.4