cpu: Eliminate the ThreadContext::microPC method.

This was originally intended to make it more efficient to get the
microPC without making a copy of the entire PCState object to return.
Now that the PCState is returned through a pointer without a copy and
the microPC can be accessed with an inline accessor, we don't need to
create a special accessor for it.

Change-Id: I1d354dfca6be5d954e147f23dc9d27917b379bf2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52061
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Gabe Black
2021-10-16 02:25:46 -07:00
parent 2ca49044bd
commit 9d79b751c8
14 changed files with 4 additions and 37 deletions

View File

@@ -348,7 +348,6 @@ class ThreadContext : public gem5::ThreadContext
}
void pcStateNoRecord(const PCStateBase &val) override { pcState(val); }
MicroPC microPC() const override { return 0; }
const PCStateBase &pcState() const override;
void pcState(const PCStateBase &val) override;

View File

@@ -367,7 +367,6 @@ class CheckerCPU : public BaseCPU, public ExecContext
thread->pcState(val);
}
Addr instAddr() { return thread->instAddr(); }
MicroPC microPC() { return thread->microPC(); }
//////////////////////////////////////////
RegVal

View File

@@ -343,9 +343,6 @@ class CheckerThreadContext : public ThreadContext
/** Reads this thread's PC. */
Addr instAddr() const override { return actualTC->instAddr(); }
/** Reads this thread's next PC. */
MicroPC microPC() const override { return actualTC->microPC(); }
RegVal
readMiscRegNoEffect(RegIndex misc_reg) const override
{

View File

@@ -314,9 +314,6 @@ class Commit
/** Returns the PC of a specific thread. */
Addr instAddr(ThreadID tid) { return pc[tid]->instAddr(); }
/** Reads the micro PC of a specific thread. */
Addr microPC(ThreadID tid) { return pc[tid]->microPC(); }
private:
/** Time buffer interface. */
TimeBuffer<TimeStruct> *timeBuffer;

View File

@@ -1325,12 +1325,6 @@ CPU::instAddr(ThreadID tid)
return commit.instAddr(tid);
}
MicroPC
CPU::microPC(ThreadID tid)
{
return commit.microPC(tid);
}
void
CPU::squashFromTC(ThreadID tid)
{

View File

@@ -393,9 +393,6 @@ class CPU : public BaseCPU
/** Reads the commit PC of a specific thread. */
Addr instAddr(ThreadID tid);
/** Reads the commit micro PC of a specific thread. */
MicroPC microPC(ThreadID tid);
/** Initiates a squash of all in-flight instructions for a given
* thread. The source of the squash is an external update of
* state through the TC.

View File

@@ -219,7 +219,7 @@ DynInst::~DynInst()
DPRINTFR(O3PipeView, "O3PipeView:fetch:%llu:0x%08llx:%d:%llu:%s\n",
fetch,
instAddr(),
microPC(),
pcState().microPC(),
seqNum,
staticInst->disassemble(instAddr()));

View File

@@ -518,9 +518,6 @@ class DynInst : public ExecContext, public RefCounted
/** Returns the predicted PC immediately after the branch. */
Addr predInstAddr() { return predPC->instAddr(); }
/** Returns the predicted micro PC after the branch */
Addr predMicroPC() { return predPC->microPC(); }
/** Returns whether the instruction was predicted taken or not. */
bool readPredTaken() { return instFlags[PredTaken]; }
@@ -910,9 +907,6 @@ class DynInst : public ExecContext, public RefCounted
/** Read the PC of this instruction. */
Addr instAddr() const { return pc->instAddr(); }
/**Read the micro PC of this instruction. */
Addr microPC() const { return pc->microPC(); }
bool readPredicate() const override { return instFlags[Predicate]; }
void

View File

@@ -295,13 +295,6 @@ class ThreadContext : public gem5::ThreadContext
return cpu->instAddr(thread->threadId());
}
/** Reads this thread's next PC. */
MicroPC
microPC() const override
{
return cpu->microPC(thread->threadId());
}
/** Reads a miscellaneous register. */
RegVal
readMiscRegNoEffect(RegIndex misc_reg) const override

View File

@@ -92,7 +92,7 @@ class AtomicSimpleCPU : public BaseSimpleCPU
isCpuDrained() const
{
SimpleExecContext &t_info = *threadInfo[curThread];
return t_info.thread->microPC() == 0 &&
return t_info.thread->pcState().microPC() == 0 &&
!locked && !t_info.stayAtPC;
}

View File

@@ -180,7 +180,7 @@ TimingSimpleCPU::switchOut()
assert(!fetchEvent.scheduled());
assert(_status == BaseSimpleCPU::Running || _status == Idle);
assert(!t_info.stayAtPC);
assert(thread->microPC() == 0);
assert(thread->pcState().microPC() == 0);
updateCycleCounts();
updateCycleCounters(BaseCPU::CPU_STATE_ON);

View File

@@ -363,7 +363,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
SimpleExecContext& t_info = *threadInfo[curThread];
SimpleThread* thread = t_info.thread;
return thread->microPC() == 0 && !t_info.stayAtPC &&
return thread->pcState().microPC() == 0 && !t_info.stayAtPC &&
!fetchEvent.scheduled();
}

View File

@@ -430,7 +430,6 @@ class SimpleThread : public ThreadState, public ThreadContext
}
Addr instAddr() const override { return _pcState->instAddr(); }
MicroPC microPC() const override { return _pcState->microPC(); }
bool readPredicate() const { return predicate; }
void setPredicate(bool val) { predicate = val; }

View File

@@ -237,8 +237,6 @@ class ThreadContext : public PCEventScope
virtual Addr instAddr() const = 0;
virtual MicroPC microPC() const = 0;
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const = 0;
virtual RegVal readMiscReg(RegIndex misc_reg) = 0;