cpu-minor: Get rid of the MinorDynInst::init function.

Just initialize the global MinorDynInst::bubbleInst with a lambda to
avoid having a init() function somebody needs to remember to call, and
which needs to only be called once (or which should only do something
once).

Change-Id: Ied6397e52ccefd6e6bdca012a01f004a47d6f26e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53583
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc
index cd9a11a..b8e9711 100644
--- a/src/cpu/minor/cpu.cc
+++ b/src/cpu/minor/cpu.cc
@@ -76,8 +76,6 @@
         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 8a07647..dfff813 100644
--- a/src/cpu/minor/dyn_inst.cc
+++ b/src/cpu/minor/dyn_inst.cc
@@ -77,18 +77,13 @@
     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 96a1649..ec986cd 100644
--- a/src/cpu/minor/dyn_inst.hh
+++ b/src/cpu/minor/dyn_inst.hh
@@ -267,9 +267,6 @@
      *  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,