cpu: Make CPU and ThreadContext getters const
This patch merely tidies up the CPU and ThreadContext getters by making them const where appropriate.
This commit is contained in:
parent
c4a8e5c36c
commit
62fe81e9c1
11 changed files with 31 additions and 31 deletions
|
@ -143,7 +143,7 @@ class BaseCPU : public MemObject
|
|||
virtual MasterPort &getInstPort() = 0;
|
||||
|
||||
/** Reads this CPU's ID. */
|
||||
int cpuId() { return _cpuId; }
|
||||
int cpuId() const { return _cpuId; }
|
||||
|
||||
/** Reads this CPU's unique data requestor ID */
|
||||
MasterID dataMasterId() { return _dataMasterId; }
|
||||
|
|
|
@ -454,16 +454,16 @@ class BaseDynInst : public RefCounted
|
|||
void dump(std::string &outstring);
|
||||
|
||||
/** Read this CPU's ID. */
|
||||
int cpuId() { return cpu->cpuId(); }
|
||||
int cpuId() const { return cpu->cpuId(); }
|
||||
|
||||
/** Read this CPU's data requestor ID */
|
||||
MasterID masterId() { return cpu->dataMasterId(); }
|
||||
MasterID masterId() const { return cpu->dataMasterId(); }
|
||||
|
||||
/** Read this context's system-wide ID **/
|
||||
int contextId() { return thread->contextId(); }
|
||||
int contextId() const { return thread->contextId(); }
|
||||
|
||||
/** Returns the fault type. */
|
||||
Fault getFault() { return fault; }
|
||||
Fault getFault() const { return fault; }
|
||||
|
||||
/** Checks whether or not this instruction has had its branch target
|
||||
* calculated yet. For now it is not utilized and is hacked to be
|
||||
|
|
|
@ -92,9 +92,9 @@ class CheckerThreadContext : public ThreadContext
|
|||
|
||||
BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
|
||||
|
||||
int cpuId() { return actualTC->cpuId(); }
|
||||
int cpuId() const { return actualTC->cpuId(); }
|
||||
|
||||
int contextId() { return actualTC->contextId(); }
|
||||
int contextId() const { return actualTC->contextId(); }
|
||||
|
||||
void setContextId(int id)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ class CheckerThreadContext : public ThreadContext
|
|||
}
|
||||
|
||||
/** Returns this thread's ID number. */
|
||||
int threadId() { return actualTC->threadId(); }
|
||||
int threadId() const { return actualTC->threadId(); }
|
||||
void setThreadId(int id)
|
||||
{
|
||||
checkerTC->setThreadId(id);
|
||||
|
|
|
@ -91,7 +91,7 @@ InOrderDynInst::InOrderDynInst(InOrderCPU *cpu,
|
|||
int InOrderDynInst::instcount = 0;
|
||||
|
||||
int
|
||||
InOrderDynInst::cpuId()
|
||||
InOrderDynInst::cpuId() const
|
||||
{
|
||||
return cpu->cpuId();
|
||||
}
|
||||
|
|
|
@ -357,10 +357,10 @@ class InOrderDynInst : public RefCounted
|
|||
Fault getFault() { return fault; }
|
||||
|
||||
/** Read this CPU's ID. */
|
||||
int cpuId();
|
||||
int cpuId() const;
|
||||
|
||||
/** Read this context's system-wide ID **/
|
||||
int contextId() { return thread->contextId(); }
|
||||
int contextId() const { return thread->contextId(); }
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -111,14 +111,14 @@ class InOrderThreadContext : public ThreadContext
|
|||
std::string getCpuName() { return cpu->name(); }
|
||||
|
||||
/** Reads this CPU's ID. */
|
||||
int cpuId() { return cpu->cpuId(); }
|
||||
int cpuId() const { return cpu->cpuId(); }
|
||||
|
||||
int contextId() { return thread->contextId(); }
|
||||
int contextId() const { return thread->contextId(); }
|
||||
|
||||
void setContextId(int id) { thread->setContextId(id); }
|
||||
|
||||
/** Returns this thread's ID number. */
|
||||
int threadId() { return thread->threadId(); }
|
||||
int threadId() const { return thread->threadId(); }
|
||||
void setThreadId(int id) { return thread->setThreadId(id); }
|
||||
|
||||
uint64_t readMicroPC()
|
||||
|
|
|
@ -96,14 +96,14 @@ class O3ThreadContext : public ThreadContext
|
|||
virtual BaseCPU *getCpuPtr() { return cpu; }
|
||||
|
||||
/** Reads this CPU's ID. */
|
||||
virtual int cpuId() { return cpu->cpuId(); }
|
||||
virtual int cpuId() const { return cpu->cpuId(); }
|
||||
|
||||
virtual int contextId() { return thread->contextId(); }
|
||||
virtual int contextId() const { return thread->contextId(); }
|
||||
|
||||
virtual void setContextId(int id) { thread->setContextId(id); }
|
||||
|
||||
/** Returns this thread's ID number. */
|
||||
virtual int threadId() { return thread->threadId(); }
|
||||
virtual int threadId() const { return thread->threadId(); }
|
||||
virtual void setThreadId(int id) { return thread->setThreadId(id); }
|
||||
|
||||
/** Returns a pointer to the system. */
|
||||
|
|
|
@ -149,7 +149,7 @@ class OzoneCPU : public BaseCPU
|
|||
void profileClear();
|
||||
void profileSample();
|
||||
|
||||
int threadId();
|
||||
int threadId() const;
|
||||
|
||||
void copyArchRegs(ThreadContext *tc);
|
||||
|
||||
|
|
|
@ -704,7 +704,7 @@ OzoneCPU<Impl>::OzoneTC::profileSample()
|
|||
|
||||
template <class Impl>
|
||||
int
|
||||
OzoneCPU<Impl>::OzoneTC::threadId()
|
||||
OzoneCPU<Impl>::OzoneTC::threadId() const
|
||||
{
|
||||
return thread->threadId();
|
||||
}
|
||||
|
|
|
@ -121,13 +121,13 @@ class ThreadContext
|
|||
|
||||
virtual BaseCPU *getCpuPtr() = 0;
|
||||
|
||||
virtual int cpuId() = 0;
|
||||
virtual int cpuId() const = 0;
|
||||
|
||||
virtual int threadId() = 0;
|
||||
virtual int threadId() const = 0;
|
||||
|
||||
virtual void setThreadId(int id) = 0;
|
||||
|
||||
virtual int contextId() = 0;
|
||||
virtual int contextId() const = 0;
|
||||
|
||||
virtual void setContextId(int id) = 0;
|
||||
|
||||
|
@ -321,13 +321,13 @@ class ProxyThreadContext : public ThreadContext
|
|||
|
||||
BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
|
||||
|
||||
int cpuId() { return actualTC->cpuId(); }
|
||||
int cpuId() const { return actualTC->cpuId(); }
|
||||
|
||||
int threadId() { return actualTC->threadId(); }
|
||||
int threadId() const { return actualTC->threadId(); }
|
||||
|
||||
void setThreadId(int id) { return actualTC->setThreadId(id); }
|
||||
void setThreadId(int id) { actualTC->setThreadId(id); }
|
||||
|
||||
int contextId() { return actualTC->contextId(); }
|
||||
int contextId() const { return actualTC->contextId(); }
|
||||
|
||||
void setContextId(int id) { actualTC->setContextId(id); }
|
||||
|
||||
|
|
|
@ -67,19 +67,19 @@ struct ThreadState {
|
|||
|
||||
void unserialize(Checkpoint *cp, const std::string §ion);
|
||||
|
||||
int cpuId() { return baseCpu->cpuId(); }
|
||||
int cpuId() const { return baseCpu->cpuId(); }
|
||||
|
||||
int contextId() { return _contextId; }
|
||||
int contextId() const { return _contextId; }
|
||||
|
||||
void setContextId(int id) { _contextId = id; }
|
||||
|
||||
void setThreadId(ThreadID id) { _threadId = id; }
|
||||
|
||||
ThreadID threadId() { return _threadId; }
|
||||
ThreadID threadId() const { return _threadId; }
|
||||
|
||||
Tick readLastActivate() { return lastActivate; }
|
||||
Tick readLastActivate() const { return lastActivate; }
|
||||
|
||||
Tick readLastSuspend() { return lastSuspend; }
|
||||
Tick readLastSuspend() const { return lastSuspend; }
|
||||
|
||||
/**
|
||||
* Initialise the physical and virtual port proxies and tie them to
|
||||
|
|
Loading…
Reference in a new issue