diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc index cd9a11a794..b8e971196f 100644 --- a/src/cpu/minor/cpu.cc +++ b/src/cpu/minor/cpu.cc @@ -76,8 +76,6 @@ MinorCPU::MinorCPU(const MinorCPUParams ¶ms) : fatal("The Minor model doesn't support checking (yet)\n"); } - minor::MinorDynInst::init(); - pipeline = new minor::Pipeline(*this, params); activityRecorder = pipeline->getActivityRecorder(); diff --git a/src/cpu/minor/dyn_inst.cc b/src/cpu/minor/dyn_inst.cc index 8a076474c5..dfff813975 100644 --- a/src/cpu/minor/dyn_inst.cc +++ b/src/cpu/minor/dyn_inst.cc @@ -77,18 +77,13 @@ operator <<(std::ostream &os, const InstId &id) return os; } -MinorDynInstPtr MinorDynInst::bubbleInst = NULL; - -void -MinorDynInst::init() -{ - if (!bubbleInst) { - bubbleInst = new MinorDynInst(nullStaticInstPtr); - assert(bubbleInst->isBubble()); - /* Make bubbleInst immortal */ - bubbleInst->incref(); - } -} +MinorDynInstPtr MinorDynInst::bubbleInst = []() { + auto *inst = new MinorDynInst(nullStaticInstPtr); + assert(inst->isBubble()); + // Make bubbleInst immortal. + inst->incref(); + return inst; +}(); bool MinorDynInst::isLastOpInInst() const diff --git a/src/cpu/minor/dyn_inst.hh b/src/cpu/minor/dyn_inst.hh index 96a1649a73..ec986cdc7f 100644 --- a/src/cpu/minor/dyn_inst.hh +++ b/src/cpu/minor/dyn_inst.hh @@ -267,9 +267,6 @@ class MinorDynInst : public RefCounted * a whole instruction or the last microop from a macroop */ bool isLastOpInInst() const; - /** Initialise the class */ - static void init(); - /** Print (possibly verbose) instruction information for * MinorTrace using the given Named object's name */ void minorTraceInst(const Named &named_object,