mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Use unique_ptr to simplify deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a1129621dd
commit
0c83952c2e
@ -133,7 +133,7 @@ std::string llvm::getQualifiedName(const Record *R) {
|
||||
/// getTarget - Return the current instance of the Target class.
|
||||
///
|
||||
CodeGenTarget::CodeGenTarget(RecordKeeper &records)
|
||||
: Records(records), RegBank(nullptr), SchedModels(nullptr) {
|
||||
: Records(records) {
|
||||
std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target");
|
||||
if (Targets.size() == 0)
|
||||
PrintFatalError("ERROR: No 'Target' subclasses defined!");
|
||||
@ -144,8 +144,6 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records)
|
||||
|
||||
CodeGenTarget::~CodeGenTarget() {
|
||||
DeleteContainerSeconds(Instructions);
|
||||
delete RegBank;
|
||||
delete SchedModels;
|
||||
}
|
||||
|
||||
const std::string &CodeGenTarget::getName() const {
|
||||
@ -211,7 +209,7 @@ Record *CodeGenTarget::getAsmWriter() const {
|
||||
|
||||
CodeGenRegBank &CodeGenTarget::getRegBank() const {
|
||||
if (!RegBank)
|
||||
RegBank = new CodeGenRegBank(Records);
|
||||
RegBank = llvm::make_unique<CodeGenRegBank>(Records);
|
||||
return *RegBank;
|
||||
}
|
||||
|
||||
@ -265,7 +263,7 @@ void CodeGenTarget::ReadLegalValueTypes() const {
|
||||
|
||||
CodeGenSchedModels &CodeGenTarget::getSchedModels() const {
|
||||
if (!SchedModels)
|
||||
SchedModels = new CodeGenSchedModels(Records, *this);
|
||||
SchedModels = llvm::make_unique<CodeGenSchedModels>(Records, *this);
|
||||
return *SchedModels;
|
||||
}
|
||||
|
||||
|
@ -66,14 +66,14 @@ class CodeGenTarget {
|
||||
Record *TargetRec;
|
||||
|
||||
mutable DenseMap<const Record*, CodeGenInstruction*> Instructions;
|
||||
mutable CodeGenRegBank *RegBank;
|
||||
mutable std::unique_ptr<CodeGenRegBank> RegBank;
|
||||
mutable std::vector<Record*> RegAltNameIndices;
|
||||
mutable SmallVector<MVT::SimpleValueType, 8> LegalValueTypes;
|
||||
void ReadRegAltNameIndices() const;
|
||||
void ReadInstructions() const;
|
||||
void ReadLegalValueTypes() const;
|
||||
|
||||
mutable CodeGenSchedModels *SchedModels;
|
||||
mutable std::unique_ptr<CodeGenSchedModels> SchedModels;
|
||||
|
||||
mutable std::vector<const CodeGenInstruction*> InstrsByEnum;
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user