From 341dbf266258dcbdb1e5e9f09c244b8ac271faaf Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Sat, 27 Sep 2014 09:08:36 -0400 Subject: arch: Use const StaticInstPtr references where possible This patch optimises the passing of StaticInstPtr by avoiding copying the reference-counting pointer. This avoids first incrementing and then decrementing the reference-counting pointer. --- src/cpu/base_dyn_inst.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/cpu/base_dyn_inst.hh') diff --git a/src/cpu/base_dyn_inst.hh b/src/cpu/base_dyn_inst.hh index 9346b69cc..b1ebe3f09 100644 --- a/src/cpu/base_dyn_inst.hh +++ b/src/cpu/base_dyn_inst.hh @@ -156,7 +156,7 @@ class BaseDynInst : public ExecContext, public RefCounted InstSeqNum seqNum; /** The StaticInst used by this BaseDynInst. */ - StaticInstPtr staticInst; + const StaticInstPtr staticInst; /** Pointer to the Impl's CPU object. */ ImplCPU *cpu; @@ -204,7 +204,7 @@ class BaseDynInst : public ExecContext, public RefCounted TheISA::PCState predPC; /** The Macroop if one exists */ - StaticInstPtr macroop; + const StaticInstPtr macroop; /** How many source registers are ready. */ uint8_t readyRegs; @@ -427,14 +427,14 @@ class BaseDynInst : public ExecContext, public RefCounted * @param seq_num The sequence number of the instruction. * @param cpu Pointer to the instruction's CPU. */ - BaseDynInst(StaticInstPtr staticInst, StaticInstPtr macroop, + BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop, TheISA::PCState pc, TheISA::PCState predPC, InstSeqNum seq_num, ImplCPU *cpu); /** BaseDynInst constructor given a StaticInst pointer. * @param _staticInst The StaticInst for this BaseDynInst. */ - BaseDynInst(StaticInstPtr staticInst, StaticInstPtr macroop); + BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop); /** BaseDynInst destructor. */ ~BaseDynInst(); -- cgit v1.2.3