summaryrefslogtreecommitdiff
path: root/src/cpu/o3
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-05-05 03:22:19 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2015-05-05 03:22:19 -0400
commitd0d933facc9085727c12f53de76a2cb879ded4c8 (patch)
tree6f4bbec33f85ff63e9804cafa00a735cad31c551 /src/cpu/o3
parenteb1a9977bfcf53652cc7ddbb948ed63262b794be (diff)
downloadgem5-d0d933facc9085727c12f53de76a2cb879ded4c8.tar.xz
cpu: Work around gcc 4.9 issues with Num_OpClasses
This patch fixes a recent issue with gcc 4.9 (and possibly more) being convinced that indices outside the array bounds are used when initialising the FUPool members.
Diffstat (limited to 'src/cpu/o3')
-rw-r--r--src/cpu/o3/fu_pool.cc6
-rw-r--r--src/cpu/o3/fu_pool.hh5
2 files changed, 5 insertions, 6 deletions
diff --git a/src/cpu/o3/fu_pool.cc b/src/cpu/o3/fu_pool.cc
index dab7dbed2..b99eeab69 100644
--- a/src/cpu/o3/fu_pool.cc
+++ b/src/cpu/o3/fu_pool.cc
@@ -87,10 +87,8 @@ FUPool::FUPool(const Params *p)
funcUnits.clear();
- for (int i = 0; i < Num_OpClasses; ++i) {
- maxOpLatencies[i] = Cycles(0);
- pipelined[i] = true;
- }
+ maxOpLatencies.fill(Cycles(0));
+ pipelined.fill(true);
//
// Iterate through the list of FUDescData structures
diff --git a/src/cpu/o3/fu_pool.hh b/src/cpu/o3/fu_pool.hh
index 8b501fc81..e6bb8cb8e 100644
--- a/src/cpu/o3/fu_pool.hh
+++ b/src/cpu/o3/fu_pool.hh
@@ -43,6 +43,7 @@
#ifndef __CPU_O3_FU_POOL_HH__
#define __CPU_O3_FU_POOL_HH__
+#include <array>
#include <bitset>
#include <list>
#include <string>
@@ -71,9 +72,9 @@ class FUPool : public SimObject
{
private:
/** Maximum op execution latencies, per op class. */
- Cycles maxOpLatencies[Num_OpClasses];
+ std::array<Cycles, Num_OpClasses> maxOpLatencies;
/** Whether op is pipelined or not. */
- bool pipelined[Num_OpClasses];
+ std::array<bool, Num_OpClasses> pipelined;
/** Bitvector listing capabilities of this FU pool. */
std::bitset<Num_OpClasses> capabilityList;