diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-03 07:42:22 -0400 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-03 07:42:22 -0400 |
commit | 326662b01b0fbb7fe4e38cec7a96222d2891808b (patch) | |
tree | 35bbca1174a6262d3f69dcf729682e1183f8dede /src/cpu/inorder/inorder_dyn_inst.hh | |
parent | e1ac9629398027186ef4c2a66772aeff2b4c6792 (diff) | |
download | gem5-326662b01b0fbb7fe4e38cec7a96222d2891808b.tar.xz |
arch, cpu: Factor out the ExecContext into a proper base class
We currently generate and compile one version of the ISA code per CPU
model. This is obviously wasting a lot of resources at compile
time. This changeset factors out the interface into a separate
ExecContext class, which also serves as documentation for the
interface between CPUs and the ISA code. While doing so, this
changeset also fixes up interface inconsistencies between the
different CPU models.
The main argument for using one set of ISA code per CPU model has
always been performance as this avoid indirect branches in the
generated code. However, this argument does not hold water. Booting
Linux on a simulated ARM system running in atomic mode
(opt/10.linux-boot/realview-simple-atomic) is actually 2% faster
(compiled using clang 3.4) after applying this patch. Additionally,
compilation time is decreased by 35%.
Diffstat (limited to 'src/cpu/inorder/inorder_dyn_inst.hh')
-rw-r--r-- | src/cpu/inorder/inorder_dyn_inst.hh | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/cpu/inorder/inorder_dyn_inst.hh b/src/cpu/inorder/inorder_dyn_inst.hh index 578fd604a..759da4b04 100644 --- a/src/cpu/inorder/inorder_dyn_inst.hh +++ b/src/cpu/inorder/inorder_dyn_inst.hh @@ -45,6 +45,7 @@ #include "base/trace.hh" #include "base/types.hh" #include "config/the_isa.hh" +#include "cpu/exec_context.hh" #include "cpu/inorder/inorder_trace.hh" #include "cpu/inorder/pipeline_traits.hh" #include "cpu/inorder/resource.hh" @@ -73,7 +74,7 @@ class ResourceRequest; class Packet; -class InOrderDynInst : public RefCounted +class InOrderDynInst : public ExecContext, public RefCounted { public: // Binary machine instruction type. @@ -543,7 +544,7 @@ class InOrderDynInst : public RefCounted // //////////////////////////////////////////////////////////// /** Read the PC of this instruction. */ - const TheISA::PCState &pcState() const { return pc; } + TheISA::PCState pcState() const { return pc; } /** Sets the PC of this instruction. */ void pcState(const TheISA::PCState &_pc) { pc = _pc; } @@ -649,10 +650,10 @@ class InOrderDynInst : public RefCounted { return memAddr; } /** Sets the effective address. */ - void setEA(Addr &ea) { instEffAddr = ea; eaCalcDone = true; } + void setEA(Addr ea) { instEffAddr = ea; eaCalcDone = true; } /** Returns the effective address. */ - const Addr &getEA() const { return instEffAddr; } + Addr getEA() const { return instEffAddr; } /** Returns whether or not the eff. addr. calculation has been completed.*/ bool doneEACalc() { return eaCalcDone; } @@ -854,7 +855,10 @@ class InOrderDynInst : public RefCounted * language (which is why the name isnt readIntSrc(...)) Note: That * the source reg. value is set using the setSrcReg() function. */ - IntReg readIntRegOperand(const StaticInst *si, int idx, ThreadID tid = 0); + IntReg readIntRegOperand(const StaticInst *si, int idx, ThreadID tid); + IntReg readIntRegOperand(const StaticInst *si, int idx) { + return readIntRegOperand(si, idx, 0); + } FloatReg readFloatRegOperand(const StaticInst *si, int idx); TheISA::FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx); MiscReg readMiscReg(int misc_reg); @@ -899,24 +903,21 @@ class InOrderDynInst : public RefCounted void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val); void setFloatRegOperandBits(const StaticInst *si, int idx, TheISA::FloatRegBits val); - void setCCRegOperand(const StaticInst *si, int idx, CCReg val); void setMiscReg(int misc_reg, const MiscReg &val); void setMiscRegNoEffect(int misc_reg, const MiscReg &val); void setMiscRegOperand(const StaticInst *si, int idx, const MiscReg &val); void setMiscRegOperandNoEffect(const StaticInst *si, int idx, const MiscReg &val); - virtual uint64_t readRegOtherThread(unsigned idx, - ThreadID tid = InvalidThreadID); - virtual void setRegOtherThread(unsigned idx, const uint64_t &val, - ThreadID tid = InvalidThreadID); + MiscReg readRegOtherThread(int idx, ThreadID tid); + void setRegOtherThread(int idx, MiscReg val, ThreadID tid); /** Returns the number of consecutive store conditional failures. */ - unsigned readStCondFailures() + unsigned int readStCondFailures() const { return thread->storeCondFailures; } /** Sets the number of consecutive store conditional failures. */ - void setStCondFailures(unsigned sc_failures) + void setStCondFailures(unsigned int sc_failures) { thread->storeCondFailures = sc_failures; } ////////////////////////////////////////////////////////////// @@ -1063,6 +1064,27 @@ class InOrderDynInst : public RefCounted void dump(std::string &outstring); //inline int curCount() { return curCount(); } + + + CCReg readCCRegOperand(const StaticInst *si, int idx) { + panic("readCCRegOperand unimplemented"); + } + + void setCCRegOperand(const StaticInst *si, int idx, CCReg val) { + panic("setCCRegOperand unimplemented"); + } + + void setPredicate(bool val) { + panic("setPredicate unimplemented"); + } + + bool readPredicate() { + panic("readPredicate unimplemented"); + } + + void demapPage(Addr vaddr, uint64_t asn) { + panic("demapPage unimplemented"); + } }; |