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>
This commit is contained in:
Gabe Black
2021-12-03 18:15:34 -08:00
parent b65272e7f1
commit fb2f99cb6c
3 changed files with 7 additions and 17 deletions

View File

@@ -76,8 +76,6 @@ MinorCPU::MinorCPU(const MinorCPUParams &params) :
fatal("The Minor model doesn't support checking (yet)\n");
}
minor::MinorDynInst::init();
pipeline = new minor::Pipeline(*this, params);
activityRecorder = pipeline->getActivityRecorder();

View File

@@ -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

View File

@@ -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,